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
christabor/MoAL/MOAL/languages/paradigms/dataflow/pipelines/hartmann_pipeline.py
[ { "content": "# -*- coding: utf-8 -*-\n\n__author__ = \"\"\"Chris Tabor ([email protected])\"\"\"\n\nif __name__ == '__main__':\n from os import getcwd\n from os import sys\n sys.path.append(getcwd())\n\nfrom MOAL.helpers.display import Section\n\nDEBUG = True if __name__ == '__main__' else False\n\n\n\n\n\n\nif DEBUG:\n with Section('Hartmann Pipeline'):\n pass\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PipelineStage:\n pass", "metadata": "root.PipelineStage", "header": "['module', '___EOS___']", "index": 14 }, { "content": "class Pipeline(object):\n", "metadata": "root.Pipeline", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __setitem__(self, k, v):\n pass", "metadata": "root.Pipeline.__setitem__", "header": "['class', 'Pipeline', '(', 'object', ')', ':', '___EOS___']", "index": 20 } ]
[]
[]
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_", "\\u\\u", "author\\u\\u_", "=_", "\"\"\"", "Chr", "is", " ", "Tab", "or", " ", "(", "dx", "dst", "udio", "@", "gma", "il", ".", "com", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "os_", "import_", "getcwd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "getcwd_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "MO", "AL_", "._", "helpers_", "._", "display_", "import_", "Section_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "True_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "Section_", "(_", "'", "Har", "tma", "nn", " ", "Pipe", "line", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\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_", "Pipe", "line", "Stage_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Pipeline_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Pipeline_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "k_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 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 ]
Unreachable code
ilayn/harold/setup.py
[ { "content": "\"\"\"A setuptools based setup module.\nSee:\nhttps://packaging.python.org/en/latest/distributing.html\nhttps://github.com/pypa/sampleproject\n\"\"\"\n\n# Always prefer setuptools over distutils\nfrom setuptools import setup, find_packages\n# To use a consistent encoding\nfrom codecs import open\nfrom os import path\nimport io\n\nhere = path.abspath(path.dirname(__file__))\n\n# Get the long description from the relevant file\n\n\n \nlong_description = read('README.rst', 'CHANGES.txt')\n\nsetup(\n name='harold',\n author='Ilhan Polat',\n author_email='[email protected]',\n url='https://github.com/ilayn/harold',\n version='0.1.1a8',\n description='A control systems library for Python3',\n long_description=long_description,\n license='MIT',\n classifiers=[\n 'Development Status :: 3 - Alpha',\n 'Topic :: Software Development :: Build Tools',\n 'License :: OSI Approved :: MIT License',\n 'Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 3.4',\n 'Programming Language :: Python :: 3.5',\n 'Intended Audience :: Science/Research',\n 'Intended Audience :: Developers',\n 'Topic :: Software Development',\n 'Topic :: Scientific/Engineering',\n 'Operating System :: Microsoft :: Windows',\n 'Operating System :: Unix',\n 'Operating System :: MacOS'\n ],\n packages=['harold'],\n package_dir={'harold': 'harold'},\n install_requires=['numpy','scipy','tabulate'],\n tests_require=['numpy','nose'],\n test_suite = 'nose.collector',\n keywords='control-theory PID controller design industrial automation',\n # List additional groups of dependencies here (e.g. development\n # dependencies). You can install these using the following syntax,\n # for example:\n # $ pip install -e .[dev,test]\n extras_require={\n 'dev': ['check-manifest'],\n 'test': ['coverage'],\n },\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "A", " ", "setup", "tool", "s", " ", "based", " ", "setup", " ", "module", ".", "\\", "10", ";", "See", ":", "\\", "10", ";", "https", "://", "packaging", ".", "python", ".", "org", "/", "en", "/", "late", "st", "/", "distribu", "ting", ".", "html", "\\", "10", ";", "https", "://", "git", "hub", ".", "com", "/", "pypa", "/", "sample", "project", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "way", "s", " ", "prefer", " ", "setup", "tool", "s", " ", "over", " ", "distutils_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "To", " ", "use", " ", "a", " ", "consistent", " ", "encoding_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "codecs_", "import_", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "here_", "=_", "path_", "._", "abspath_", "(_", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "long", " ", "description", " ", "from", " ", "the", " ", "rele", "van", "t", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "long", "\\u", "description_", "=_", "read_", "(_", "'", "READ", "ME", ".", "rst", "'_", ",_", "'", "CHANGE", "S", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "har", "old", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Il", "han", " ", "Pola", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "har", "old", ".", "of", ".", "python", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "ila", "yn", "/", "har", "old", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "0.", "1.1", "a8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "A", " ", "control", " ", "system", "s", " ", "librar", "y", " ", "for", " ", "Pyth", "on", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "long", "\\u", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "MIT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "3", " ", "-", " ", "Al", "pha", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", " ", "::", " ", "Build", " ", "Tool", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "MIT", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Sci", "ence", "/", "Rese", "arch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sci", "enti", "fic", "/", "Engine", "erin", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Micro", "soft", " ", "::", " ", "Window", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Uni", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Mac", "OS", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "'", "har", "old", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "package", "\\u", "dir_", "=_", "{_", "'", "har", "old", "'_", ":_", "'", "har", "old", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "'", "nump", "y", "'_", ",_", "'", "sci", "py", "'_", ",_", "'", "tabul", "ate", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tests", "\\u", "require_", "=_", "[_", "'", "nump", "y", "'_", ",_", "'", "nose", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "suite_", "=_", "'", "nose", ".", "collect", "or", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "'", "control", "-", "theory", " ", "PID", " ", "controlle", "r", " ", "design", " ", "ind", "ustr", "ial", " ", "automati", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "addition", "al", " ", "group", "s", " ", "of", " ", "dependen", "cies", " ", "here", " ", "(", "e", ".", "g", ".", " ", "develop", "ment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dependen", "cies", ").", " ", "You", " ", "can", " ", "install", " ", "these", " ", "usi", "ng", " ", "the", " ", "follow", "ing", " ", "synta", "x", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "example", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", " ", "pip", " ", "install", " ", "-", "e", " ", ".", "[", "dev", ",", "test", "]_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "s", "\\u", "require_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dev", "'_", ":_", "[_", "'", "check", "-", "manifest", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "'_", ":_", "[_", "'", "covera", "ge", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
erkyrath/tworld/lib/tweblib/connections.py
[ { "content": "\"\"\"\nThe ConnectionTable manages the websocket connections from clients.\n\nThe table contains Connection objects. A connection is mostly a wrapper\nfor an active PlayWebSocketHandler, and has a nonzero connection ID as a\nkey. (The connection ID is requested by the handler before it adds itself\nto the table. We use simple incrementing integers for the ID. There's no\nneed to track across tweb sessions, because if tweb crashes, we lose all\nthe websockets anyway...)\n\nA Connection is \"available\" once it has been sent to the tworld (and we\ngot an ack back). If tworld crashes, all connections become unavailable\nuntil it returns (and then we have to ack them again).\n\"\"\"\n\nimport datetime\n\nimport twcommon.misc\nimport tweblib.handlers\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ConnectionTable(object):\n\n\n\n\n\n\n\n", "metadata": "root.ConnectionTable", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def __init__(self, app):\n # Keep a link to the owning application.\n self.app = app\n self.table = {}\n self.counter = 1", "metadata": "root.ConnectionTable.__init__", "header": "['class', 'ConnectionTable', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": " def generate_connid(self):\n \"\"\"Pull out another connection ID to use.\n \"\"\"\n res = self.counter\n self.counter += 1\n return res", "metadata": "root.ConnectionTable.generate_connid", "header": "['class', 'ConnectionTable', '(', 'object', ')', ':', '___EOS___']", "index": 27 }, { "content": " def all(self):\n \"\"\"A (non-dynamic) list of all player connections.\n \"\"\"\n return list(self.table.values())", "metadata": "root.ConnectionTable.all", "header": "['class', 'ConnectionTable', '(', 'object', ')', ':', '___EOS___']", "index": 34 }, { "content": " def as_dict(self):\n \"\"\"A (non-dynamic) map of all player connections.\n \"\"\"\n return dict(self.table)", "metadata": "root.ConnectionTable.as_dict", "header": "['class', 'ConnectionTable', '(', 'object', ')', ':', '___EOS___']", "index": 39 }, { "content": " def count(self):\n \"\"\"The number of player connections.\n \"\"\"\n return len(self.table)", "metadata": "root.ConnectionTable.count", "header": "['class', 'ConnectionTable', '(', 'object', ')', ':', '___EOS___']", "index": 44 }, { "content": " def for_uid(self, uid):\n \"\"\"A list of player connections for a given player. (May be empty.)\n \"\"\"\n return [ conn for conn in self.table.values() if conn.uid == uid ]", "metadata": "root.ConnectionTable.for_uid", "header": "['class', 'ConnectionTable', '(', 'object', ')', ':', '___EOS___']", "index": 49 }, { "content": " def add(self, handler, uid, email, session):\n \"\"\"Add the handler to the table, as a new Connection. It will\n initially be unavailable. Returns the Connection.\n \"\"\"\n assert isinstance(handler, tweblib.handlers.PlayWebSocketHandler)\n assert handler.twconnid, 'handler.twconnid is not positive'\n conn = Connection(handler, uid, email, session['sid'],\n refreshtime=session['refreshtime'],\n guest=session.get('guest', False))\n self.table[conn.connid] = conn\n return conn", "metadata": "root.ConnectionTable.add", "header": "['class', 'ConnectionTable', '(', 'object', ')', ':', '___EOS___']", "index": 54 }, { "content": " def find(self, connid):\n \"\"\"Return the connection with the given connid. Throws an exception\n if not found.\n \"\"\"\n return self.table[connid]", "metadata": "root.ConnectionTable.find", "header": "['class', 'ConnectionTable', '(', 'object', ')', ':', '___EOS___']", "index": 66 }, { "content": " def remove(self, handler):\n \"\"\"Remove this connection from the table.\n \"\"\"\n if not handler.twconnid:\n return\n conn = self.table.get(handler.twconnid, None)\n if not conn:\n return\n assert handler.twconnid == conn.connid, 'Connection ID did not match at remove!'\n conn.handler = None\n conn.uid = None\n conn.available = False\n del self.table[handler.twconnid]", "metadata": "root.ConnectionTable.remove", "header": "['class', 'ConnectionTable', '(', 'object', ')', ':', '___EOS___']", "index": 72 }, { "content": "class Connection(object):\n \"\"\"Represents (and contains) a websocket connection to a player.\n\n Note that we may have two connections to the same player! Which may\n be on the same session, or different sessions.\n \"\"\"\n \n\n\n\n\n ", "metadata": "root.Connection", "header": "['module', '___EOS___']", "index": 86 }, { "content": " def __init__(self, handler, uid, email, sessionid,\n refreshtime, guest=False):\n self.handler = handler\n self.connid = handler.twconnid\n self.uid = uid\n self.sessionid = sessionid\n self.email = email\n self.guest = guest\n self.starttime = twcommon.misc.now() # connection (not session) start\n self.lastmsgtime = self.starttime # last user activity\n self.sessiontime = refreshtime # last session refresh\n self.available = False", "metadata": "root.Connection.__init__", "header": "['class', 'Connection', '(', 'object', ')', ':', '___EOS___']", "index": 93 }, { "content": " def __repr__(self):\n return '<Connection %d>' % (self.connid,)", "metadata": "root.Connection.__repr__", "header": "['class', 'Connection', '(', 'object', ')', ':', '___EOS___']", "index": 106 }, { "content": " def uptime(self):\n \"\"\"Return how long the connection has been open. But trim off the\n microseconds, because that's silly.\n \"\"\"\n delta = twcommon.misc.now() - self.starttime\n return datetime.timedelta(seconds=int(delta.total_seconds()))", "metadata": "root.Connection.uptime", "header": "['class', 'Connection', '(', 'object', ')', ':', '___EOS___']", "index": 109 }, { "content": " def idletime(self):\n \"\"\"Return how long it's been since the last activity from the\n player.\n \"\"\"\n delta = twcommon.misc.now() - self.lastmsgtime\n return datetime.timedelta(seconds=int(delta.total_seconds()))", "metadata": "root.Connection.idletime", "header": "['class', 'Connection', '(', 'object', ')', ':', '___EOS___']", "index": 116 }, { "content": " def close(self, errmsg=None):\n \"\"\"Close the connection. Optionally send an error message through\n first.\n \"\"\"\n if self.handler:\n if (errmsg):\n self.handler.write_tw_error(errmsg)\n try:\n self.handler.close()\n except:\n pass\n # This doesn't trigger the handler's on_close() method, so\n # we need additional cleanup.\n self.handler.on_close()", "metadata": "root.Connection.close", "header": "['class', 'Connection', '(', 'object', ')', ':', '___EOS___']", "index": 123 }, { "content": " def write_tw_error(self, msg):\n \"\"\"Write a JSON error-reporting command through the socket.\n \"\"\"\n if self.handler:\n self.handler.write_tw_error(msg)", "metadata": "root.Connection.write_tw_error", "header": "['class', 'Connection', '(', 'object', ')', ':', '___EOS___']", "index": 138 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "The", " ", "Connect", "ion", "Table", " ", "manage", "s", " ", "the", " ", "websocket", " ", "connections", " ", "from", " ", "clients", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "table", " ", "contain", "s", " ", "Connect", "ion", " ", "object", "s", ".", " ", "A", " ", "connecti", "on", " ", "is", " ", "most", "ly", " ", "a", " ", "wrapp", "er", "\\", "10", ";", "for", " ", "an", " ", "active", " ", "Play", "Web", "Sock", "et", "Handle", "r", ",", " ", "and", " ", "has", " ", "a", " ", "nonzero", " ", "connecti", "on", " ", "ID", " ", "as", " ", "a", "\\", "10", ";", "key", ".", " ", "(", "The", " ", "connecti", "on", " ", "ID", " ", "is", " ", "request", "ed", " ", "by", " ", "the", " ", "handler", " ", "bef", "ore", " ", "it", " ", "adds", " ", "its", "elf", "\\", "10", ";", "to", " ", "the", " ", "table", ".", " ", "We", " ", "use", " ", "simple", " ", "increment", "ing", " ", "integ", "ers", " ", "for", " ", "the", " ", "ID", ".", " ", "There", "'", "s", " ", "no", "\\", "10", ";", "need", " ", "to", " ", "track", " ", "acro", "ss", " ", "twe", "b", " ", "session", "s", ",", " ", "bec", "aus", "e", " ", "if", " ", "twe", "b", " ", "crashes", ",", " ", "we", " ", "lose", " ", "all", "\\", "10", ";", "the", " ", "websocket", "s", " ", "anyway", "...)", "\\", "10", ";", "\\", "10", ";", "A", " ", "Connect", "ion", " ", "is", " ", "\"", "avail", "able", "\"", " ", "onc", "e", " ", "it", " ", "has", " ", "bee", "n", " ", "sent", " ", "to", " ", "the", " ", "two", "rl", "d", " ", "(", "and", " ", "we", "\\", "10", ";", "got", " ", "an", " ", "ack", " ", "back", ").", " ", "If", " ", "two", "rl", "d", " ", "crashes", ",", " ", "all", " ", "connections", " ", "bec", "ome", " ", "unava", "ilab", "le", "\\", "10", ";", "unti", "l", " ", "it", " ", "return", "s", " ", "(", "and", " ", "then", " ", "we", " ", "have", " ", "to", " ", "ack", " ", "them", " ", "again", ").", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tw", "common_", "._", "misc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "twe", "bli", "b_", "._", "handlers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Connect", "ion", "Table_", "(_", "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_", "Connect", "ion", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Keep", " ", "a", " ", "link", " ", "to", " ", "the", " ", "own", "ing", " ", "applica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app_", "=_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "counter_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "conn", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pul", "l", " ", "out", " ", "anot", "her", " ", "connecti", "on", " ", "ID", " ", "to", " ", "use", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "(", "non", "-", "dynami", "c", ")", " ", "list", " ", "of", " ", "all", " ", "player", " ", "connections", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "list_", "(_", "self_", "._", "table_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "as", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "(", "non", "-", "dynami", "c", ")", " ", "map", " ", "of", " ", "all", " ", "player", " ", "connections", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dict_", "(_", "self_", "._", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "number", " ", "of", " ", "player", " ", "connections", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "len_", "(_", "self_", "._", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "for", "\\u", "uid_", "(_", "self_", ",_", "uid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "list", " ", "of", " ", "player", " ", "connections", " ", "for", " ", "a", " ", "give", "n", " ", "player", ".", " ", "(", "Ma", "y", " ", "be", " ", "empty", ".)", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "conn_", "for_", "conn_", "in_", "self_", "._", "table_", "._", "values_", "(_", ")_", "if_", "conn_", "._", "uid_", "==_", "uid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "self_", ",_", "handler_", ",_", "uid_", ",_", "email_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "the", " ", "handler", " ", "to", " ", "the", " ", "table", ",", " ", "as", " ", "a", " ", "new", " ", "Connect", "ion", ".", " ", "It", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "initially", " ", "be", " ", "unava", "ilab", "le", ".", " ", "Return", "s", " ", "the", " ", "Connect", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "handler_", ",_", "twe", "bli", "b_", "._", "handlers_", "._", "Play", "Web", "Sock", "et", "Handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "handler_", "._", "tw", "conn", "id_", ",_", "'", "handler", ".", "tw", "conn", "id", " ", "is", " ", "not", " ", "posit", "ive", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "Connection_", "(_", "handler_", ",_", "uid_", ",_", "email_", ",_", "session_", "[_", "'", "sid", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "refre", "sht", "ime_", "=_", "session_", "[_", "'", "refre", "sht", "ime", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "guest_", "=_", "session_", "._", "get_", "(_", "'", "guest", "'_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "table_", "[_", "conn_", "._", "conn", "id_", "]_", "=_", "conn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "conn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find_", "(_", "self_", ",_", "conn", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "connecti", "on", " ", "with", " ", "the", " ", "give", "n", " ", "conn", "id", ".", " ", "Throw", "s", " ", "an", " ", "exception", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "table_", "[_", "conn", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Table_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove_", "(_", "self_", ",_", "handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", " ", "this", " ", "connecti", "on", " ", "from", " ", "the", " ", "table", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "handler_", "._", "tw", "conn", "id_", ":_", "\\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_", "conn_", "=_", "self_", "._", "table_", "._", "get_", "(_", "handler_", "._", "tw", "conn", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "conn_", ":_", "\\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_", "assert_", "handler_", "._", "tw", "conn", "id_", "==_", "conn_", "._", "conn", "id_", ",_", "'", "Connect", "ion", " ", "ID", " ", "did", " ", "not", " ", "match", " ", "at", " ", "remove", "!'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "handler_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "uid_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "available_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "table_", "[_", "handler_", "._", "tw", "conn", "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_", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "(", "and", " ", "contain", "s", ")", " ", "a", " ", "websocket", " ", "connecti", "on", " ", "to", " ", "a", " ", "player", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "we", " ", "may", " ", "have", " ", "two", " ", "connections", " ", "to", " ", "the", " ", "same", " ", "player", "!", " ", "Whi", "ch", " ", "may", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "on", " ", "the", " ", "same", " ", "session", ",", " ", "or", " ", "different", " ", "session", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "handler_", ",_", "uid_", ",_", "email_", ",_", "sessionid", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "refre", "sht", "ime_", ",_", "guest_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handler_", "=_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "conn", "id_", "=_", "handler_", "._", "tw", "conn", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "uid_", "=_", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sessionid", "_", "=_", "sessionid", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "email_", "=_", "email_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "guest_", "=_", "guest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "starttime_", "=_", "tw", "common_", "._", "misc_", "._", "now_", "(_", ")_", "#", " ", "connecti", "on", " ", "(", "not", " ", "session", ")", " ", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lastm", "sg", "time_", "=_", "self_", "._", "starttime_", "#", " ", "last", " ", "user", " ", "activity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session", "time_", "=_", "refre", "sht", "ime_", "#", " ", "last", " ", "session", " ", "refresh_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "available_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "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_", "'<", "Connect", "ion", " ", "%", "d", ">'_", "%_", "(_", "self_", "._", "conn", "id_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "uptime_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "how", " ", "long", " ", "the", " ", "connecti", "on", " ", "has", " ", "bee", "n", " ", "open", ".", " ", "Bu", "t", " ", "trim", " ", "off", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "microsecond", "s", ",", " ", "bec", "aus", "e", " ", "tha", "t", "'", "s", " ", "sil", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "tw", "common_", "._", "misc_", "._", "now_", "(_", ")_", "-_", "self_", "._", "starttime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "int_", "(_", "delta_", "._", "total", "\\u", "seconds_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "idle", "time_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "how", " ", "long", " ", "it", "'", "s", " ", "bee", "n", " ", "sinc", "e", " ", "the", " ", "last", " ", "activit", "y", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "player", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "tw", "common_", "._", "misc_", "._", "now_", "(_", ")_", "-_", "self_", "._", "lastm", "sg", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "int_", "(_", "delta_", "._", "total", "\\u", "seconds_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ",_", "errmsg_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Clos", "e", " ", "the", " ", "connecti", "on", ".", " ", "Optio", "nal", "ly", " ", "send", " ", "an", " ", "error", " ", "message", " ", "through", "\\", "10", ";", " ", " ", " ", " ", "first", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "handler_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "errmsg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handler_", "._", "write", "\\u", "tw", "\\u", "error_", "(_", "errmsg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handler_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "doe", "sn", "'", "t", " ", "trigger", " ", "the", " ", "handler", "'", "s", " ", "on", "\\u", "close", "()", " ", "method", ",", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "addition", "al", " ", "clean", "up", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "handler_", "._", "on", "\\u", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "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_", "write", "\\u", "tw", "\\u", "error_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", " ", "a", " ", "JSO", "N", " ", "error", "-", "reporting", " ", "command", " ", "through", " ", "the", " ", "socket", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "handler_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hand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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
benoitc/gunicorn/docs/sitemap_gen.py
[ { "content": " def Canonicalize(loc):\n \"\"\" Do encoding and canonicalization on a URL string \"\"\"\n if not loc:\n return loc\n\n # Let the encoder try to narrow it\n narrow = encoder.NarrowText(loc, None)\n\n # Escape components individually\n (scheme, netloc, path, query, frag) = urlparse.urlsplit(narrow)\n unr = '-._~'\n sub = '!$&\\'()*+,;='\n netloc = urllib.quote(netloc, unr + sub + '%:@/[]')\n path = urllib.quote(path, unr + sub + '%:@/')\n query = urllib.quote(query, unr + sub + '%:@/?')\n frag = urllib.quote(frag, unr + sub + '%:@/?')\n\n # Try built-in IDNA encoding on the netloc\n try:\n (ignore, widenetloc, ignore, ignore, ignore) = urlparse.urlsplit(loc)\n for c in widenetloc:\n if c >= unichr(128):\n netloc = widenetloc.encode(ENC_IDNA)\n netloc = urllib.quote(netloc, unr + sub + '%:@/[]')\n break\n except UnicodeError:\n # urlsplit must have failed, based on implementation differences in the\n # library. There is not much we can do here, except ignore it.\n pass\n except LookupError:\n output.Warn('An International Domain Name (IDN) is being used, but this '\n 'version of Python does not have support for IDNA encoding. '\n ' (IDNA support was introduced in Python 2.3) The encoding '\n 'we have used instead is wrong and will probably not yield '\n 'valid URLs.')\n bad_netloc = False\n if '%' in netloc:\n bad_netloc = True\n\n # Put it all back together\n narrow = urlparse.urlunsplit((scheme, netloc, path, query, frag))\n\n # I let '%' through. Fix any that aren't pre-existing escapes.\n HEXDIG = '0123456789abcdefABCDEF'\n list = narrow.split('%')\n narrow = list[0]\n del list[0]\n for item in list:\n if (len(item) >= 2) and (item[0] in HEXDIG) and (item[1] in HEXDIG):\n narrow = narrow + '%' + item\n else:\n narrow = narrow + '%25' + item\n\n # Issue a warning if this is a bad URL\n if bad_netloc:\n output.Warn('Invalid characters in the host or domain portion of a URL: '\n + narrow)\n\n return narrow", "metadata": "root.URL.Canonicalize", "header": "['class', 'URL', '(', 'object', ')', ':', '___EOS___']", "index": 482 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "URL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Canonical", "ize_", "(_", "loc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Do", " ", "encoding", " ", "and", " ", "canonicaliz", "ation", " ", "on", " ", "a", " ", "URL", " ", "string", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "loc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "loc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Let", " ", "the", " ", "encode", "r", " ", "try", " ", "to", " ", "narrow", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "narrow", "_", "=_", "encoder_", "._", "Nar", "row", "Text_", "(_", "loc_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Esc", "ape", " ", "component", "s", " ", "individual", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "scheme_", ",_", "netloc_", ",_", "path_", ",_", "query_", ",_", "frag_", ")_", "=_", "urlparse_", "._", "urlsplit_", "(_", "narrow", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unr", "_", "=_", "'-", ".\\u", "~'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "'!", "$", "&", "\\\\'", "()", "*+", ",", ";", "='_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "netloc_", "=_", "urllib_", "._", "quote_", "(_", "netloc_", ",_", "unr", "_", "+_", "sub_", "+_", "'%", ":", "@", "/", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "urllib_", "._", "quote_", "(_", "path_", ",_", "unr", "_", "+_", "sub_", "+_", "'%", ":", "@", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "urllib_", "._", "quote_", "(_", "query_", ",_", "unr", "_", "+_", "sub_", "+_", "'%", ":", "@", "/?", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frag_", "=_", "urllib_", "._", "quote_", "(_", "frag_", ",_", "unr", "_", "+_", "sub_", "+_", "'%", ":", "@", "/?", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "bui", "lt", "-", "in", " ", "ID", "NA", " ", "encoding", " ", "on", " ", "the", " ", "netloc_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "ignore_", ",_", "wide", "netloc_", ",_", "ignore_", ",_", "ignore_", ",_", "ignore_", ")_", "=_", "urlparse_", "._", "urlsplit_", "(_", "loc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "wide", "netloc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "c_", ">=_", "unichr_", "(_", "128_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "netloc_", "=_", "wide", "netloc_", "._", "encode_", "(_", "ENC", "\\u", "ID", "NA_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "netloc_", "=_", "urllib_", "._", "quote_", "(_", "netloc_", ",_", "unr", "_", "+_", "sub_", "+_", "'%", ":", "@", "/", "[]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "urls", "plit", " ", "must", " ", "have", " ", "fail", "ed", ",", " ", "based", " ", "on", " ", "implementation", " ", "difference", "s", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "librar", "y", ".", " ", " ", "There", " ", "is", " ", "not", " ", "muc", "h", " ", "we", " ", "can", " ", "do", " ", "here", ",", " ", "except", " ", "ignore", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Look", "up", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "Warn", "_", "(_", "'", "An", " ", "Intern", "ation", "al", " ", "Doma", "in", " ", "Name", " ", "(", "ID", "N", ")", " ", "is", " ", "bei", "ng", " ", "used", ",", " ", "but", " ", "this", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", " ", "of", " ", "Pyth", "on", " ", "doe", "s", " ", "not", " ", "have", " ", "support", " ", "for", " ", "ID", "NA", " ", "encoding", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "(", "ID", "NA", " ", "support", " ", "was", " ", "introduce", "d", " ", "in", " ", "Pyth", "on", " ", "2.3", ")", " ", " ", "The", " ", "encoding", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "we", " ", "have", " ", "used", " ", "inst", "ead", " ", "is", " ", "wrong", " ", "and", " ", "will", " ", "probab", "ly", " ", "not", " ", "yield", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "valid", " ", "URL", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bad", "\\u", "netloc_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'%'_", "in_", "netloc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bad", "\\u", "netloc_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "it", " ", "all", " ", "back", " ", "together_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "narrow", "_", "=_", "urlparse_", "._", "urlu", "nsp", "lit_", "(_", "(_", "scheme_", ",_", "netloc_", ",_", "path_", ",_", "query_", ",_", "frag_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", " ", "let", " ", "'%", "'", " ", "through", ".", " ", " ", "Fix", " ", "any", " ", "tha", "t", " ", "are", "n", "'", "t", " ", "pre", "-", "exist", "ing", " ", "escape", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "HEX", "DIG", "_", "=_", "'", "0123456", "789", "abcde", "f", "ABCDE", "F", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list_", "=_", "narrow", "_", "._", "split_", "(_", "'%'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "narrow", "_", "=_", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "len_", "(_", "item_", ")_", ">=_", "2_", ")_", "and_", "(_", "item_", "[_", "0_", "]_", "in_", "HEX", "DIG", "_", ")_", "and_", "(_", "item_", "[_", "1_", "]_", "in_", "HEX", "DIG", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "narrow", "_", "=_", "narrow", "_", "+_", "'%'_", "+_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "narrow", "_", "=_", "narrow", "_", "+_", "'%", "25", "'_", "+_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Issue", " ", "a", " ", "warn", "ing", " ", "if", " ", "this", " ", "is", " ", "a", " ", "bad", " ", "URL_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bad", "\\u", "netloc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "Warn", "_", "(_", "'", "Inva", "lid", " ", "character", "s", " ", "in", " ", "the", " ", "host", " ", "or", " ", "domain", " ", "porti", "on", " ", "of", " ", "a", " ", "URL", ":", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "narrow", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "narrow", "_", "\\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,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
aldebaran/qibuild/python/qisrc/actions/checkout.py
[ { "content": "def do(args):\n branch = args.branch\n git_worktree = qisrc.parsers.get_git_worktree(args)\n manifest = git_worktree.manifest\n groups = manifest.groups\n branch = args.branch\n git_worktree.configure_manifest(manifest.url, groups=groups, branch=branch)\n ok = git_worktree.checkout(branch, force=args.force)\n if not ok:\n sys.exit(1)", "metadata": "root.do", "header": "['module', '___EOS___']", "index": 23 } ]
[]
[]
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_", "do_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "branch_", "=_", "args_", "._", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "=_", "qi", "src_", "._", "parsers_", "._", "get", "\\u", "git", "\\u", "work", "tree_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manifest_", "=_", "git", "\\u", "work", "tree_", "._", "manifest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groups_", "=_", "manifest_", "._", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "=_", "args_", "._", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "work", "tree_", "._", "configur", "e\\u", "manifest_", "(_", "manifest_", "._", "url_", ",_", "groups_", "=_", "groups_", ",_", "branch_", "=_", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok_", "=_", "git", "\\u", "work", "tree_", "._", "checkout_", "(_", "branch_", ",_", "force_", "=_", "args_", "._", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "1_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
paulgb/runipy/setup.py
[ { "content": "from distutils.version import LooseVersion\nfrom setuptools import setup\n\nimport versioneer\n\n\nusing_ipy4 = False\ntry:\n from IPython import __version__ as ipyv\n using_ipy4 = (ipyv >= LooseVersion(\"4\"))\nexcept ImportError:\n using_ipy4 = True\n\ninstall_requires = [\n 'Jinja2>=2.7.2',\n 'Pygments>=1.6',\n 'ipython>=2.3.1',\n 'pyzmq>=14.1.0',\n]\nif using_ipy4:\n install_requires.extend([\n 'ipykernel>=4.0.0',\n 'nbconvert>=4.0.0',\n 'nbformat>=4.0.0',\n ])\n\nreadme = \"\"\nwith open(\"README.rst\") as readme_file:\n readme = readme_file.read()\n\nsetup(\n name='runipy',\n version=versioneer.get_version(),\n license=\"BSD 2-Clause\",\n description='Run IPython notebooks from the command line',\n long_description=readme,\n url='https://github.com/paulgb/runipy',\n author='Paul Butler',\n author_email='[email protected]',\n maintainer='John Kirkham',\n maintainer_email='[email protected]',\n platforms='any',\n classifiers=[\n 'Environment :: Console',\n 'Framework :: IPython',\n 'License :: OSI Approved :: BSD License',\n 'Programming Language :: Python :: 2',\n 'Programming Language :: Python :: 2.7',\n 'Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 3.3',\n 'Programming Language :: Python :: 3.4',\n 'Programming Language :: Python :: 3.5',\n ],\n keywords='ipython',\n install_requires=install_requires,\n packages=['runipy'],\n entry_points={\n 'console_scripts': [\n 'runipy = runipy.main:main'\n ]\n },\n cmdclass=versioneer.get_cmdclass(),\n test_suite=\"test_runipy\",\n zip_safe=True\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "distutils_", "._", "version_", "import_", "Lo", "ose", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "version", "eer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "usi", "ng", "\\u", "ipy", "4_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "IP", "ython_", "import_", "\\u\\u", "version\\u\\u_", "as_", "ipy", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usi", "ng", "\\u", "ipy", "4_", "=_", "(_", "ipy", "v_", ">=_", "Lo", "ose", "Version_", "(_", "\"", "4", "\"_", ")_", ")_", "\\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 ", " _", "usi", "ng", "\\u", "ipy", "4_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Jin", "ja", "2", ">=", "2.7", ".2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Pyg", "ment", "s", ">=", "1.6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ipython", ">=", "2.3", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "py", "zmq", ">=", "14.", "1.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "usi", "ng", "\\u", "ipy", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "install", "\\u", "requires_", "._", "extend_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ipy", "kernel", ">=", "4.0", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nbc", "onv", "ert", ">=", "4.0", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nb", "format", ">=", "4.0", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "readme_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "\"", "READ", "ME", ".", "rst", "\"_", ")_", "as_", "readme", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "readme_", "=_", "readme", "\\u", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "runi", "py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "version", "eer", "_", "._", "get", "\\u", "version_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "\"", "BS", "D", " ", "2", "-", "Cla", "use", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "Run", " ", "IP", "yth", "on", " ", "notebook", "s", " ", "from", " ", "the", " ", "command", " ", "line", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "readme_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "paul", "gb", "/", "runi", "py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Paul", " ", "Bu", "tle", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "paul", "gb", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maintainer_", "=_", "'", "Joh", "n", " ", "Ki", "rk", "ham", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "maintainer", "\\u", "email_", "=_", "'", "ja", "kir", "kha", "m", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "platforms_", "=_", "'", "any", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Environ", "ment", " ", "::", " ", "Cons", "ole", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Frame", "work", " ", "::", " ", "IP", "yth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "BS", "D", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.4", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "'", "ipython", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "install", "\\u", "requires_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "'", "runi", "py", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "entry", "\\u", "points_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "console", "\\u", "scripts", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "runi", "py", " ", "=", " ", "runi", "py", ".", "main", ":", "main", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmdclass_", "=_", "version", "eer", "_", "._", "get", "\\u", "cmdclass_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "suite_", "=_", "\"", "test\\u", "runi", "py", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zip", "\\u", "safe_", "=_", "True_", "\\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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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 ]
Unused import
dimagi/commcare-hq/corehq/apps/ota/tasks.py
[ { "content": "from celery.task import task\nfrom couchdbkit.exceptions import ResourceNotFound\nfrom casexml.apps.case.xml import V1\nfrom casexml.apps.phone.restore import RestoreParams, RestoreCacheSettings, RestoreConfig\nfrom corehq.apps.users.models import CommCareUser\nfrom soil import DownloadBase\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@task\ndef prime_restore(domain, usernames_or_ids, version=V1, cache_timeout_hours=None,\n overwrite_cache=False, check_cache_only=False):\n \"\"\"\n Task to generate and cache a restore payload for each user passed in.\n\n :param domain: The domain name for the users\n :param usernames_or_ids: List of usernames or user IDs\n :param version: Restore format version\n :param cache_timeout_hours: Hours to cache the payload\n :param overwrite_cache: If True overwrite any existing cache\n :param check_cache_only: Don't generate the payload, just check if it is already cached\n \"\"\"\n total = len(usernames_or_ids)\n DownloadBase.set_progress(prime_restore, 0, total)\n\n ret = {'messages': []}\n for i, username_or_id in enumerate(usernames_or_ids):\n couch_user = get_user(username_or_id, domain)\n if not couch_user:\n ret['messages'].append('WARNING: User not found: {}'.format(username_or_id))\n continue\n elif couch_user.domain != domain:\n ret['messages'].append(\"WARNING: User '{}' not from domain '{}'\".format(\n username_or_id,\n domain\n ))\n continue\n\n try:\n project = couch_user.project\n restore_config = RestoreConfig(\n project=project,\n user=couch_user.to_casexml_user(),\n params=RestoreParams(\n version=version,\n include_item_count=True,\n ),\n cache_settings=RestoreCacheSettings(\n force_cache=True,\n cache_timeout=cache_timeout_hours * 60 * 60,\n overwrite_cache=overwrite_cache\n )\n )\n\n if check_cache_only:\n cached_payload = _get_cached_payload(restore_config)\n ret['messages'].append(u'Restore cache {} for user: {}'.format(\n 'EXISTS' if cached_payload else 'does not exist',\n couch_user.human_friendly_name,\n ))\n else:\n restore_config.get_payload()\n\n cached_payload = _get_cached_payload(restore_config)\n if cached_payload:\n ret['messages'].append('SUCCESS: Restore cached successfully for user: {}'.format(\n couch_user.human_friendly_name,\n ))\n else:\n ret['messages'].append('ERROR: Restore completed by cache still empty for user: {}'.format(\n couch_user.human_friendly_name,\n ))\n except Exception as e:\n ret['messages'].append('ERROR: Error processing user: {}'.format(str(e)))\n\n DownloadBase.set_progress(prime_restore, i + 1, total)\n\n return ret", "metadata": "root.prime_restore", "header": "['module', '___EOS___']", "index": 8 }, { "content": "def _get_cached_payload(restore_config):\n original = restore_config.overwrite_cache\n try:\n # must set this to False before attempting to check the cache\n restore_config.overwrite_cache = False\n payload = restore_config.get_cached_payload()\n finally:\n restore_config.overwrite_cache = original\n return payload", "metadata": "root._get_cached_payload", "header": "['module', '___EOS___']", "index": 79 }, { "content": "def get_user(username_or_id, domain):\n if '@' in username_or_id:\n return get_user_from_username(username_or_id)\n else:\n try:\n couch_user = CommCareUser.get(username_or_id)\n return couch_user\n except ResourceNotFound:\n username_or_id = '{}@{}.commcarehq.org'.format(username_or_id, domain)\n return get_user_from_username(username_or_id)", "metadata": "root.get_user", "header": "['module', '___EOS___']", "index": 90 }, { "content": "def get_user_from_username(username):\n try:\n return CommCareUser.get_by_username(username)\n except ResourceNotFound:\n return None", "metadata": "root.get_user_from_username", "header": "['module', '___EOS___']", "index": 102 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "celery_", "._", "task_", "import_", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "couchdb", "kit_", "._", "exceptions_", "import_", "Reso", "urc", "e", "Not", "Found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "case", "xml_", "._", "apps_", "._", "case_", "._", "xml_", "import_", "V1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "case", "xml_", "._", "apps_", "._", "phone_", "._", "restore_", "import_", "Restor", "e", "Params_", ",_", "Restor", "e", "Cache", "Settings_", ",_", "Restor", "e", "Config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "users_", "._", "models_", "import_", "Comm", "Care", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "soil", "_", "import_", "Down", "load", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "prim", "e\\u", "restore_", "(_", "domain_", ",_", "usernames", "\\u", "or", "\\u", "ids_", ",_", "version_", "=_", "V1_", ",_", "cache", "\\u", "timeo", "ut", "\\u", "hours_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "overwrit", "e\\u", "cache_", "=_", "False_", ",_", "check", "\\u", "cache", "\\u", "only_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Task", " ", "to", " ", "generat", "e", " ", "and", " ", "cache", " ", "a", " ", "restore", " ", "payload", " ", "for", " ", "each", " ", "user", " ", "pass", "ed", " ", "in", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "domain", ":", " ", " ", " ", " ", " ", " ", "The", " ", "domain", " ", "name", " ", "for", " ", "the", " ", "users", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "usernames", "\\u", "or", "\\u", "ids", ":", " ", " ", " ", " ", "List", " ", "of", " ", "usernames", " ", "or", " ", "user", " ", "ID", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "version", ":", " ", " ", " ", " ", " ", "Restor", "e", " ", "format", " ", "version", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cache", "\\u", "timeo", "ut", "\\u", "hour", "s", ":", " ", "Hour", "s", " ", "to", " ", "cache", " ", "the", " ", "payload", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "overwrit", "e\\u", "cache", ":", " ", "If", " ", "Tru", "e", " ", "overwrit", "e", " ", "any", " ", "exist", "ing", " ", "cache", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "check", "\\u", "cache", "\\u", "only", ":", " ", " ", " ", " ", "Don", "'", "t", " ", "generat", "e", " ", "the", " ", "payload", ",", " ", "just", " ", "check", " ", "if", " ", "it", " ", "is", " ", "alr", "ead", "y", " ", "cache", "d", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "len_", "(_", "usernames", "\\u", "or", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Down", "load", "Base_", "._", "set\\u", "progress_", "(_", "prim", "e\\u", "restore_", ",_", "0_", ",_", "total_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "{_", "'", "message", "s", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "user", "name", "\\u", "or", "\\u", "id_", "in_", "enumerate_", "(_", "usernames", "\\u", "or", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "couch", "\\u", "user_", "=_", "get", "\\u", "user_", "(_", "user", "name", "\\u", "or", "\\u", "id_", ",_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "couch", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "message", "s", "'_", "]_", "._", "append_", "(_", "'", "WARN", "ING", ":", " ", "User", " ", "not", " ", "found", ":", " ", "{}'_", "._", "format_", "(_", "user", "name", "\\u", "or", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "couch", "\\u", "user_", "._", "domain_", "!=_", "domain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "message", "s", "'_", "]_", "._", "append_", "(_", "\"", "WARN", "ING", ":", " ", "User", " ", "'{}'", " ", "not", " ", "from", " ", "domain", " ", "'{}'\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user", "name", "\\u", "or", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "couch", "\\u", "user_", "._", "project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restore", "\\u", "config_", "=_", "Restor", "e", "Config_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "couch", "\\u", "user_", "._", "to", "\\u", "case", "xml", "\\u", "user_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "Restor", "e", "Params_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "item", "\\u", "count_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "settings_", "=_", "Restor", "e", "Cache", "Settings_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "force", "\\u", "cache_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "timeout_", "=_", "cache", "\\u", "timeo", "ut", "\\u", "hours_", "*_", "60_", "*_", "60_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "overwrit", "e\\u", "cache_", "=_", "overwrit", "e\\u", "cache_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "check", "\\u", "cache", "\\u", "only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache", "d\\u", "payload_", "=_", "\\u", "get", "\\u", "cache", "d\\u", "payload_", "(_", "restore", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "'", "message", "s", "'_", "]_", "._", "append_", "(_", "u", "'", "Restor", "e", " ", "cache", " ", "{}", " ", "for", " ", "user", ":", " ", "{}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "EXIST", "S", "'_", "if_", "cache", "d\\u", "payload_", "else_", "'", "doe", "s", " ", "not", " ", "exist", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "couch", "\\u", "user_", "._", "human", "\\u", "frie", "ndl", "y", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "restore", "\\u", "config_", "._", "get", "\\u", "payload_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "d\\u", "payload_", "=_", "\\u", "get", "\\u", "cache", "d\\u", "payload_", "(_", "restore", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cache", "d\\u", "payload_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ret_", "[_", "'", "message", "s", "'_", "]_", "._", "append_", "(_", "'", "SUCCESS", ":", " ", "Restor", "e", " ", "cache", "d", " ", "success", "full", "y", " ", "for", " ", "user", ":", " ", "{}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "couch", "\\u", "user_", "._", "human", "\\u", "frie", "ndl", "y", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ret_", "[_", "'", "message", "s", "'_", "]_", "._", "append_", "(_", "'", "ERROR", ":", " ", "Restor", "e", " ", "complete", "d", " ", "by", " ", "cache", " ", "still", " ", "empty", " ", "for", " ", "user", ":", " ", "{}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "couch", "\\u", "user_", "._", "human", "\\u", "frie", "ndl", "y", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "[_", "'", "message", "s", "'_", "]_", "._", "append_", "(_", "'", "ERROR", ":", " ", "Error", " ", "process", "ing", " ", "user", ":", " ", "{}'_", "._", "format_", "(_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Down", "load", "Base_", "._", "set\\u", "progress_", "(_", "prim", "e\\u", "restore_", ",_", "i_", "+_", "1_", ",_", "total_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "cache", "d\\u", "payload_", "(_", "restore", "\\u", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "original_", "=_", "restore", "\\u", "config_", "._", "overwrit", "e\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "must", " ", "set", " ", "this", " ", "to", " ", "Fal", "se", " ", "bef", "ore", " ", "atte", "mpt", "ing", " ", "to", " ", "check", " ", "the", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "restore", "\\u", "config_", "._", "overwrit", "e\\u", "cache_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payload_", "=_", "restore", "\\u", "config_", "._", "get", "\\u", "cache", "d\\u", "payload_", "(_", ")_", "\\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 ", " _", "restore", "\\u", "config_", "._", "overwrit", "e\\u", "cache_", "=_", "original_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "payload_", "\\u\\u\\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", "user_", "(_", "user", "name", "\\u", "or", "\\u", "id_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'@'_", "in_", "user", "name", "\\u", "or", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "get", "\\u", "user", "\\u", "from", "\\u", "username_", "(_", "user", "name", "\\u", "or", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "couch", "\\u", "user_", "=_", "Comm", "Care", "User_", "._", "get_", "(_", "user", "name", "\\u", "or", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "couch", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Reso", "urc", "e", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "name", "\\u", "or", "\\u", "id_", "=_", "'{}", "@{", "}.", "comm", "care", "hq", ".", "org", "'_", "._", "format_", "(_", "user", "name", "\\u", "or", "\\u", "id_", ",_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "get", "\\u", "user", "\\u", "from", "\\u", "username_", "(_", "user", "name", "\\u", "or", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "user", "\\u", "from", "\\u", "username_", "(_", "username_", ")_", ":_", "\\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_", "Comm", "Care", "User_", "._", "get", "\\u", "by", "\\u", "username_", "(_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Reso", "urc", "e", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported more than once
jrief/django-websocket-redis/examples/wsgi.py
[ { "content": "# test uWSGI with low traffic:\n# uwsgi --virtualenv /path/to/virtualenv --http :9090 --gevent 100 --http-websockets --module wsgi\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath('..'))\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'chatserver.settings')\n\nfrom django.core.wsgi import get_wsgi_application\nfrom django.conf import settings\nfrom ws4redis.uwsgi_runserver import uWSGIWebsocketServer\n\n_django_app = get_wsgi_application()\n_websocket_app = uWSGIWebsocketServer()\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "test", " ", "u", "WS", "GI", " ", "with", " ", "low", " ", "traffic", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "uwsgi", " ", "--", "virtualenv", " ", "/", "path", "/", "to", "/", "virtualenv", " ", "--", "http", " ", ":", "9090", " ", "--", "gev", "ent", " ", "100", " ", "--", "http", "-", "websocket", "s", " ", "--", "module", " ", "wsgi_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "os_", "._", "path_", "._", "abspath_", "(_", "'..'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "._", "setdefault_", "(_", "'", "DJANGO", "\\u", "SETTING", "S", "\\u", "MODUL", "E", "'_", ",_", "'", "chat", "server", ".", "settings", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "wsgi_", "import_", "get", "\\u", "wsgi", "\\u", "application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ws", "4", "redis_", "._", "uwsgi", "\\u", "runs", "erver_", "import_", "u", "WS", "GI", "Webs", "ocket", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "django", "\\u", "app_", "=_", "get", "\\u", "wsgi", "\\u", "application_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "websocket", "\\u", "app_", "=_", "u", "WS", "GI", "Webs", "ocket", "Server_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
nymanjens/gedit-intelligent-text-completion/gedit3-0--3-7/intelligent_text_completion.py
[ { "content": "# Copyright (C) 2010 - Jens Nyman ([email protected])\n#\n# This program is free software; you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation; either version 2 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n# details.\n\nfrom gi.repository import Gtk, GObject, Gedit, PeasGtk\nimport re\nimport traceback\nimport gconf\n\n\n\n##### regular functions #####\n\n\n\n\n\n################## OPTIONS DIALOG ##################\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class IntelligentTextCompletionPlugin(GObject.Object, Gedit.WindowActivatable, PeasGtk.Configurable):\n window = GObject.property(type=Gedit.Window)\n\n\n\n\n\n\n\n\n\n ############ plugin core functions ############\n\n", "metadata": "root.IntelligentTextCompletionPlugin", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __init__(self):\n GObject.Object.__init__(self)\n self._instances = {}", "metadata": "root.IntelligentTextCompletionPlugin.__init__", "header": "['class', 'IntelligentTextCompletionPlugin', '(', 'GObject', '.', 'Object', ',', 'Gedit', '.', 'WindowActivatable', ',', 'PeasGtk', '.', 'Configurable', ')', ':', '___EOS___']", "index": 20 }, { "content": " def do_create_configure_widget(self):\n return IntelligentTextCompletionOptions.get_instance().create_configure_dialog()", "metadata": "root.IntelligentTextCompletionPlugin.do_create_configure_widget", "header": "['class', 'IntelligentTextCompletionPlugin', '(', 'GObject', '.', 'Object', ',', 'Gedit', '.', 'WindowActivatable', ',', 'PeasGtk', '.', 'Configurable', ')', ':', '___EOS___']", "index": 24 }, { "content": " def _connect_view(self, view, window):\n \"\"\"Connect to view's editing signals.\"\"\"\n callback = self._on_view_key_press_event\n id = view.connect(\"key-press-event\", callback, window)\n view.intelligent_text_completion_id = id", "metadata": "root.IntelligentTextCompletionPlugin._connect_view", "header": "['class', 'IntelligentTextCompletionPlugin', '(', 'GObject', '.', 'Object', ',', 'Gedit', '.', 'WindowActivatable', ',', 'PeasGtk', '.', 'Configurable', ')', ':', '___EOS___']", "index": 27 }, { "content": " def _on_window_tab_added(self, window, tab):\n \"\"\"Connect to signals of the document and view in tab.\"\"\"\n view = tab.get_view()\n handler_id = getattr(view, 'intelligent_text_completion_id', None)\n if handler_id is None:\n self._connect_view(view, window)", "metadata": "root.IntelligentTextCompletionPlugin._on_window_tab_added", "header": "['class', 'IntelligentTextCompletionPlugin', '(', 'GObject', '.', 'Object', ',', 'Gedit', '.', 'WindowActivatable', ',', 'PeasGtk', '.', 'Configurable', ')', ':', '___EOS___']", "index": 33 }, { "content": " def _on_window_tab_removed(self, window, tab):\n pass", "metadata": "root.IntelligentTextCompletionPlugin._on_window_tab_removed", "header": "['class', 'IntelligentTextCompletionPlugin', '(', 'GObject', '.', 'Object', ',', 'Gedit', '.', 'WindowActivatable', ',', 'PeasGtk', '.', 'Configurable', ')', ':', '___EOS___']", "index": 40 }, { "content": " def do_activate(self):\n \"\"\"Activate plugin.\"\"\"\n window = self.window\n callback = self._on_window_tab_added\n id_1 = window.connect(\"tab-added\", callback)\n callback = self._on_window_tab_removed\n id_2 = window.connect(\"tab-removed\", callback)\n window.intelligent_text_completion_id = (id_1, id_2)\n views = window.get_views()\n for view in views:\n self._connect_view(view, window)", "metadata": "root.IntelligentTextCompletionPlugin.do_activate", "header": "['class', 'IntelligentTextCompletionPlugin', '(', 'GObject', '.', 'Object', ',', 'Gedit', '.', 'WindowActivatable', ',', 'PeasGtk', '.', 'Configurable', ')', ':', '___EOS___']", "index": 43 }, { "content": " def do_deactivate(self):\n \"\"\"Deactivate plugin.\"\"\"\n window = self.window\n widgets = [window]\n widgets.extend(window.get_views())\n widgets.extend(window.get_documents())\n for widget in widgets:\n for handler_id in getattr(widget, 'intelligent_text_completion_id', []):\n widget.disconnect(handler_id)\n widget.intelligent_text_completion_id = None", "metadata": "root.IntelligentTextCompletionPlugin.do_deactivate", "header": "['class', 'IntelligentTextCompletionPlugin', '(', 'GObject', '.', 'Object', ',', 'Gedit', '.', 'WindowActivatable', ',', 'PeasGtk', '.', 'Configurable', ')', ':', '___EOS___']", "index": 55 }, { "content": " def _on_view_key_press_event(self, view, event, window):\n doc = window.get_active_document()\n try:\n return self._handle_event(view, event, window)\n except:\n err = \"Exception\\n\"\n err += traceback.format_exc()\n doc.set_text(err)", "metadata": "root.IntelligentTextCompletionPlugin._on_view_key_press_event", "header": "['class', 'IntelligentTextCompletionPlugin', '(', 'GObject', '.', 'Object', ',', 'Gedit', '.', 'WindowActivatable', ',', 'PeasGtk', '.', 'Configurable', ')', ':', '___EOS___']", "index": 66 }, { "content": " def _handle_event(self, view, event, window):\n \"\"\"Key press event\"\"\"\n ### get vars ###\n # constants\n ignore_whitespace = '\\t '\n # get document\n doc = window.get_active_document()\n # get cursor\n cursor = doc.get_iter_at_mark(doc.get_insert())\n # get typed string\n typed_string = unicode(event.string, 'UTF-8')\n # get previous char\n prev_char = None\n if not cursor.get_line_offset() == 0:\n prev_char_pos = cursor.copy()\n prev_char_pos.set_line_offset(cursor.get_line_offset() - 1)\n prev_char = doc.get_text(prev_char_pos, cursor, False)\n # get next char\n next_char = None\n if not cursor.ends_line():\n next_char_pos = cursor.copy()\n next_char_pos.set_line_offset(cursor.get_line_offset() + 1)\n next_char = doc.get_text(cursor, next_char_pos, False)\n # get line before cursor\n line_start = cursor.copy()\n line_start.set_line_offset(0)\n preceding_line = doc.get_text(line_start, cursor, False)\n # get line after cursor\n line_end = cursor.copy()\n if not cursor.ends_line():\n line_end.forward_to_line_end()\n line_after = doc.get_text(cursor, line_end, False)\n # get whitespace in front of line\n whitespace_pos = 0\n whitespace = \"\"\n while len(preceding_line) > whitespace_pos and preceding_line[whitespace_pos] in ignore_whitespace:\n whitespace += preceding_line[whitespace_pos]\n whitespace_pos += 1\n # get options\n options = IntelligentTextCompletionOptions.get_instance()\n\n # Do not complete text after pasting text.\n if len(typed_string) > 1:\n return False\n typed_char = typed_string\n\n # GLOBALS\n open_close = {\n '\"': '\"',\n \"'\": \"'\",\n '(': ')',\n '{': '}',\n '[': ']',\n }\n\n ################### selected text ###################\n bounds = doc.get_selection_bounds()\n if len(bounds) > 0:\n # auto-close brackets and quotes\n if options.closeBracketsAndQuotes:\n for open, close in open_close.items():\n if typed_char == open:\n # get bounds data\n off1 = bounds[0].get_offset()\n off2 = bounds[1].get_offset()\n # add open char\n doc.place_cursor(bounds[0])\n doc.insert_at_cursor(open)\n # refresh cursor and move it\n cursor = doc.get_iter_at_mark(doc.get_insert())\n cursor.set_offset(cursor.get_offset() + (off2 - off1))\n doc.place_cursor(cursor)\n # add close char\n doc.insert_at_cursor(close)\n return True\n return False\n\n ################### auto-close brackets and quotes ###################\n if options.closeBracketsAndQuotes and prev_char != '\\\\':\n \"\"\" detect python comments \"\"\"\n if typed_char == '\"' and re.search('^[^\"]*\"\"$', preceding_line) and cursor.ends_line():\n return self._insert_at_cursor(typed_char + ' ', ' \"\"\"')\n\n for check_char, add_char in open_close.items():\n # if character user is adding is the same as the one that\n # is auto-generated, remove the auto generated char\n if typed_char == add_char:\n if not cursor.ends_line():\n if next_char == add_char:\n if check_char != add_char:\n # don't remove ) when it's probably not auto-generated\n preceding_check_chars = len(re.findall('\\%s' % check_char, preceding_line))\n preceding_add_chars = len(re.findall('\\%s' % add_char, preceding_line))\n following_check_chars = len(re.findall('\\%s' % check_char, line_after))\n following_add_chars = len(re.findall('\\%s' % add_char, line_after))\n if preceding_check_chars - preceding_add_chars > following_add_chars:\n continue\n # don't remove ) when the line becomes complex\n if following_check_chars > 0:\n continue\n doc.delete(cursor, next_char_pos)\n return False\n # typed_char equals char we're looking for\n if typed_char == check_char:\n # check for unlogical adding\n if check_char == add_char:\n # uneven number of check_char's in front\n if len(re.findall(check_char, preceding_line)) % 2 == 1:\n continue\n # uneven number of check_char's in back\n if len(re.findall(check_char, line_after)) % 2 == 1:\n continue\n # don't add add_char if it is used around text\n non_text_left = ' \\t\\n\\r,=+*:;.?!$&@%~<(){}[]-\"\\''\n non_text_right = ' \\t\\n\\r,=+*:;.?&@%~>)}]'\n if not next_char and not check_char == \"'\":\n # if we're just typing with nothing on the right,\n # adding is OK as long as it isn't a \"'\".\n pass\n elif (not prev_char or prev_char in non_text_left) and (not next_char or next_char in non_text_right):\n # this char is surrounded by nothing or non-text, therefore, we can add autotext\n pass\n elif check_char != add_char and (not next_char or next_char in non_text_right):\n # this opening char has non-text on the right, therefore, we can add autotext\n pass\n else:\n continue\n # insert add_char\n return self._insert_at_cursor(typed_char, add_char)\n # check backspace\n if event.keyval == 65288: # backspace\n if prev_char == check_char and next_char == add_char:\n doc.delete(cursor, next_char_pos)\n\n ################### auto-complete XML tags ###################\n if options.completeXML:\n if prev_char == \"<\" and typed_char == \"/\":\n start = doc.get_start_iter()\n preceding_document = doc.get_text(start, cursor, False)\n # analyse previous XML code\n closing_tag = get_closing_xml_tag(preceding_document)\n # insert code\n if closing_tag:\n return self._insert_at_cursor(typed_char + closing_tag + \">\")\n else:\n return False # do nothing\n\n ################### detect lists ###################\n if options.detectLists:\n if event.keyval == 65293: # return\n # constants\n list_bullets = ['* ', '- ', '$ ', '> ', '+ ', '~ ']\n # cycle through all bullets\n for bullet in list_bullets:\n if len(preceding_line) >= whitespace_pos + len(bullet):\n if preceding_line[whitespace_pos:whitespace_pos + len(bullet)] == bullet:\n # endlist function by double enter\n if preceding_line == whitespace + bullet and bullet != '* ':\n start = cursor.copy()\n start.set_line_offset(len(whitespace))\n doc.delete(start, cursor)\n return True\n return self._insert_at_cursor(typed_char + whitespace + bullet)\n\n ################### detect java-like comment ###################\n if event.keyval == 65293: # return\n # constants\n comments = {\n '/**' : (' * ', ' */'),\n '/*' : (' * ', ' */'),\n }\n # cycle through all types of comment\n for comment_start, (comment_middle, comment_end) in comments.items():\n if preceding_line[whitespace_pos:] == comment_start:\n add_middle = typed_char + whitespace + comment_middle\n add_end = typed_char + whitespace + comment_end\n return self._insert_at_cursor(add_middle, add_end)\n\n ################### auto-indent after function/list ###################\n if options.autoindentAfterFunctionOrList:\n if event.keyval == 65293: # return\n indent_triggers = {\n '(': ')',\n '{': '}',\n '[': ']',\n ':': '',\n }\n for indent_trigger, ending_char in indent_triggers.items():\n if prev_char == indent_trigger:\n if line_after:\n # text between begin and ending brackets should come\n # in the middle row\n if ending_char != '' and ending_char in line_after:\n ending_pos = line_after.find(ending_char)\n else:\n ending_pos = len(line_after)\n end = cursor.copy()\n end.set_line_offset(end.get_line_offset() + ending_pos)\n ending_text = doc.get_text(cursor, end, False).strip()\n doc.delete(cursor, end)\n\n add_middle = typed_char + whitespace + get_tab_string(view)\n add_end = ending_text + typed_char + whitespace\n else:\n add_middle = typed_char + whitespace + get_tab_string(view)\n add_end = \"\"\n return self._insert_at_cursor(add_middle, add_end)", "metadata": "root.IntelligentTextCompletionPlugin._handle_event", "header": "['class', 'IntelligentTextCompletionPlugin', '(', 'GObject', '.', 'Object', ',', 'Gedit', '.', 'WindowActivatable', ',', 'PeasGtk', '.', 'Configurable', ')', ':', '___EOS___']", "index": 76 }, { "content": " def _insert_at_cursor(self, middle, end = \"\"):\n window = self.window\n doc = window.get_active_document()\n doc.insert_at_cursor(middle + end)\n # refresh cursor and move it to the middle\n cursor = doc.get_iter_at_mark(doc.get_insert())\n cursor.set_offset(cursor.get_offset() - len(end))\n doc.place_cursor(cursor)\n return True", "metadata": "root.IntelligentTextCompletionPlugin._insert_at_cursor", "header": "['class', 'IntelligentTextCompletionPlugin', '(', 'GObject', '.', 'Object', ',', 'Gedit', '.', 'WindowActivatable', ',', 'PeasGtk', '.', 'Configurable', ')', ':', '___EOS___']", "index": 285 }, { "content": "def get_tab_string(view):\n tab_width = view.get_tab_width()\n tab_spaces = view.get_insert_spaces_instead_of_tabs()\n tab_code = \"\"\n if tab_spaces:\n for x in range(tab_width):\n tab_code += \" \"\n else:\n tab_code = \"\\t\"\n return tab_code", "metadata": "root.get_tab_string", "header": "['module', '___EOS___']", "index": 298 }, { "content": "def get_closing_xml_tag(document):\n tags = re.findall(r'<.*?>', document)\n tags.reverse()\n closed = []\n for tag in tags:\n # ignore special tags like <!-- --> and <!doctype ...>\n if re.match(r'<!.*?>', tag):\n continue\n # ignore special tags like <?, <?=, <?php\n if re.match(r'<\\?.*?>', tag):\n continue\n # neutral tag\n if re.match(r'<.*?/>', tag):\n continue\n # closing tag\n m = re.match(r'</ *([^ ]*).*?>', tag)\n if m:\n closed.append(m.group(1))\n continue\n # opening tag\n m = re.match(r'< *([^/][^ ]*).*?>', tag)\n if m:\n openedtag = m.group(1)\n while True:\n if len(closed) == 0:\n return openedtag\n close_tag = closed.pop()\n if close_tag.lower() == openedtag.lower():\n break\n continue\n return None", "metadata": "root.get_closing_xml_tag", "header": "['module', '___EOS___']", "index": 309 }, { "content": "class IntelligentTextCompletionOptions(object):\n\n ## settings\n closeBracketsAndQuotes = True\n completeXML = True\n detectLists = True\n autoindentAfterFunctionOrList = True\n\n ## buttons for settings\n _closeBracketsAndQuotesButton = None\n _completeXMLButton = None\n _detectListsButton = None\n _autoindentAfterFunctionOrListButton = None\n\n ## configuration client\n _GCONF_SETTINGS_DIR = \"/apps/gedit-3/plugins/intelligent_text_completion\"\n _gconf_client = None\n\n ## static singleton reference\n singleton = None\n\n\n\n\n\n\n", "metadata": "root.IntelligentTextCompletionOptions", "header": "['module', '___EOS___']", "index": 344 }, { "content": " def __init__(self):\n # create gconf directory if not set yet\n self._gconf_client = gconf.client_get_default()\n if not self._gconf_client.dir_exists(self._GCONF_SETTINGS_DIR):\n self._gconf_client.add_dir(self._GCONF_SETTINGS_DIR, gconf.CLIENT_PRELOAD_NONE)\n\n # load settings\n self.closeBracketsAndQuotes = self._load_setting(\"closeBracketsAndQuotes\")\n self.completeXML = self._load_setting(\"completeXML\")\n self.detectLists = self._load_setting(\"detectLists\")\n self.autoindentAfterFunctionOrList = self._load_setting(\"autoindentAfterFunctionOrList\")", "metadata": "root.IntelligentTextCompletionOptions.__init__", "header": "['class', 'IntelligentTextCompletionOptions', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## settings', '___NL___', '___EOS___']", "index": 365 }, { "content": " @classmethod\n def get_instance(cls):\n \"\"\" Get singleton instance \"\"\"\n if cls.singleton is None:\n cls.singleton = cls()\n return cls.singleton", "metadata": "root.IntelligentTextCompletionOptions.get_instance", "header": "['class', 'IntelligentTextCompletionOptions', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## settings', '___NL___', '___EOS___']", "index": 377 }, { "content": " def create_configure_dialog(self):\n \"\"\" Creates configure dialog using GTK \"\"\"\n # make vertically stacking box\n vbox = Gtk.VBox()\n vbox.set_border_width(6)\n\n # add checkboxes\n self._closeBracketsAndQuotesButton = self._add_setting_checkbox(\n vbox=vbox,\n current_value=self.closeBracketsAndQuotes,\n helptext=\"Auto-close brackets and quotes\",\n )\n self._completeXMLButton = self._add_setting_checkbox(\n vbox=vbox,\n current_value=self.completeXML,\n helptext=\"Auto-complete XML tags\",\n )\n self._detectListsButton = self._add_setting_checkbox(\n vbox=vbox,\n current_value=self.detectLists,\n helptext=\"Detect lists\",\n )\n self._autoindentAfterFunctionOrListButton = self._add_setting_checkbox(\n vbox=vbox,\n current_value=self.autoindentAfterFunctionOrList,\n helptext=\"Auto-indent after function or list\",\n )\n return vbox", "metadata": "root.IntelligentTextCompletionOptions.create_configure_dialog", "header": "['class', 'IntelligentTextCompletionOptions', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## settings', '___NL___', '___EOS___']", "index": 384 }, { "content": " def _add_setting_checkbox(self, vbox, current_value, helptext):\n box = Gtk.HBox()\n check_button = Gtk.CheckButton(helptext)\n check_button.set_active(current_value)\n box.pack_start(check_button,False,False,6)\n check_button.connect('toggled', self._on_check_button_toggled)\n vbox.pack_start(box, False, True, 0)\n return check_button", "metadata": "root.IntelligentTextCompletionOptions._add_setting_checkbox", "header": "['class', 'IntelligentTextCompletionOptions', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## settings', '___NL___', '___EOS___']", "index": 413 }, { "content": " def _on_check_button_toggled(self, *args):\n # set class attributes\n self.closeBracketsAndQuotes = self._closeBracketsAndQuotesButton.get_active()\n self.completeXML = self._completeXMLButton.get_active()\n self.detectLists = self._detectListsButton.get_active()\n self.autoindentAfterFunctionOrList = self._autoindentAfterFunctionOrListButton.get_active()\n\n # write changes to gconf\n self._save_setting(\"closeBracketsAndQuotes\", self.closeBracketsAndQuotes)\n self._save_setting(\"completeXML\", self.completeXML)\n self._save_setting(\"detectLists\", self.detectLists)\n self._save_setting(\"autoindentAfterFunctionOrList\", self.autoindentAfterFunctionOrList)", "metadata": "root.IntelligentTextCompletionOptions._on_check_button_toggled", "header": "['class', 'IntelligentTextCompletionOptions', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## settings', '___NL___', '___EOS___']", "index": 422 }, { "content": " def _save_setting(self, setting_name, value):\n self._gconf_client.set_bool(\"{}/{}\".format(self._GCONF_SETTINGS_DIR, setting_name), value)", "metadata": "root.IntelligentTextCompletionOptions._save_setting", "header": "['class', 'IntelligentTextCompletionOptions', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## settings', '___NL___', '___EOS___']", "index": 435 }, { "content": " def _load_setting(self, setting_name):\n try:\n return self._gconf_client.get_bool(\"{}/{}\".format(self._GCONF_SETTINGS_DIR, setting_name))\n except Exception, e: # catch, just in case\n print e", "metadata": "root.IntelligentTextCompletionOptions._load_setting", "header": "['class', 'IntelligentTextCompletionOptions', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '## settings', '___NL___', '___EOS___']", "index": 438 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2010", " ", "-", " ", "Jen", "s", " ", "Ny", "man", " ", "(", "nym", "anj", "ens", ".", "nj", "@", "gma", "il", ".", "com", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "program", " ", "is", " ", "free", " ", "software", ";", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modif", "y", " ", "it", " ", "under", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "as", " ", "publi", "shed", " ", "by", " ", "the", " ", "Free", " ", "Sof", "twa", "re_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Foun", "dati", "on", ";", " ", "eit", "her", " ", "version", " ", "2", " ", "of", " ", "the", " ", "License", ",", " ", "or", " ", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "program", " ", "is", " ", "distributed", " ", "in", " ", "the", " ", "hop", "e", " ", "tha", "t", " ", "it", " ", "will", " ", "be", " ", "usef", "ul", ",", " ", "but", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ANY", " ", "WAR", "RAN", "TY", ";", " ", "with", "out", " ", "even", " ", "the", " ", "impli", "ed", " ", "warr", "ant", "y", " ", "of", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "or", " ", "FIT", "NESS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", "See", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "for", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gi_", "._", "repository_", "import_", "Gtk_", ",_", "GO", "bject_", ",_", "Ge", "dit", "_", ",_", "Pea", "s", "Gtk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gconf", "_", "\\u\\u\\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_", "#####", " ", "regular", " ", "function", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "#", " ", "OPTION", "S", " ", "DIAL", "OG", " ", "###########", "######", "#", "_", "\\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_", "Intel", "lig", "ent", "Text", "Completi", "on", "Plugin_", "(_", "GO", "bject_", "._", "Object_", ",_", "Ge", "dit", "_", "._", "Window", "Activat", "able_", ",_", "Pea", "s", "Gtk_", "._", "Configura", "ble_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window_", "=_", "GO", "bject_", "._", "property_", "(_", "type_", "=_", "Ge", "dit", "_", "._", "Window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "#", " ", "plugin", " ", "core", " ", "function", "s", " ", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Plugin_", "(_", "GO", "bject_", "._", "Object_", ",_", "Ge", "dit", "_", "._", "Window", "Activat", "able_", ",_", "Pea", "s", "Gtk_", "._", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "GO", "bject_", "._", "Object_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instances_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Plugin_", "(_", "GO", "bject_", "._", "Object_", ",_", "Ge", "dit", "_", "._", "Window", "Activat", "able_", ",_", "Pea", "s", "Gtk_", "._", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "create", "\\u", "configur", "e\\u", "widget_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Intel", "lig", "ent", "Text", "Completi", "on", "Options_", "._", "get", "\\u", "instance_", "(_", ")_", "._", "create", "\\u", "configur", "e\\u", "dialog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Plugin_", "(_", "GO", "bject_", "._", "Object_", ",_", "Ge", "dit", "_", "._", "Window", "Activat", "able_", ",_", "Pea", "s", "Gtk_", "._", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "connect", "\\u", "view_", "(_", "self_", ",_", "view_", ",_", "window_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Connect", " ", "to", " ", "view", "'", "s", " ", "editin", "g", " ", "signal", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "=_", "self_", "._", "\\u", "on", "\\u", "view", "\\u", "key", "\\u", "press", "\\u", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "view_", "._", "connect_", "(_", "\"", "key", "-", "press", "-", "event", "\"_", ",_", "callback_", ",_", "window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "._", "intelligen", "t", "\\u", "text", "\\u", "completion", "\\u", "id_", "=_", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Plugin_", "(_", "GO", "bject_", "._", "Object_", ",_", "Ge", "dit", "_", "._", "Window", "Activat", "able_", ",_", "Pea", "s", "Gtk_", "._", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "window", "\\u", "tab", "\\u", "added_", "(_", "self_", ",_", "window_", ",_", "tab_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Connect", " ", "to", " ", "signal", "s", " ", "of", " ", "the", " ", "document", " ", "and", " ", "view", " ", "in", " ", "tab", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "tab_", "._", "get", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler", "\\u", "id_", "=_", "getattr_", "(_", "view_", ",_", "'", "intelligen", "t", "\\u", "text", "\\u", "completion", "\\u", "id", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "handler", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "connect", "\\u", "view_", "(_", "view_", ",_", "window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Plugin_", "(_", "GO", "bject_", "._", "Object_", ",_", "Ge", "dit", "_", "._", "Window", "Activat", "able_", ",_", "Pea", "s", "Gtk_", "._", "Configura", "ble_", ")_", ":_", "\\u\\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", "on", "\\u", "window", "\\u", "tab", "\\u", "removed_", "(_", "self_", ",_", "window_", ",_", "tab_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Plugin_", "(_", "GO", "bject_", "._", "Object_", ",_", "Ge", "dit", "_", "._", "Window", "Activat", "able_", ",_", "Pea", "s", "Gtk_", "._", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "activate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Activat", "e", " ", "plugin", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "window_", "=_", "self_", "._", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "=_", "self_", "._", "\\u", "on", "\\u", "window", "\\u", "tab", "\\u", "added_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "\\u", "1_", "=_", "window_", "._", "connect_", "(_", "\"", "tab", "-", "adde", "d", "\"_", ",_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "=_", "self_", "._", "\\u", "on", "\\u", "window", "\\u", "tab", "\\u", "removed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "\\u", "2_", "=_", "window_", "._", "connect_", "(_", "\"", "tab", "-", "remove", "d", "\"_", ",_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "window_", "._", "intelligen", "t", "\\u", "text", "\\u", "completion", "\\u", "id_", "=_", "(_", "id", "\\u", "1_", ",_", "id", "\\u", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "views_", "=_", "window_", "._", "get", "\\u", "views_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "view_", "in_", "views_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "connect", "\\u", "view_", "(_", "view_", ",_", "window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Plugin_", "(_", "GO", "bject_", "._", "Object_", ",_", "Ge", "dit", "_", "._", "Window", "Activat", "able_", ",_", "Pea", "s", "Gtk_", "._", "Configura", "ble_", ")_", ":_", "\\u\\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", "deactivate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Dea", "ctivat", "e", " ", "plugin", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "window_", "=_", "self_", "._", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "=_", "[_", "window_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "._", "extend_", "(_", "window_", "._", "get", "\\u", "views_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widgets_", "._", "extend_", "(_", "window_", "._", "get", "\\u", "documents_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "widget_", "in_", "widgets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "handler", "\\u", "id_", "in_", "getattr_", "(_", "widget_", ",_", "'", "intelligen", "t", "\\u", "text", "\\u", "completion", "\\u", "id", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "widget_", "._", "disconnect_", "(_", "handler", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "widget_", "._", "intelligen", "t", "\\u", "text", "\\u", "completion", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Plugin_", "(_", "GO", "bject_", "._", "Object_", ",_", "Ge", "dit", "_", "._", "Window", "Activat", "able_", ",_", "Pea", "s", "Gtk_", "._", "Configura", "ble_", ")_", ":_", "\\u\\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", "on", "\\u", "view", "\\u", "key", "\\u", "press", "\\u", "event_", "(_", "self_", ",_", "view_", ",_", "event_", ",_", "window_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "window_", "._", "get", "\\u", "active", "\\u", "document_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "handle", "\\u", "event_", "(_", "view_", ",_", "event_", ",_", "window_", ")_", "\\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 ", " _", "err_", "=_", "\"", "Except", "ion", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "+=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "._", "set\\u", "text_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Plugin_", "(_", "GO", "bject_", "._", "Object_", ",_", "Ge", "dit", "_", "._", "Window", "Activat", "able_", ",_", "Pea", "s", "Gtk_", "._", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handle", "\\u", "event_", "(_", "self_", ",_", "view_", ",_", "event_", ",_", "window_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Key", " ", "press", " ", "event", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " ", "get", " ", "vars", " ", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "constants_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "whitespace_", "=_", "'\\\\", "t", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "document_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "window_", "._", "get", "\\u", "active", "\\u", "document_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "cursor_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "=_", "doc_", "._", "get", "\\u", "iter", "\\u", "at", "\\u", "mark_", "(_", "doc_", "._", "get", "\\u", "insert_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "typed", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "typed", "\\u", "string_", "=_", "unicode_", "(_", "event_", "._", "string_", ",_", "'", "UT", "F", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "previ", "ous", " ", "char_", "\\u\\u\\uNL\\u\\u\\u_", "prev", "\\u", "char_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "cursor_", "._", "get", "\\u", "line", "\\u", "offset_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "\\u", "char", "\\u", "pos_", "=_", "cursor_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "\\u", "char", "\\u", "pos_", "._", "set\\u", "line", "\\u", "offset_", "(_", "cursor_", "._", "get", "\\u", "line", "\\u", "offset_", "(_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "\\u", "char_", "=_", "doc_", "._", "get", "\\u", "text_", "(_", "prev", "\\u", "char", "\\u", "pos_", ",_", "cursor_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "next", " ", "char_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "next", "\\u", "char_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "cursor_", "._", "ends", "\\u", "line_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "char", "\\u", "pos_", "=_", "cursor_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "char", "\\u", "pos_", "._", "set\\u", "line", "\\u", "offset_", "(_", "cursor_", "._", "get", "\\u", "line", "\\u", "offset_", "(_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "char_", "=_", "doc_", "._", "get", "\\u", "text_", "(_", "cursor_", ",_", "next", "\\u", "char", "\\u", "pos_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "line", " ", "bef", "ore", " ", "cursor_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line", "\\u", "start_", "=_", "cursor_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "\\u", "start_", "._", "set\\u", "line", "\\u", "offset_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "preceding", "\\u", "line_", "=_", "doc_", "._", "get", "\\u", "text_", "(_", "line", "\\u", "start_", ",_", "cursor_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "line", " ", "after", " ", "cursor_", "\\u\\u\\uNL\\u\\u\\u_", "line", "\\u", "end_", "=_", "cursor_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "cursor_", "._", "ends", "\\u", "line_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "\\u", "end_", "._", "forward", "\\u", "to", "\\u", "line", "\\u", "end_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line", "\\u", "after_", "=_", "doc_", "._", "get", "\\u", "text_", "(_", "cursor_", ",_", "line", "\\u", "end_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "whitespace", " ", "in", " ", "front", " ", "of", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "whitespace", "\\u", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "whitespace_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "preceding", "\\u", "line_", ")_", ">_", "whitespace", "\\u", "pos_", "and_", "preceding", "\\u", "line_", "[_", "whitespace", "\\u", "pos_", "]_", "in_", "ignore", "\\u", "whitespace_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "whitespace_", "+=_", "preceding", "\\u", "line_", "[_", "whitespace", "\\u", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "whitespace", "\\u", "pos_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "options_", "=_", "Intel", "lig", "ent", "Text", "Completi", "on", "Options_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "not", " ", "complete", " ", "text", " ", "after", " ", "past", "ing", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "typed", "\\u", "string_", ")_", ">_", "1_", ":_", "\\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_", "typed", "\\u", "char_", "=_", "typed", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GLOB", "ALS", "_", "\\u\\u\\uNL\\u\\u\\u_", "open", "\\u", "close_", "=_", "{_", "\\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\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", " ", "selecte", "d", " ", "text", " ", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "bounds_", "=_", "doc_", "._", "get", "\\u", "selection", "\\u", "bounds_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "bounds_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "auto", "-", "close", " ", "brackets", " ", "and", " ", "quotes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "options_", "._", "close", "Bracket", "s", "And", "Quote", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "open_", ",_", "close_", "in_", "open", "\\u", "close_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "typed", "\\u", "char_", "==_", "open_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "bound", "s", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "off", "1_", "=_", "bounds_", "[_", "0_", "]_", "._", "get", "\\u", "offset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "off", "2_", "=_", "bounds_", "[_", "1_", "]_", "._", "get", "\\u", "offset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "open", " ", "char_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "._", "place", "\\u", "cursor_", "(_", "bounds_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "._", "insert", "\\u", "at", "\\u", "cursor_", "(_", "open_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refre", "sh", " ", "cursor", " ", "and", " ", "move", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "=_", "doc_", "._", "get", "\\u", "iter", "\\u", "at", "\\u", "mark_", "(_", "doc_", "._", "get", "\\u", "insert_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "set\\u", "offset_", "(_", "cursor_", "._", "get", "\\u", "offset_", "(_", ")_", "+_", "(_", "off", "2_", "-_", "off", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "._", "place", "\\u", "cursor_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "close", " ", "char_", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "._", "insert", "\\u", "at", "\\u", "cursor_", "(_", "close_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", " ", "auto", "-", "close", " ", "brackets", " ", "and", " ", "quote", "s", " ", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "close", "Bracket", "s", "And", "Quote", "s_", "and_", "prev", "\\u", "char_", "!=_", "'\\\\\\\\'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "detect", " ", "python", " ", "comment", "s", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typed", "\\u", "char_", "==_", "'\"'_", "and_", "re_", "._", "search_", "(_", "'", "^", "[", "^", "\"]", "*\"", "\"$", "'_", ",_", "preceding", "\\u", "line_", ")_", "and_", "cursor_", "._", "ends", "\\u", "line_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "insert", "\\u", "at", "\\u", "cursor_", "(_", "typed", "\\u", "char_", "+_", "'", " ", "'_", ",_", "'", " ", "\"\"\"'", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "check", "\\u", "char_", ",_", "add", "\\u", "char_", "in_", "open", "\\u", "close_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "character", " ", "user", " ", "is", " ", "addin", "g", " ", "is", " ", "the", " ", "same", " ", "as", " ", "the", " ", "one", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "auto", "-", "generat", "ed", ",", " ", "remove", " ", "the", " ", "auto", " ", "generat", "ed", " ", "char_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "typed", "\\u", "char_", "==_", "add", "\\u", "char_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "cursor_", "._", "ends", "\\u", "line_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "next", "\\u", "char_", "==_", "add", "\\u", "char_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "check", "\\u", "char_", "!=_", "add", "\\u", "char_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "remove", " ", ")", " ", "whe", "n", " ", "it", "'", "s", " ", "probab", "ly", " ", "not", " ", "auto", "-", "generated_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "preceding", "\\u", "check", "\\u", "chars_", "=_", "len_", "(_", "re_", "._", "findall_", "(_", "'\\\\", "%", "s", "'_", "%_", "check", "\\u", "char_", ",_", "preceding", "\\u", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "preceding", "\\u", "add", "\\u", "chars_", "=_", "len_", "(_", "re_", "._", "findall_", "(_", "'\\\\", "%", "s", "'_", "%_", "add", "\\u", "char_", ",_", "preceding", "\\u", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "follow", "ing", "\\u", "check", "\\u", "chars_", "=_", "len_", "(_", "re_", "._", "findall_", "(_", "'\\\\", "%", "s", "'_", "%_", "check", "\\u", "char_", ",_", "line", "\\u", "after_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "follow", "ing", "\\u", "add", "\\u", "chars_", "=_", "len_", "(_", "re_", "._", "findall_", "(_", "'\\\\", "%", "s", "'_", "%_", "add", "\\u", "char_", ",_", "line", "\\u", "after_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "preceding", "\\u", "check", "\\u", "chars_", "-_", "preceding", "\\u", "add", "\\u", "chars_", ">_", "follow", "ing", "\\u", "add", "\\u", "chars_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "remove", " ", ")", " ", "whe", "n", " ", "the", " ", "line", " ", "bec", "ome", "s", " ", "complex_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "follow", "ing", "\\u", "check", "\\u", "chars_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "doc_", "._", "delete_", "(_", "cursor_", ",_", "next", "\\u", "char", "\\u", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "typed", "\\u", "char", " ", "equals", " ", "char", " ", "we", "'", "re", " ", "look", "ing", " ", "for_", "\\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_", "typed", "\\u", "char_", "==_", "check", "\\u", "char_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "unl", "ogi", "cal", " ", "addin", "g_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "check", "\\u", "char_", "==_", "add", "\\u", "char_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "une", "ven", " ", "number", " ", "of", " ", "check", "\\u", "char", "'", "s", " ", "in", " ", "front_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "len_", "(_", "re_", "._", "findall_", "(_", "check", "\\u", "char_", ",_", "preceding", "\\u", "line_", ")_", ")_", "%_", "2_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "une", "ven", " ", "number", " ", "of", " ", "check", "\\u", "char", "'", "s", " ", "in", " ", "back_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "re_", "._", "findall_", "(_", "check", "\\u", "char_", ",_", "line", "\\u", "after_", ")_", ")_", "%_", "2_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "add", " ", "add", "\\u", "char", " ", "if", " ", "it", " ", "is", " ", "used", " ", "aro", "und", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "non", "\\u", "text", "\\u", "left_", "=_", "'", " ", "\\\\", "t", "\\\\", "n", "\\\\", "r", ",", "=+", "*:", ";", ".", "?!", "$", "&", "@", "%", "~", "<", "()", "{}", "[]", "-\"", "\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "non", "\\u", "text", "\\u", "right_", "=_", "'", " ", "\\\\", "t", "\\\\", "n", "\\\\", "r", ",", "=+", "*:", ";", ".", "?", "&", "@", "%", "~", ">)", "}]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "next", "\\u", "char_", "and_", "not_", "check", "\\u", "char_", "==_", "\"'\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "we", "'", "re", " ", "just", " ", "typ", "ing", " ", "with", " ", "not", "hing", " ", "on", " ", "the", " ", "right", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addin", "g", " ", "is", " ", "OK", " ", "as", " ", "long", " ", "as", " ", "it", " ", "isn", "'", "t", " ", "a", " ", "\"'", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "not_", "prev", "\\u", "char_", "or_", "prev", "\\u", "char_", "in_", "non", "\\u", "text", "\\u", "left_", ")_", "and_", "(_", "not_", "next", "\\u", "char_", "or_", "next", "\\u", "char_", "in_", "non", "\\u", "text", "\\u", "right_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "char", " ", "is", " ", "surround", "ed", " ", "by", " ", "not", "hing", " ", "or", " ", "non", "-", "text", ",", " ", "there", "fore", ",", " ", "we", " ", "can", " ", "add", " ", "autot", "ext_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "check", "\\u", "char_", "!=_", "add", "\\u", "char_", "and_", "(_", "not_", "next", "\\u", "char_", "or_", "next", "\\u", "char_", "in_", "non", "\\u", "text", "\\u", "right_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "opening", " ", "char", " ", "has", " ", "non", "-", "text", " ", "on", " ", "the", " ", "right", ",", " ", "there", "fore", ",", " ", "we", " ", "can", " ", "add", " ", "autot", "ext_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "insert", " ", "add", "\\u", "char_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "insert", "\\u", "at", "\\u", "cursor_", "(_", "typed", "\\u", "char_", ",_", "add", "\\u", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "backs", "pace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event_", "._", "keyval_", "==_", "652", "88_", ":_", "#", " ", "backs", "pace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "prev", "\\u", "char_", "==_", "check", "\\u", "char_", "and_", "next", "\\u", "char_", "==_", "add", "\\u", "char_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "doc_", "._", "delete_", "(_", "cursor_", ",_", "next", "\\u", "char", "\\u", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", " ", "auto", "-", "complete", " ", "XML", " ", "tags", " ", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "options_", "._", "complete", "XML_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "prev", "\\u", "char_", "==_", "\"<\"_", "and_", "typed", "\\u", "char_", "==_", "\"/\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "doc_", "._", "get", "\\u", "start", "\\u", "iter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "preceding", "\\u", "document_", "=_", "doc_", "._", "get", "\\u", "text_", "(_", "start_", ",_", "cursor_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "analyse", " ", "previ", "ous", " ", "XML", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "clos", "ing", "\\u", "tag_", "=_", "get", "\\u", "clos", "ing", "\\u", "xml", "\\u", "tag_", "(_", "preceding", "\\u", "document_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "insert", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "clos", "ing", "\\u", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "\\u", "insert", "\\u", "at", "\\u", "cursor_", "(_", "typed", "\\u", "char_", "+_", "clos", "ing", "\\u", "tag_", "+_", "\">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "False_", "#", " ", "do", " ", "nothing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", " ", "detect", " ", "lists", " ", "###########", "######", "##", "_", "\\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_", "._", "detect", "Lists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event_", "._", "keyval_", "==_", "652", "93_", ":_", "#", " ", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "constants_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "bullet", "s_", "=_", "[_", "'*", " ", "'_", ",_", "'-", " ", "'_", ",_", "'$", " ", "'_", ",_", "'>", " ", "'_", ",_", "'+", " ", "'_", ",_", "'", "~", " ", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cycle", " ", "through", " ", "all", " ", "bullet", "s_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "bullet_", "in_", "list", "\\u", "bullet", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "len_", "(_", "preceding", "\\u", "line_", ")_", ">=_", "whitespace", "\\u", "pos_", "+_", "len_", "(_", "bullet_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "preceding", "\\u", "line_", "[_", "whitespace", "\\u", "pos_", ":_", "whitespace", "\\u", "pos_", "+_", "len_", "(_", "bullet_", ")_", "]_", "==_", "bullet_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "endl", "ist", " ", "function", " ", "by", " ", "double", " ", "enter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "preceding", "\\u", "line_", "==_", "whitespace_", "+_", "bullet_", "and_", "bullet_", "!=_", "'*", " ", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "start_", "=_", "cursor_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "._", "set\\u", "line", "\\u", "offset_", "(_", "len_", "(_", "whitespace_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "._", "delete_", "(_", "start_", ",_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "insert", "\\u", "at", "\\u", "cursor_", "(_", "typed", "\\u", "char_", "+_", "whitespace_", "+_", "bullet_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", " ", "detect", " ", "java", "-", "like", " ", "comment", " ", "###########", "######", "##", "_", "\\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_", "event_", "._", "keyval_", "==_", "652", "93_", ":_", "#", " ", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "constants_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comments_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'/*", "*'_", ":_", "(_", "'", " ", "*", " ", "'_", ",_", "'", " ", "*/", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/*", "'_", ":_", "(_", "'", " ", "*", " ", "'_", ",_", "'", " ", "*/", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cycle", " ", "through", " ", "all", " ", "types", " ", "of", " ", "comment_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "comment", "\\u", "start_", ",_", "(_", "comment", "\\u", "middle_", ",_", "comment", "\\u", "end_", ")_", "in_", "comments_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "preceding", "\\u", "line_", "[_", "whitespace", "\\u", "pos_", ":_", "]_", "==_", "comment", "\\u", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "add", "\\u", "middle_", "=_", "typed", "\\u", "char_", "+_", "whitespace_", "+_", "comment", "\\u", "middle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "end_", "=_", "typed", "\\u", "char_", "+_", "whitespace_", "+_", "comment", "\\u", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "insert", "\\u", "at", "\\u", "cursor_", "(_", "add", "\\u", "middle_", ",_", "add", "\\u", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", " ", "auto", "-", "indent", " ", "after", " ", "function", "/", "list", " ", "###########", "######", "##", "_", "\\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_", "._", "autoi", "nden", "t", "Af", "ter", "Function", "Or", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event_", "._", "keyval_", "==_", "652", "93_", ":_", "#", " ", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "indent", "\\u", "triggers_", "=_", "{_", "\\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_", "for_", "indent", "\\u", "trigger_", ",_", "ending", "\\u", "char_", "in_", "indent", "\\u", "triggers_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "prev", "\\u", "char_", "==_", "indent", "\\u", "trigger_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "line", "\\u", "after_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "text", " ", "bet", "ween", " ", "begin", " ", "and", " ", "ending", " ", "brackets", " ", "shou", "ld", " ", "come", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "middle", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "ending", "\\u", "char_", "!=_", "''_", "and_", "ending", "\\u", "char_", "in_", "line", "\\u", "after_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "ending", "\\u", "pos_", "=_", "line", "\\u", "after_", "._", "find_", "(_", "ending", "\\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 ", " ", " _", "ending", "\\u", "pos_", "=_", "len_", "(_", "line", "\\u", "after_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end_", "=_", "cursor_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "._", "set\\u", "line", "\\u", "offset_", "(_", "end_", "._", "get", "\\u", "line", "\\u", "offset_", "(_", ")_", "+_", "ending", "\\u", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ending", "\\u", "text_", "=_", "doc_", "._", "get", "\\u", "text_", "(_", "cursor_", ",_", "end_", ",_", "False_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "._", "delete_", "(_", "cursor_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "add", "\\u", "middle_", "=_", "typed", "\\u", "char_", "+_", "whitespace_", "+_", "get", "\\u", "tab", "\\u", "string_", "(_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "end_", "=_", "ending", "\\u", "text_", "+_", "typed", "\\u", "char_", "+_", "whitespace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "add", "\\u", "middle_", "=_", "typed", "\\u", "char_", "+_", "whitespace_", "+_", "get", "\\u", "tab", "\\u", "string_", "(_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "end_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "insert", "\\u", "at", "\\u", "cursor_", "(_", "add", "\\u", "middle_", ",_", "add", "\\u", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Plugin_", "(_", "GO", "bject_", "._", "Object_", ",_", "Ge", "dit", "_", "._", "Window", "Activat", "able_", ",_", "Pea", "s", "Gtk_", "._", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "insert", "\\u", "at", "\\u", "cursor_", "(_", "self_", ",_", "middle_", ",_", "end_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window_", "=_", "self_", "._", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "window_", "._", "get", "\\u", "active", "\\u", "document_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "._", "insert", "\\u", "at", "\\u", "cursor_", "(_", "middle_", "+_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "refre", "sh", " ", "cursor", " ", "and", " ", "move", " ", "it", " ", "to", " ", "the", " ", "middle_", "\\u\\u\\uNL\\u\\u\\u_", "cursor_", "=_", "doc_", "._", "get", "\\u", "iter", "\\u", "at", "\\u", "mark_", "(_", "doc_", "._", "get", "\\u", "insert_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "set\\u", "offset_", "(_", "cursor_", "._", "get", "\\u", "offset_", "(_", ")_", "-_", "len_", "(_", "end_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "._", "place", "\\u", "cursor_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "tab", "\\u", "string_", "(_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tab", "\\u", "width_", "=_", "view_", "._", "get", "\\u", "tab", "\\u", "width_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab", "\\u", "spaces_", "=_", "view_", "._", "get", "\\u", "insert", "\\u", "space", "s", "\\u", "inst", "ead", "\\u", "of", "\\u", "tabs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab", "\\u", "code_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tab", "\\u", "spaces_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "range_", "(_", "tab", "\\u", "width_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tab", "\\u", "code_", "+=_", "\"", " ", "\"_", "\\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 ", " _", "tab", "\\u", "code_", "=_", "\"\\\\", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tab", "\\u", "code_", "\\u\\u\\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", "clos", "ing", "\\u", "xml", "\\u", "tag_", "(_", "document_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tags_", "=_", "re_", "._", "findall_", "(_", "r", "'<", ".*?", ">'_", ",_", "document_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "closed_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tag_", "in_", "tags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ignore", " ", "special", " ", "tags", " ", "like", " ", "<!", "--", " ", "-->", " ", "and", " ", "<!", "doct", "ype", " ", "...", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "match_", "(_", "r", "'<!", ".*?", ">'_", ",_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ignore", " ", "special", " ", "tags", " ", "like", " ", "<", "?", ",", " ", "<", "?=", ",", " ", "<", "?", "php", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "r", "'<", "\\\\?", ".*?", ">'_", ",_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "neutral", " ", "tag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "r", "'<", ".*?", "/>'_", ",_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "clos", "ing", " ", "tag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "re_", "._", "match_", "(_", "r", "'<", "/", " ", "*([", "^", " ", "]*)", ".*?", ">'_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "closed_", "._", "append_", "(_", "m_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "opening", " ", "tag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "re_", "._", "match_", "(_", "r", "'<", " ", "*([", "^", "/]", "[", "^", " ", "]*)", ".*?", ">'_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opene", "dta", "g_", "=_", "m_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "closed_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "opene", "dta", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "close", "\\u", "tag_", "=_", "closed_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "close", "\\u", "tag_", "._", "lower_", "(_", ")_", "==_", "opene", "dta", "g_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Options_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "close", "Bracket", "s", "And", "Quote", "s_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete", "XML_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "detect", "Lists_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "autoi", "nden", "t", "Af", "ter", "Function", "Or", "List_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "buttons", " ", "for", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "close", "Bracket", "s", "And", "Quote", "s", "Button_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "complete", "XML", "Button_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "detect", "List", "s", "Button_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "autoi", "nden", "t", "Af", "ter", "Function", "Or", "List", "Button_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "configura", "tion", " ", "client_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "GC", "ONF", "\\u", "SETTING", "S", "\\u", "DIR_", "=_", "\"/", "apps", "/", "ged", "it", "-", "3", "/", "plugin", "s", "/", "intelligen", "t", "\\u", "text", "\\u", "completion", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "gconf", "\\u", "client_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "static", " ", "singleton", " ", "reference_", "\\u\\u\\uNL\\u\\u\\u_", "singleton_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Options_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "#", " ", "create", " ", "gconf", " ", "director", "y", " ", "if", " ", "not", " ", "set", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "gconf", "\\u", "client_", "=_", "gconf", "_", "._", "client", "\\u", "get", "\\u", "default_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "gconf", "\\u", "client_", "._", "dir\\u", "exists_", "(_", "self_", "._", "\\u", "GC", "ONF", "\\u", "SETTING", "S", "\\u", "DIR_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "gconf", "\\u", "client_", "._", "add", "\\u", "dir_", "(_", "self_", "._", "\\u", "GC", "ONF", "\\u", "SETTING", "S", "\\u", "DIR_", ",_", "gconf", "_", "._", "CLIENT", "\\u", "PRE", "LOAD", "\\u", "NONE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "close", "Bracket", "s", "And", "Quote", "s_", "=_", "self_", "._", "\\u", "load", "\\u", "setting_", "(_", "\"", "close", "Bracket", "s", "And", "Quote", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "complete", "XML_", "=_", "self_", "._", "\\u", "load", "\\u", "setting_", "(_", "\"", "complete", "XML", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "detect", "Lists_", "=_", "self_", "._", "\\u", "load", "\\u", "setting_", "(_", "\"", "detect", "List", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "autoi", "nden", "t", "Af", "ter", "Function", "Or", "List_", "=_", "self_", "._", "\\u", "load", "\\u", "setting_", "(_", "\"", "autoi", "nden", "t", "Af", "ter", "Function", "Or", "List", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Options_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "instance_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Get", " ", "singleton", " ", "instance", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cls_", "._", "singleton_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "singleton_", "=_", "cls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "._", "singleton_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Options_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "settings_", "\\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_", "create", "\\u", "configur", "e\\u", "dialog_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "es", " ", "configur", "e", " ", "dialog", " ", "usi", "ng", " ", "GTK", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "make", " ", "vertical", "ly", " ", "stack", "ing", " ", "box_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "=_", "Gtk_", "._", "VB", "ox_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "set\\u", "border", "\\u", "width_", "(_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "checkb", "oxe", "s_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "close", "Bracket", "s", "And", "Quote", "s", "Button_", "=_", "self_", "._", "\\u", "add", "\\u", "setti", "ng", "\\u", "checkbox_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "=_", "vbox_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "value_", "=_", "self_", "._", "close", "Bracket", "s", "And", "Quote", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "text_", "=_", "\"", "Auto", "-", "close", " ", "brackets", " ", "and", " ", "quote", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "complete", "XML", "Button_", "=_", "self_", "._", "\\u", "add", "\\u", "setti", "ng", "\\u", "checkbox_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "=_", "vbox_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "value_", "=_", "self_", "._", "complete", "XML_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "text_", "=_", "\"", "Auto", "-", "complete", " ", "XML", " ", "tags", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "detect", "List", "s", "Button_", "=_", "self_", "._", "\\u", "add", "\\u", "setti", "ng", "\\u", "checkbox_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "=_", "vbox_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "value_", "=_", "self_", "._", "detect", "Lists_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "text_", "=_", "\"", "Detect", " ", "lists", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "autoi", "nden", "t", "Af", "ter", "Function", "Or", "List", "Button_", "=_", "self_", "._", "\\u", "add", "\\u", "setti", "ng", "\\u", "checkbox_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "=_", "vbox_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "value_", "=_", "self_", "._", "autoi", "nden", "t", "Af", "ter", "Function", "Or", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "text_", "=_", "\"", "Auto", "-", "indent", " ", "after", " ", "function", " ", "or", " ", "list", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "vbox_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Options_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "settings_", "\\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", "add", "\\u", "setti", "ng", "\\u", "checkbox_", "(_", "self_", ",_", "vbox_", ",_", "current", "\\u", "value_", ",_", "help", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "box_", "=_", "Gtk_", "._", "HB", "ox_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "button_", "=_", "Gtk_", "._", "Check", "Button_", "(_", "help", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "button_", "._", "set\\u", "active_", "(_", "current", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "box_", "._", "pack", "\\u", "start_", "(_", "check", "\\u", "button_", ",_", "False_", ",_", "False_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check", "\\u", "button_", "._", "connect_", "(_", "'", "toggle", "d", "'_", ",_", "self_", "._", "\\u", "on", "\\u", "check", "\\u", "button", "\\u", "toggled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "pack", "\\u", "start_", "(_", "box_", ",_", "False_", ",_", "True_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "check", "\\u", "button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Options_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "settings_", "\\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", "on", "\\u", "check", "\\u", "button", "\\u", "toggled_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "class", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close", "Bracket", "s", "And", "Quote", "s_", "=_", "self_", "._", "\\u", "close", "Bracket", "s", "And", "Quote", "s", "Button_", "._", "get", "\\u", "active_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "complete", "XML_", "=_", "self_", "._", "\\u", "complete", "XML", "Button_", "._", "get", "\\u", "active_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "detect", "Lists_", "=_", "self_", "._", "\\u", "detect", "List", "s", "Button_", "._", "get", "\\u", "active_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "autoi", "nden", "t", "Af", "ter", "Function", "Or", "List_", "=_", "self_", "._", "\\u", "autoi", "nden", "t", "Af", "ter", "Function", "Or", "List", "Button_", "._", "get", "\\u", "active_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "change", "s", " ", "to", " ", "gconf", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "save", "\\u", "setting_", "(_", "\"", "close", "Bracket", "s", "And", "Quote", "s", "\"_", ",_", "self_", "._", "close", "Bracket", "s", "And", "Quote", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "save", "\\u", "setting_", "(_", "\"", "complete", "XML", "\"_", ",_", "self_", "._", "complete", "XML_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "save", "\\u", "setting_", "(_", "\"", "detect", "List", "s", "\"_", ",_", "self_", "._", "detect", "Lists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "save", "\\u", "setting_", "(_", "\"", "autoi", "nden", "t", "Af", "ter", "Function", "Or", "List", "\"_", ",_", "self_", "._", "autoi", "nden", "t", "Af", "ter", "Function", "Or", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Options_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "settings_", "\\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", "save", "\\u", "setting_", "(_", "self_", ",_", "setti", "ng", "\\u", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "gconf", "\\u", "client_", "._", "set\\u", "bool_", "(_", "\"{}", "/{}\"_", "._", "format_", "(_", "self_", "._", "\\u", "GC", "ONF", "\\u", "SETTING", "S", "\\u", "DIR_", ",_", "setti", "ng", "\\u", "name_", ")_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Intel", "lig", "ent", "Text", "Completi", "on", "Options_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "settings_", "\\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", "load", "\\u", "setting_", "(_", "self_", ",_", "setti", "ng", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "gconf", "\\u", "client_", "._", "get", "\\u", "bool_", "(_", "\"{}", "/{}\"_", "._", "format_", "(_", "self_", "._", "\\u", "GC", "ONF", "\\u", "SETTING", "S", "\\u", "DIR_", ",_", "setti", "ng", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "#", " ", "catch", ",", " ", "just", " ", "in", " ", "case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "e_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
Stiivi/bubbles/tests/test_graph.py
[ { "content": " def test_basic(self):\n g = Graph()\n g.add(Node(\"src\"), \"n1\")\n g.add(Node(\"distinct\"),\"n2\")\n g.add(Node(\"pretty_print\"), \"n3\")\n\n self.assertEqual(3, len(g.nodes))\n\n g.connect(\"n1\", \"n2\")\n\n sources = g.sources(\"n2\")\n self.assertEqual(1, len(sources))\n self.assertTrue(isinstance(sources[\"default\"], Node))\n self.assertEqual(\"src\", sources[\"default\"].opname)", "metadata": "root.GraphTestCase.test_basic", "header": "['class', 'GraphTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 4 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Graph", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "basic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "Graph_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "add_", "(_", "Node_", "(_", "\"", "src", "\"_", ")_", ",_", "\"", "n1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "add_", "(_", "Node_", "(_", "\"", "distinct", "\"_", ")_", ",_", "\"", "n2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "add_", "(_", "Node_", "(_", "\"", "pretty", "\\u", "print", "\"_", ")_", ",_", "\"", "n", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "g_", "._", "nodes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g_", "._", "connect_", "(_", "\"", "n1", "\"_", ",_", "\"", "n2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sources_", "=_", "g_", "._", "sources_", "(_", "\"", "n2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "len_", "(_", "sources_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "sources_", "[_", "\"", "default", "\"_", "]_", ",_", "Node_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "src", "\"_", ",_", "sources_", "[_", "\"", "default", "\"_", "]_", "._", "opname", "_", ")_", "\\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 ]
Use of the return value of a procedure
frappe/frappe/frappe/utils/oauth.py
[ { "content": "def get_oauth2_providers():\n\treturn {\n\t\t\"google\": {\n\t\t\t\"flow_params\": {\n\t\t\t\t\"name\": \"google\",\n\t\t\t\t\"authorize_url\": \"https://accounts.google.com/o/oauth2/auth\",\n\t\t\t\t\"access_token_url\": \"https://accounts.google.com/o/oauth2/token\",\n\t\t\t\t\"base_url\": \"https://www.googleapis.com\",\n\t\t\t},\n\n\t\t\t\"redirect_uri\": \"/api/method/frappe.templates.pages.login.login_via_google\",\n\n\t\t\t\"auth_url_data\": {\n\t\t\t\t\"scope\": \"https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email\",\n\t\t\t\t\"response_type\": \"code\"\n\t\t\t},\n\n\t\t\t# relative to base_url\n\t\t\t\"api_endpoint\": \"oauth2/v2/userinfo\"\n\t\t},\n\n\t\t\"github\": {\n\t\t\t\"flow_params\": {\n\t\t\t\t\"name\": \"github\",\n\t\t\t\t\"authorize_url\": \"https://github.com/login/oauth/authorize\",\n\t\t\t\t\"access_token_url\": \"https://github.com/login/oauth/access_token\",\n\t\t\t\t\"base_url\": \"https://api.github.com/\"\n\t\t\t},\n\n\t\t\t\"redirect_uri\": \"/api/method/frappe.templates.pages.login.login_via_github\",\n\n\t\t\t# relative to base_url\n\t\t\t\"api_endpoint\": \"user\"\n\t\t},\n\n\t\t\"facebook\": {\n\t\t\t\"flow_params\": {\n\t\t\t\t\"name\": \"facebook\",\n\t\t\t\t\"authorize_url\": \"https://www.facebook.com/dialog/oauth\",\n\t\t\t\t\"access_token_url\": \"https://graph.facebook.com/oauth/access_token\",\n\t\t\t\t\"base_url\": \"https://graph.facebook.com\"\n\t\t\t},\n\n\t\t\t\"redirect_uri\": \"/api/method/frappe.templates.pages.login.login_via_facebook\",\n\n\t\t\t\"auth_url_data\": {\n\t\t\t\t\"display\": \"page\",\n\t\t\t\t\"response_type\": \"code\",\n\t\t\t\t\"scope\": \"email,public_profile\"\n\t\t\t},\n\n\t\t\t# relative to base_url\n\t\t\t\"api_endpoint\": \"/v2.5/me\",\n\t\t\t\"api_endpoint_args\": {\n\t\t\t\t\"fields\": \"first_name,last_name,email,gender,location,verified,picture\"\n\t\t\t}\n\t\t}\n\t}", "metadata": "root.get_oauth2_providers", "header": "['module', '___EOS___']", "index": 11 }, { "content": "def get_oauth2_authorize_url(provider):\n\tflow = get_oauth2_flow(provider)\n\n\tstate = { \"site\": frappe.utils.get_url(), \"token\": frappe.generate_hash() }\n\tfrappe.cache().set_value(\"{0}:{1}\".format(provider, state[\"token\"]), True, expires_in_sec=120)\n\n\t# relative to absolute url\n\tdata = {\n\t\t\"redirect_uri\": get_redirect_uri(provider),\n\t\t\"state\": json.dumps(state)\n\t}\n\n\toauth2_providers = get_oauth2_providers()\n\n\t# additional data if any\n\tdata.update(oauth2_providers[provider].get(\"auth_url_data\", {}))\n\n\treturn flow.get_authorize_url(**data)", "metadata": "root.get_oauth2_authorize_url", "header": "['module', '___EOS___']", "index": 95 }, { "content": "def get_oauth2_flow(provider):\n\tfrom rauth import OAuth2Service\n\n\t# get client_id and client_secret\n\tparams = get_oauth_keys(provider)\n\n\toauth2_providers = get_oauth2_providers()\n\n\t# additional params for getting the flow\n\tparams.update(oauth2_providers[provider][\"flow_params\"])\n\n\t# and we have setup the communication lines\n\treturn OAuth2Service(**params)", "metadata": "root.get_oauth2_flow", "header": "['module', '___EOS___']", "index": 114 } ]
[]
[]
0
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "oauth2", "\\u", "providers_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "google", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flow", "\\u", "params", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "google", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "authoriz", "e\\u", "url", "\"_", ":_", "\"", "https", "://", "account", "s", ".", "google", ".", "com", "/", "o", "/", "oauth2", "/", "auth", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "access", "\\u", "token", "\\u", "url", "\"_", ":_", "\"", "https", "://", "account", "s", ".", "google", ".", "com", "/", "o", "/", "oauth2", "/", "token", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "base", "\\u", "url", "\"_", ":_", "\"", "https", "://", "www", ".", "google", "apis", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "redirec", "t", "\\u", "uri", "\"_", ":_", "\"/", "api", "/", "method", "/", "fra", "ppe", ".", "template", "s", ".", "page", "s", ".", "login", ".", "login", "\\u", "via", "\\u", "google", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auth", "\\u", "url", "\\u", "data", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "scope", "\"_", ":_", "\"", "https", "://", "www", ".", "google", "apis", ".", "com", "/", "auth", "/", "userin", "fo", ".", "profile", " ", "https", "://", "www", ".", "google", "apis", ".", "com", "/", "auth", "/", "userin", "fo", ".", "email", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "response", "\\u", "type", "\"_", ":_", "\"", "code", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "base", "\\u", "url_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "api", "\\u", "endpoint", "\"_", ":_", "\"", "oauth2", "/", "v2", "/", "userin", "fo", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "git", "hub", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flow", "\\u", "params", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "git", "hub", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "authoriz", "e\\u", "url", "\"_", ":_", "\"", "https", "://", "git", "hub", ".", "com", "/", "login", "/", "oauth", "/", "authoriz", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "access", "\\u", "token", "\\u", "url", "\"_", ":_", "\"", "https", "://", "git", "hub", ".", "com", "/", "login", "/", "oauth", "/", "access", "\\u", "token", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "base", "\\u", "url", "\"_", ":_", "\"", "https", "://", "api", ".", "git", "hub", ".", "com", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "redirec", "t", "\\u", "uri", "\"_", ":_", "\"/", "api", "/", "method", "/", "fra", "ppe", ".", "template", "s", ".", "page", "s", ".", "login", ".", "login", "\\u", "via", "\\u", "git", "hub", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "base", "\\u", "url_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "api", "\\u", "endpoint", "\"_", ":_", "\"", "user", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "facebook", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "flow", "\\u", "params", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "facebook", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "authoriz", "e\\u", "url", "\"_", ":_", "\"", "https", "://", "www", ".", "facebook", ".", "com", "/", "dialog", "/", "oauth", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "access", "\\u", "token", "\\u", "url", "\"_", ":_", "\"", "https", "://", "graph", ".", "facebook", ".", "com", "/", "oauth", "/", "access", "\\u", "token", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "base", "\\u", "url", "\"_", ":_", "\"", "https", "://", "graph", ".", "facebook", ".", "com", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "redirec", "t", "\\u", "uri", "\"_", ":_", "\"/", "api", "/", "method", "/", "fra", "ppe", ".", "template", "s", ".", "page", "s", ".", "login", ".", "login", "\\u", "via", "\\u", "facebook", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auth", "\\u", "url", "\\u", "data", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "display", "\"_", ":_", "\"", "page", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "response", "\\u", "type", "\"_", ":_", "\"", "code", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "scope", "\"_", ":_", "\"", "email", ",", "public", "\\u", "profile", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "base", "\\u", "url_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "api", "\\u", "endpoint", "\"_", ":_", "\"/", "v2", ".5", "/", "me", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "api", "\\u", "endpoint", "\\u", "args", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fields", "\"_", ":_", "\"", "first", "\\u", "name", ",", "last", "\\u", "name", ",", "email", ",", "gender", ",", "location", ",", "verifie", "d", ",", "pic", "ture", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "oauth2", "\\u", "authoriz", "e\\u", "url_", "(_", "provider_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "flow_", "=_", "get", "\\u", "oauth2", "\\u", "flow_", "(_", "provider_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "=_", "{_", "\"", "site", "\"_", ":_", "frappe_", "._", "utils_", "._", "get", "\\u", "url_", "(_", ")_", ",_", "\"", "token", "\"_", ":_", "frappe_", "._", "generat", "e\\u", "hash_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frappe_", "._", "cache_", "(_", ")_", "._", "set\\u", "value_", "(_", "\"{", "0", "}:", "{", "1", "}\"_", "._", "format_", "(_", "provider_", ",_", "state_", "[_", "\"", "token", "\"_", "]_", ")_", ",_", "True_", ",_", "expir", "es", "\\u", "in", "\\u", "sec_", "=_", "120_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "abs", "olute", " ", "url_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "redirec", "t", "\\u", "uri", "\"_", ":_", "get", "\\u", "redirec", "t", "\\u", "uri_", "(_", "provider_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "state", "\"_", ":_", "json_", "._", "dumps_", "(_", "state_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "oauth2", "\\u", "providers_", "=_", "get", "\\u", "oauth2", "\\u", "providers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addition", "al", " ", "data", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "._", "update_", "(_", "oauth2", "\\u", "providers_", "[_", "provider_", "]_", "._", "get_", "(_", "\"", "auth", "\\u", "url", "\\u", "data", "\"_", ",_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "flow_", "._", "get", "\\u", "authoriz", "e\\u", "url_", "(_", "**_", "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_", "get", "\\u", "oauth2", "\\u", "flow_", "(_", "provider_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "from_", "ra", "uth_", "import_", "OA", "uth", "2", "Service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "client", "\\u", "id", " ", "and", " ", "client", "\\u", "secret_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "get", "\\u", "oauth", "\\u", "keys_", "(_", "provider_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "oauth2", "\\u", "providers_", "=_", "get", "\\u", "oauth2", "\\u", "providers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addition", "al", " ", "params", " ", "for", " ", "getti", "ng", " ", "the", " ", "flow_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "._", "update_", "(_", "oauth2", "\\u", "providers_", "[_", "provider_", "]_", "[_", "\"", "flow", "\\u", "params", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "we", " ", "have", " ", "setup", " ", "the", " ", "communication", " ", "lines_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "OA", "uth", "2", "Service_", "(_", "**_", "params_", ")_", "\\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,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
scrapy/scrapy/scrapy/dupefilters.py
[ { "content": "class BaseDupeFilter(object):\n\n\n\n\n", "metadata": "root.BaseDupeFilter", "header": "['module', '___EOS___']", "index": 8 }, { "content": " @classmethod\n def from_settings(cls, settings):\n return cls()", "metadata": "root.BaseDupeFilter.from_settings", "header": "['class', 'BaseDupeFilter', '(', 'object', ')', ':', '___EOS___']", "index": 10 }, { "content": " def request_seen(self, request):\n return False", "metadata": "root.BaseDupeFilter.request_seen", "header": "['class', 'BaseDupeFilter', '(', 'object', ')', ':', '___EOS___']", "index": 14 }, { "content": " def open(self): # can return deferred\n pass", "metadata": "root.BaseDupeFilter.open", "header": "['class', 'BaseDupeFilter', '(', 'object', ')', ':', '___EOS___']", "index": 17 }, { "content": " def close(self, reason): # can return a deferred\n pass", "metadata": "root.BaseDupeFilter.close", "header": "['class', 'BaseDupeFilter', '(', 'object', ')', ':', '___EOS___']", "index": 20 }, { "content": " def log(self, request, spider): # log that a request has been filtered\n pass", "metadata": "root.BaseDupeFilter.log", "header": "['class', 'BaseDupeFilter', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": "class RFPDupeFilter(BaseDupeFilter):\n \"\"\"Request Fingerprint duplicates filter\"\"\"\n\n\n\n\n\n", "metadata": "root.RFPDupeFilter", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def __init__(self, path=None, debug=False):\n self.file = None\n self.fingerprints = set()\n self.logdupes = True\n self.debug = debug\n self.logger = logging.getLogger(__name__)\n if path:\n self.file = open(os.path.join(path, 'requests.seen'), 'a+')\n self.file.seek(0)\n self.fingerprints.update(x.rstrip() for x in self.file)", "metadata": "root.RFPDupeFilter.__init__", "header": "['class', 'RFPDupeFilter', '(', 'BaseDupeFilter', ')', ':', '___EOS___']", "index": 30 }, { "content": " @classmethod\n def from_settings(cls, settings):\n debug = settings.getbool('DUPEFILTER_DEBUG')\n return cls(job_dir(settings), debug)", "metadata": "root.RFPDupeFilter.from_settings", "header": "['class', 'RFPDupeFilter', '(', 'BaseDupeFilter', ')', ':', '___EOS___']", "index": 41 }, { "content": " def request_seen(self, request):\n fp = self.request_fingerprint(request)\n if fp in self.fingerprints:\n return True\n self.fingerprints.add(fp)\n if self.file:\n self.file.write(fp + os.linesep)", "metadata": "root.RFPDupeFilter.request_seen", "header": "['class', 'RFPDupeFilter', '(', 'BaseDupeFilter', ')', ':', '___EOS___']", "index": 46 }, { "content": " def request_fingerprint(self, request):\n return request_fingerprint(request)", "metadata": "root.RFPDupeFilter.request_fingerprint", "header": "['class', 'RFPDupeFilter', '(', 'BaseDupeFilter', ')', ':', '___EOS___']", "index": 54 }, { "content": " def close(self, reason):\n if self.file:\n self.file.close()", "metadata": "root.RFPDupeFilter.close", "header": "['class', 'RFPDupeFilter', '(', 'BaseDupeFilter', ')', ':', '___EOS___']", "index": 57 }, { "content": " def log(self, request, spider):\n if self.debug:\n msg = \"Filtered duplicate request: %(request)s\"\n self.logger.debug(msg, {'request': request}, extra={'spider': spider})\n elif self.logdupes:\n msg = (\"Filtered duplicate request: %(request)s\"\n \" - no more duplicates will be shown\"\n \" (see DUPEFILTER_DEBUG to show all duplicates)\")\n self.logger.debug(msg, {'request': request}, extra={'spider': spider})\n self.logdupes = False\n\n spider.crawler.stats.inc_value('dupefilter/filtered', spider=spider)", "metadata": "root.RFPDupeFilter.log", "header": "['class', 'RFPDupeFilter', '(', 'BaseDupeFilter', ')', ':', '___EOS___']", "index": 61 } ]
[]
[]
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", "Dup", "e", "Filter_", "(_", "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_", "[SEP]_", "class_", "Base", "Dup", "e", "Filter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "settings_", "(_", "cls_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Dup", "e", "Filter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "request", "\\u", "seen_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Dup", "e", "Filter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open_", "(_", "self_", ")_", ":_", "#", " ", "can", " ", "return", " ", "deferred_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Dup", "e", "Filter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ",_", "reason_", ")_", ":_", "#", " ", "can", " ", "return", " ", "a", " ", "deferred_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Dup", "e", "Filter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log_", "(_", "self_", ",_", "request_", ",_", "spider_", ")_", ":_", "#", " ", "log", " ", "tha", "t", " ", "a", " ", "request", " ", "has", " ", "bee", "n", " ", "filtered_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "RF", "PD", "upe", "Filter_", "(_", "Base", "Dup", "e", "Filter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Request", " ", "Fingerprint", " ", "duplicat", "es", " ", "filter", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "RF", "PD", "upe", "Filter_", "(_", "Base", "Dup", "e", "Filter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "path_", "=_", "None_", ",_", "debug_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fingerprint", "s_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logd", "upe", "s_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "debug_", "=_", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'", "request", "s", ".", "see", "n", "'_", ")_", ",_", "'", "a", "+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fingerprint", "s_", "._", "update_", "(_", "x_", "._", "rstrip_", "(_", ")_", "for_", "x_", "in_", "self_", "._", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RF", "PD", "upe", "Filter_", "(_", "Base", "Dup", "e", "Filter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "settings_", "(_", "cls_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug_", "=_", "settings_", "._", "getb", "ool_", "(_", "'", "DU", "PE", "FILTER", "\\u", "DEBU", "G", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "job", "\\u", "dir_", "(_", "settings_", ")_", ",_", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RF", "PD", "upe", "Filter_", "(_", "Base", "Dup", "e", "Filter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "request", "\\u", "seen_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "=_", "self_", "._", "request", "\\u", "fingerprint_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fp_", "in_", "self_", "._", "fingerprint", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fingerprint", "s_", "._", "add_", "(_", "fp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "write_", "(_", "fp_", "+_", "os_", "._", "linesep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RF", "PD", "upe", "Filter_", "(_", "Base", "Dup", "e", "Filter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "request", "\\u", "fingerprint_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "request", "\\u", "fingerprint_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RF", "PD", "upe", "Filter_", "(_", "Base", "Dup", "e", "Filter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ",_", "reason_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RF", "PD", "upe", "Filter_", "(_", "Base", "Dup", "e", "Filter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log_", "(_", "self_", ",_", "request_", ",_", "spider_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Filter", "ed", " ", "duplicat", "e", " ", "request", ":", " ", "%", "(", "request", ")", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "msg_", ",_", "{_", "'", "request", "'_", ":_", "request_", "}_", ",_", "extra_", "=_", "{_", "'", "spider", "'_", ":_", "spider_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "logd", "upe", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "(_", "\"", "Filter", "ed", " ", "duplicat", "e", " ", "request", ":", " ", "%", "(", "request", ")", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "-", " ", "no", " ", "more", " ", "duplicat", "es", " ", "will", " ", "be", " ", "shown", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "(", "see", " ", "DU", "PE", "FILTER", "\\u", "DEBU", "G", " ", "to", " ", "show", " ", "all", " ", "duplicat", "es", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "msg_", ",_", "{_", "'", "request", "'_", ":_", "request_", "}_", ",_", "extra_", "=_", "{_", "'", "spider", "'_", ":_", "spider_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logd", "upe", "s_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spider_", "._", "crawler_", "._", "stats_", "._", "inc", "\\u", "value_", "(_", "'", "dupe", "filter", "/", "filter", "ed", "'_", ",_", "spider_", "=_", "spider_", ")_" ]
[ 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 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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2, 2 ]
Unused import
acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/blogger/client.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright (C) 2009 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\n\"\"\"Contains a client to communicate with the Blogger servers.\n\nFor documentation on the Blogger API, see:\nhttp://code.google.com/apis/blogger/\n\"\"\"\n\n\n__author__ = '[email protected] (Jeff Scudder)'\n\n\nimport gdata.client\nimport gdata.gauth\nimport gdata.blogger.data\nimport atom.data\nimport atom.http_core\n\n\n# List user's blogs, takes a user ID, or 'default'.\nBLOGS_URL = 'http://www.blogger.com/feeds/%s/blogs'\n# Takes a blog ID.\nBLOG_POST_URL = 'http://www.blogger.com/feeds/%s/posts/default'\n# Takes a blog ID.\nBLOG_PAGE_URL = 'http://www.blogger.com/feeds/%s/pages/default'\n# Takes a blog ID and post ID.\nBLOG_POST_COMMENTS_URL = 'http://www.blogger.com/feeds/%s/%s/comments/default'\n# Takes a blog ID.\nBLOG_COMMENTS_URL = 'http://www.blogger.com/feeds/%s/comments/default'\n# Takes a blog ID.\nBLOG_ARCHIVE_URL = 'http://www.blogger.com/feeds/%s/archive/full'\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BloggerClient(gdata.client.GDClient):\n api_version = '2'\n auth_service = 'blogger'\n auth_scopes = gdata.gauth.AUTH_SCOPES['blogger']\n\n\n GetBlogs = get_blogs\n\n\n GetPosts = get_posts\n\n\n GetPages = get_pages\n\n\n GetPostComments = get_post_comments\n\n\n GetBlogComments = get_blog_comments\n\n\n GetBlogArchive = get_blog_archive\n\n\n AddPost = add_post\n\n\n AddPage = add_page\n\n\n AddComment = add_comment\n\n\n Update = update\n\n\n Delete = delete", "metadata": "root.BloggerClient", "header": "['module', '___EOS___']", "index": 48 }, { "content": " def get_blogs(self, user_id='default', auth_token=None,\n desired_class=gdata.blogger.data.BlogFeed, **kwargs):\n return self.get_feed(BLOGS_URL % user_id, auth_token=auth_token,\n desired_class=desired_class, **kwargs)", "metadata": "root.BloggerClient.get_blogs", "header": "['class', 'BloggerClient', '(', 'gdata', '.', 'client', '.', 'GDClient', ')', ':', '___EOS___']", "index": 53 }, { "content": " def get_posts(self, blog_id, auth_token=None,\n desired_class=gdata.blogger.data.BlogPostFeed, query=None,\n **kwargs):\n return self.get_feed(BLOG_POST_URL % blog_id, auth_token=auth_token,\n desired_class=desired_class, query=query, **kwargs)", "metadata": "root.BloggerClient.get_posts", "header": "['class', 'BloggerClient', '(', 'gdata', '.', 'client', '.', 'GDClient', ')', ':', '___EOS___']", "index": 60 }, { "content": " def get_pages(self, blog_id, auth_token=None,\n desired_class=gdata.blogger.data.BlogPageFeed, query=None,\n **kwargs):\n return self.get_feed(BLOG_PAGE_URL % blog_id, auth_token=auth_token,\n desired_class=desired_class, query=query, **kwargs)", "metadata": "root.BloggerClient.get_pages", "header": "['class', 'BloggerClient', '(', 'gdata', '.', 'client', '.', 'GDClient', ')', ':', '___EOS___']", "index": 68 }, { "content": " def get_post_comments(self, blog_id, post_id, auth_token=None,\n desired_class=gdata.blogger.data.CommentFeed,\n query=None, **kwargs):\n return self.get_feed(BLOG_POST_COMMENTS_URL % (blog_id, post_id),\n auth_token=auth_token, desired_class=desired_class,\n query=query, **kwargs)", "metadata": "root.BloggerClient.get_post_comments", "header": "['class', 'BloggerClient', '(', 'gdata', '.', 'client', '.', 'GDClient', ')', ':', '___EOS___']", "index": 76 }, { "content": " def get_blog_comments(self, blog_id, auth_token=None,\n desired_class=gdata.blogger.data.CommentFeed,\n query=None, **kwargs):\n return self.get_feed(BLOG_COMMENTS_URL % blog_id, auth_token=auth_token,\n desired_class=desired_class, query=query, **kwargs)", "metadata": "root.BloggerClient.get_blog_comments", "header": "['class', 'BloggerClient', '(', 'gdata', '.', 'client', '.', 'GDClient', ')', ':', '___EOS___']", "index": 85 }, { "content": " def get_blog_archive(self, blog_id, auth_token=None, **kwargs):\n return self.get_feed(BLOG_ARCHIVE_URL % blog_id, auth_token=auth_token,\n **kwargs)", "metadata": "root.BloggerClient.get_blog_archive", "header": "['class', 'BloggerClient', '(', 'gdata', '.', 'client', '.', 'GDClient', ')', ':', '___EOS___']", "index": 93 }, { "content": " def add_post(self, blog_id, title, body, labels=None, draft=False,\n auth_token=None, title_type='text', body_type='html', **kwargs):\n # Construct an atom Entry for the blog post to be sent to the server.\n new_entry = gdata.blogger.data.BlogPost(\n title=atom.data.Title(text=title, type=title_type),\n content=atom.data.Content(text=body, type=body_type))\n if labels:\n for label in labels:\n new_entry.add_label(label)\n if draft:\n new_entry.control = atom.data.Control(draft=atom.data.Draft(text='yes'))\n return self.post(new_entry, BLOG_POST_URL % blog_id, auth_token=auth_token, **kwargs)", "metadata": "root.BloggerClient.add_post", "header": "['class', 'BloggerClient', '(', 'gdata', '.', 'client', '.', 'GDClient', ')', ':', '___EOS___']", "index": 99 }, { "content": " def add_page(self, blog_id, title, body, draft=False, auth_token=None,\n title_type='text', body_type='html', **kwargs):\n new_entry = gdata.blogger.data.BlogPage(\n title=atom.data.Title(text=title, type=title_type),\n content=atom.data.Content(text=body, type=body_type))\n if draft:\n new_entry.control = atom.data.Control(draft=atom.data.Draft(text='yes'))\n return self.post(new_entry, BLOG_PAGE_URL % blog_id, auth_token=auth_token, **kwargs)", "metadata": "root.BloggerClient.add_page", "header": "['class', 'BloggerClient', '(', 'gdata', '.', 'client', '.', 'GDClient', ')', ':', '___EOS___']", "index": 114 }, { "content": " def add_comment(self, blog_id, post_id, body, auth_token=None,\n title_type='text', body_type='html', **kwargs):\n new_entry = gdata.blogger.data.Comment(\n content=atom.data.Content(text=body, type=body_type))\n return self.post(new_entry, BLOG_POST_COMMENTS_URL % (blog_id, post_id),\n auth_token=auth_token, **kwargs)", "metadata": "root.BloggerClient.add_comment", "header": "['class', 'BloggerClient', '(', 'gdata', '.', 'client', '.', 'GDClient', ')', ':', '___EOS___']", "index": 125 }, { "content": " def update(self, entry, auth_token=None, **kwargs):\n # The Blogger API does not currently support ETags, so for now remove\n # the ETag before performing an update.\n old_etag = entry.etag\n entry.etag = None\n response = gdata.client.GDClient.update(self, entry,\n auth_token=auth_token, **kwargs)\n entry.etag = old_etag\n return response", "metadata": "root.BloggerClient.update", "header": "['class', 'BloggerClient', '(', 'gdata', '.', 'client', '.', 'GDClient', ')', ':', '___EOS___']", "index": 134 }, { "content": " def delete(self, entry_or_uri, auth_token=None, **kwargs):\n if isinstance(entry_or_uri, (str, unicode, atom.http_core.Uri)):\n return gdata.client.GDClient.delete(self, entry_or_uri,\n auth_token=auth_token, **kwargs)\n # The Blogger API does not currently support ETags, so for now remove\n # the ETag before performing a delete.\n old_etag = entry_or_uri.etag\n entry_or_uri.etag = None\n response = gdata.client.GDClient.delete(self, entry_or_uri,\n auth_token=auth_token, **kwargs)\n # TODO: if GDClient.delete raises and exception, the entry's etag may be\n # left as None. Should revisit this logic.\n entry_or_uri.etag = old_etag\n return response", "metadata": "root.BloggerClient.delete", "header": "['class', 'BloggerClient', '(', 'gdata', '.', 'client', '.', 'GDClient', ')', ':', '___EOS___']", "index": 146 }, { "content": "class Query(gdata.client.Query):\n\n\n\n ModifyRequest = modify_request", "metadata": "root.Query", "header": "['module', '___EOS___']", "index": 164 }, { "content": " def __init__(self, order_by=None, **kwargs):\n gdata.client.Query.__init__(self, **kwargs)\n self.order_by = order_by", "metadata": "root.Query.__init__", "header": "['class', 'Query', '(', 'gdata', '.', 'client', '.', 'Query', ')', ':', '___EOS___']", "index": 166 }, { "content": " def modify_request(self, http_request):\n gdata.client._add_query_param('orderby', self.order_by, http_request)\n gdata.client.Query.modify_request(self, http_request)", "metadata": "root.Query.modify_request", "header": "['class', 'Query', '(', 'gdata', '.', 'client', '.', 'Query', ')', ':', '___EOS___']", "index": 170 } ]
[]
[]
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_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Contain", "s", " ", "a", " ", "client", " ", "to", " ", "communi", "cate", " ", "with", " ", "the", " ", "Blog", "ger", " ", "server", "s", ".", "\\", "10", ";", "\\", "10", ";", "For", " ", "documentation", " ", "on", " ", "the", " ", "Blog", "ger", " ", "API", ",", " ", "see", ":", "\\", "10", ";", "http", "://", "code", ".", "google", ".", "com", "/", "apis", "/", "blog", "ger", "/", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "j", ".", "s", "@", "google", ".", "com", " ", "(", "Je", "ff", " ", "Sc", "ud", "der", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "gdata_", "._", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gdata_", "._", "gau", "th_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gdata_", "._", "blog", "ger_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "atom_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "atom_", "._", "http", "\\u", "core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "user", "'", "s", " ", "blogs", ",", " ", "take", "s", " ", "a", " ", "user", " ", "ID", ",", " ", "or", " ", "'", "default", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "BLO", "GS", "\\u", "URL_", "=_", "'", "http", "://", "www", ".", "blog", "ger", ".", "com", "/", "feed", "s", "/", "%", "s", "/", "blogs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tak", "es", " ", "a", " ", "blog", " ", "ID", "._", "\\u\\u\\uNL\\u\\u\\u_", "BLO", "G", "\\u", "POST", "\\u", "URL_", "=_", "'", "http", "://", "www", ".", "blog", "ger", ".", "com", "/", "feed", "s", "/", "%", "s", "/", "posts", "/", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tak", "es", " ", "a", " ", "blog", " ", "ID", "._", "\\u\\u\\uNL\\u\\u\\u_", "BLO", "G", "\\u", "PAGE", "\\u", "URL_", "=_", "'", "http", "://", "www", ".", "blog", "ger", ".", "com", "/", "feed", "s", "/", "%", "s", "/", "page", "s", "/", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tak", "es", " ", "a", " ", "blog", " ", "ID", " ", "and", " ", "post", " ", "ID", "._", "\\u\\u\\uNL\\u\\u\\u_", "BLO", "G", "\\u", "POST", "\\u", "COMMENT", "S", "\\u", "URL_", "=_", "'", "http", "://", "www", ".", "blog", "ger", ".", "com", "/", "feed", "s", "/", "%", "s", "/", "%", "s", "/", "comment", "s", "/", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tak", "es", " ", "a", " ", "blog", " ", "ID", "._", "\\u\\u\\uNL\\u\\u\\u_", "BLO", "G", "\\u", "COMMENT", "S", "\\u", "URL_", "=_", "'", "http", "://", "www", ".", "blog", "ger", ".", "com", "/", "feed", "s", "/", "%", "s", "/", "comment", "s", "/", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tak", "es", " ", "a", " ", "blog", " ", "ID", "._", "\\u\\u\\uNL\\u\\u\\u_", "BLO", "G", "\\u", "ARCHIVE", "\\u", "URL_", "=_", "'", "http", "://", "www", ".", "blog", "ger", ".", "com", "/", "feed", "s", "/", "%", "s", "/", "archive", "/", "full", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api", "\\u", "version_", "=_", "'", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth", "\\u", "service_", "=_", "'", "blog", "ger", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth", "\\u", "scopes_", "=_", "gdata_", "._", "gau", "th_", "._", "AUTH", "\\u", "SCOPE", "S_", "[_", "'", "blog", "ger", "'_", "]_", "\\u\\u\\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_", "Get", "Blog", "s_", "=_", "get", "\\u", "blogs", "_", "\\u\\u\\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_", "Get", "Posts", "_", "=_", "get", "\\u", "posts_", "\\u\\u\\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_", "Get", "Pages_", "=_", "get", "\\u", "pages_", "\\u\\u\\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_", "Get", "Post", "Comments_", "=_", "get", "\\u", "post", "\\u", "comments_", "\\u\\u\\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_", "Get", "Blog", "Comments_", "=_", "get", "\\u", "blog", "\\u", "comments_", "\\u\\u\\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_", "Get", "Blog", "Archive_", "=_", "get", "\\u", "blog", "\\u", "archive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Add", "Post_", "=_", "add", "\\u", "post_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Add", "Page_", "=_", "add", "\\u", "page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Add", "Comment_", "=_", "add", "\\u", "comment_", "\\u\\u\\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_", "Update_", "=_", "update_", "\\u\\u\\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_", "Delete_", "=_", "delete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "blogs", "_", "(_", "self_", ",_", "user", "\\u", "id_", "=_", "'", "default", "'_", ",_", "auth", "\\u", "token_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "class_", "=_", "gdata_", "._", "blog", "ger_", "._", "data_", "._", "Blog", "Feed_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "feed_", "(_", "BLO", "GS", "\\u", "URL_", "%_", "user", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "class_", "=_", "desi", "red", "\\u", "class_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "posts_", "(_", "self_", ",_", "blog", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "class_", "=_", "gdata_", "._", "blog", "ger_", "._", "data_", "._", "Blog", "Post", "Feed_", ",_", "query_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "feed_", "(_", "BLO", "G", "\\u", "POST", "\\u", "URL_", "%_", "blog", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "class_", "=_", "desi", "red", "\\u", "class_", ",_", "query_", "=_", "query_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "pages_", "(_", "self_", ",_", "blog", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "class_", "=_", "gdata_", "._", "blog", "ger_", "._", "data_", "._", "Blog", "Page", "Feed_", ",_", "query_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "feed_", "(_", "BLO", "G", "\\u", "PAGE", "\\u", "URL_", "%_", "blog", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "class_", "=_", "desi", "red", "\\u", "class_", ",_", "query_", "=_", "query_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "post", "\\u", "comments_", "(_", "self_", ",_", "blog", "\\u", "id_", ",_", "post", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "class_", "=_", "gdata_", "._", "blog", "ger_", "._", "data_", "._", "Comme", "nt", "Feed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "feed_", "(_", "BLO", "G", "\\u", "POST", "\\u", "COMMENT", "S", "\\u", "URL_", "%_", "(_", "blog", "\\u", "id_", ",_", "post", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "desi", "red", "\\u", "class_", "=_", "desi", "red", "\\u", "class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "query_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "blog", "\\u", "comments_", "(_", "self_", ",_", "blog", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "class_", "=_", "gdata_", "._", "blog", "ger_", "._", "data_", "._", "Comme", "nt", "Feed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "feed_", "(_", "BLO", "G", "\\u", "COMMENT", "S", "\\u", "URL_", "%_", "blog", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desi", "red", "\\u", "class_", "=_", "desi", "red", "\\u", "class_", ",_", "query_", "=_", "query_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "blog", "\\u", "archive_", "(_", "self_", ",_", "blog", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "feed_", "(_", "BLO", "G", "\\u", "ARCHIVE", "\\u", "URL_", "%_", "blog", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "\\u", "post_", "(_", "self_", ",_", "blog", "\\u", "id_", ",_", "title_", ",_", "body_", ",_", "labels_", "=_", "None_", ",_", "draft_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "token_", "=_", "None_", ",_", "title", "\\u", "type_", "=_", "'", "text", "'_", ",_", "body", "\\u", "type_", "=_", "'", "html", "'_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Construct", " ", "an", " ", "atom", " ", "Entr", "y", " ", "for", " ", "the", " ", "blog", " ", "post", " ", "to", " ", "be", " ", "sent", " ", "to", " ", "the", " ", "server", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "entry_", "=_", "gdata_", "._", "blog", "ger_", "._", "data_", "._", "Blog", "Post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "atom_", "._", "data_", "._", "Title_", "(_", "text_", "=_", "title_", ",_", "type_", "=_", "title", "\\u", "type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "atom_", "._", "data_", "._", "Content_", "(_", "text_", "=_", "body_", ",_", "type_", "=_", "body", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "label_", "in_", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "entry_", "._", "add", "\\u", "label_", "(_", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "draft_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "entry_", "._", "control_", "=_", "atom_", "._", "data_", "._", "Control_", "(_", "draft_", "=_", "atom_", "._", "data_", "._", "Dra", "ft_", "(_", "text_", "=_", "'", "ye", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "post_", "(_", "new", "\\u", "entry_", ",_", "BLO", "G", "\\u", "POST", "\\u", "URL_", "%_", "blog", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "\\u", "page_", "(_", "self_", ",_", "blog", "\\u", "id_", ",_", "title_", ",_", "body_", ",_", "draft_", "=_", "False_", ",_", "auth", "\\u", "token_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title", "\\u", "type_", "=_", "'", "text", "'_", ",_", "body", "\\u", "type_", "=_", "'", "html", "'_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "entry_", "=_", "gdata_", "._", "blog", "ger_", "._", "data_", "._", "Blog", "Page_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "atom_", "._", "data_", "._", "Title_", "(_", "text_", "=_", "title_", ",_", "type_", "=_", "title", "\\u", "type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "atom_", "._", "data_", "._", "Content_", "(_", "text_", "=_", "body_", ",_", "type_", "=_", "body", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "draft_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "entry_", "._", "control_", "=_", "atom_", "._", "data_", "._", "Control_", "(_", "draft_", "=_", "atom_", "._", "data_", "._", "Dra", "ft_", "(_", "text_", "=_", "'", "ye", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "post_", "(_", "new", "\\u", "entry_", ",_", "BLO", "G", "\\u", "PAGE", "\\u", "URL_", "%_", "blog", "\\u", "id_", ",_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "\\u", "comment_", "(_", "self_", ",_", "blog", "\\u", "id_", ",_", "post", "\\u", "id_", ",_", "body_", ",_", "auth", "\\u", "token_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title", "\\u", "type_", "=_", "'", "text", "'_", ",_", "body", "\\u", "type_", "=_", "'", "html", "'_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "entry_", "=_", "gdata_", "._", "blog", "ger_", "._", "data_", "._", "Comment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "atom_", "._", "data_", "._", "Content_", "(_", "text_", "=_", "body_", ",_", "type_", "=_", "body", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "post_", "(_", "new", "\\u", "entry_", ",_", "BLO", "G", "\\u", "POST", "\\u", "COMMENT", "S", "\\u", "URL_", "%_", "(_", "blog", "\\u", "id_", ",_", "post", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "entry_", ",_", "auth", "\\u", "token_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "Blog", "ger", " ", "API", " ", "doe", "s", " ", "not", " ", "currentl", "y", " ", "support", " ", "ET", "ags", ",", " ", "so", " ", "for", " ", "now", " ", "remove_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "ET", "ag", " ", "bef", "ore", " ", "perform", "ing", " ", "an", " ", "update", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "etag_", "=_", "entry_", "._", "etag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry_", "._", "etag_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "gdata_", "._", "client_", "._", "GD", "Client_", "._", "update_", "(_", "self_", ",_", "entry_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry_", "._", "etag_", "=_", "old", "\\u", "etag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blog", "ger", "Client_", "(_", "gdata_", "._", "client_", "._", "GD", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "entry", "\\u", "or", "\\u", "uri_", ",_", "auth", "\\u", "token_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "entry", "\\u", "or", "\\u", "uri_", ",_", "(_", "str_", ",_", "unicode_", ",_", "atom_", "._", "http", "\\u", "core_", "._", "Uri_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "gdata_", "._", "client_", "._", "GD", "Client_", "._", "delete_", "(_", "self_", ",_", "entry", "\\u", "or", "\\u", "uri_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "Blog", "ger", " ", "API", " ", "doe", "s", " ", "not", " ", "currentl", "y", " ", "support", " ", "ET", "ags", ",", " ", "so", " ", "for", " ", "now", " ", "remove_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "ET", "ag", " ", "bef", "ore", " ", "perform", "ing", " ", "a", " ", "delete", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "etag_", "=_", "entry", "\\u", "or", "\\u", "uri_", "._", "etag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry", "\\u", "or", "\\u", "uri_", "._", "etag_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "gdata_", "._", "client_", "._", "GD", "Client_", "._", "delete_", "(_", "self_", ",_", "entry", "\\u", "or", "\\u", "uri_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "token_", "=_", "auth", "\\u", "token_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "if", " ", "GD", "Client", ".", "delete", " ", "raise", "s", " ", "and", " ", "exception", ",", " ", "the", " ", "entry", "'", "s", " ", "eta", "g", " ", "may", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "left", " ", "as", " ", "Non", "e", ".", " ", "Sho", "ul", "d", " ", "revis", "it", " ", "this", " ", "logic", "._", "\\u\\u\\uNL\\u\\u\\u_", "entry", "\\u", "or", "\\u", "uri_", "._", "etag_", "=_", "old", "\\u", "etag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Query_", "(_", "gdata_", "._", "client_", "._", "Query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Modif", "y", "Request_", "=_", "modif", "y", "\\u", "request_", "[SEP]_", "class_", "Query_", "(_", "gdata_", "._", "client_", "._", "Query_", ")_", ":_", "\\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_", ",_", "order", "\\u", "by_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gdata_", "._", "client_", "._", "Query_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "order", "\\u", "by_", "=_", "order", "\\u", "by_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Query_", "(_", "gdata_", "._", "client_", "._", "Query_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "modif", "y", "\\u", "request_", "(_", "self_", ",_", "http", "\\u", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gdata_", "._", "client_", "._", "\\u", "add", "\\u", "query", "\\u", "param_", "(_", "'", "orderb", "y", "'_", ",_", "self_", "._", "order", "\\u", "by_", ",_", "http", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gdata_", "._", "client_", "._", "Query_", "._", "modif", "y", "\\u", "request_", "(_", "self_", ",_", "http", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 local variable
PressLabs/gitfs/tests/integrations/current/test_write.py
[ { "content": " def test_chmod_invalid_mode(self):\n filename = \"{}/testing\".format(self.current_path)\n\n with pytest.raises(OSError):\n os.chmod(\n filename,\n 0o777,\n )", "metadata": "root.TestWriteCurrentView.test_chmod_invalid_mode", "header": "['class', 'TestWriteCurrentView', '(', 'BaseTest', ')', ':', '___EOS___']", "index": 251 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Write", "Curr", "ent", "View_", "(_", "Base", "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", "chm", "od", "\\u", "invalid", "\\u", "mode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "\"{}", "/", "testi", "ng", "\"_", "._", "format_", "(_", "self_", "._", "current", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "OSE", "rror_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "chmod_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0o7", "77_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
kuri65536/python-for-android/python-modules/twisted/twisted/test/test_plugin.py
[ { "content": " def test_deployedMode(self):\n \"\"\"\n The C{dropin.cache} file may not be writable: the cache should still be\n attainable, but an error should be logged to show that the cache\n couldn't be updated.\n \"\"\"\n # Generate the cache\n plugin.getCache(self.module)\n\n # Add a new plugin\n FilePath(__file__).sibling('plugin_extra1.py'\n ).copyTo(self.package.child('pluginextra.py'))\n\n os.chmod(self.package.path, 0500)\n # Change the right of dropin.cache too for windows\n os.chmod(self.package.child('dropin.cache').path, 0400)\n self.addCleanup(os.chmod, self.package.path, 0700)\n self.addCleanup(os.chmod,\n self.package.child('dropin.cache').path, 0700)\n\n cache = plugin.getCache(self.module)\n # The new plugin should be reported\n self.assertIn('pluginextra', cache)\n self.assertIn(self.originalPlugin, cache)\n\n errors = self.flushLoggedErrors()\n self.assertEquals(len(errors), 1)\n # Windows report OSError, others IOError\n errors[0].trap(OSError, IOError)", "metadata": "root.PluginTestCase.test_deployedMode", "header": "['class', 'PluginTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 294 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Plug", "in", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "deploye", "d", "Mode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "C", "{", "drop", "in", ".", "cache", "}", " ", "file", " ", "may", " ", "not", " ", "be", " ", "writ", "able", ":", " ", "the", " ", "cache", " ", "shou", "ld", " ", "still", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "att", "ain", "able", ",", " ", "but", " ", "an", " ", "error", " ", "shou", "ld", " ", "be", " ", "logged", " ", "to", " ", "show", " ", "tha", "t", " ", "the", " ", "cache", "\\", "10", ";", " ", " ", " ", " ", "coul", "dn", "'", "t", " ", "be", " ", "update", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Generate", " ", "the", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "plugin_", "._", "get", "Cache_", "(_", "self_", "._", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "a", " ", "new", " ", "plugin_", "\\u\\u\\uNL\\u\\u\\u_", "File", "Path_", "(_", "\\u\\u", "file\\u\\u_", ")_", "._", "sibling_", "(_", "'", "plugin", "\\u", "extra", "1", ".", "py", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "copy", "To_", "(_", "self_", "._", "package_", "._", "child_", "(_", "'", "plugin", "extra", ".", "py", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chmod_", "(_", "self_", "._", "package_", "._", "path_", ",_", "0_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Change", " ", "the", " ", "right", " ", "of", " ", "drop", "in", ".", "cache", " ", "too", " ", "for", " ", "windows_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chmod_", "(_", "self_", "._", "package_", "._", "child_", "(_", "'", "drop", "in", ".", "cache", "'_", ")_", "._", "path_", ",_", "0_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Cleanup_", "(_", "os_", "._", "chmod_", ",_", "self_", "._", "package_", "._", "path_", ",_", "0_", "700_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "Cleanup_", "(_", "os_", "._", "chmod_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "package_", "._", "child_", "(_", "'", "drop", "in", ".", "cache", "'_", ")_", "._", "path_", ",_", "0_", "700_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "plugin_", "._", "get", "Cache_", "(_", "self_", "._", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "new", " ", "plugin", " ", "shou", "ld", " ", "be", " ", "reporte", "d_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "plugin", "extra", "'_", ",_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "self_", "._", "original", "Plugin_", ",_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", "=_", "self_", "._", "flush", "Log", "ged", "Errors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "len_", "(_", "errors_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Window", "s", " ", "report", " ", "OSE", "rror", ",", " ", "other", "s", " ", "IO", "Error_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", "[_", "0_", "]_", "._", "trap_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cigroup-ol/windml/setup.py
[ { "content": "try:\n from setuptools import setup, find_packages\nexcept ImportError:\n import ez_setup\n ez_setup.use_setuptools()\n from setuptools import setup, find_packages\n\nfrom pip.req import parse_requirements\n\nimport os\nimport sys\n\n# disables creation of .DS_Store files inside tarballs on Mac OS X\nos.environ['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'\nos.environ['COPYFILE_DISABLE'] = 'true'\n\nimport windml\n\n\n\nDESCRIPTION = 'The windML framework provides an easy-to-use access to wind data '\\\n 'sources within the Python world, building upon numpy, scipy, sklearn, and '\\\n 'matplotlib. As a machine learning module, it provides versatile tools for '\\\n 'various learning tasks like time-series prediction, classification, clustering, '\\\n 'dimensionality reduction, and related tasks.'\n\nsetup(\n author=windml.__author__,\n author_email=windml.__author_email__,\nclassifiers=[\n 'Development Status :: 5 - Production/Stable',\n 'Environment :: Console',\n 'Environment :: X11 Applications',\n 'Environment :: X11 Applications :: GTK',\n 'Intended Audience :: Developers',\n 'Intended Audience :: Science/Research',\n 'License :: OSI Approved :: BSD License',\n 'Natural Language :: English',\n 'Operating System :: MacOS',\n 'Operating System :: POSIX',\n 'Operating System :: POSIX :: Linux',\n 'Operating System :: Unix',\n 'Programming Language :: Python',\n 'Topic :: Education',\n 'Topic :: Scientific/Engineering',\n 'Topic :: Scientific/Engineering :: Artificial Intelligence',\n 'Topic :: Scientific/Engineering :: Atmospheric Science',\n],\n data_files=[],\n description=DESCRIPTION,\n ext_modules=[],\n install_requires=find_requirements('requirements.txt'),\n license=windml.__license__,\n long_description=DESCRIPTION,\n name='windml',\n packages=find_packages(),\n package_data={},\n setup_requires=find_requirements('requirements.txt'),\n url=windml.__url__,\n use_2to3=(sys.version_info >= (3,)),\n version=windml.__version__,\n)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def extract_package_name(requirement):\n return str(requirement.req).replace('-', '_').split('==')[0]", "metadata": "root.extract_package_name", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def find_requirements(req_file='requirements.txt'):\n return [extract_package_name(r) for r in parse_requirements(req_file)]", "metadata": "root.find_requirements", "header": "['module', '___EOS___']", "index": 21 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\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_", "ez", "\\u", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ez", "\\u", "setup_", "._", "use", "\\u", "setuptools_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "pip_", "._", "req_", "import_", "parse", "\\u", "requirements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "disable", "s", " ", "creati", "on", " ", "of", " ", ".", "DS", "\\u", "Stor", "e", " ", "files", " ", "insi", "de", " ", "tarball", "s", " ", "on", " ", "Mac", " ", "OS", " ", "X_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "COPY", "\\u", "EXTEND", "ED", "\\u", "ATTRIBUTE", "S", "\\u", "DISABLE", "'_", "]_", "=_", "'", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "COPY", "FILE", "\\u", "DISABLE", "'_", "]_", "=_", "'", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "wind", "ml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "DESCRIPTION_", "=_", "'", "The", " ", "wind", "ML", " ", "frame", "work", " ", "provide", "s", " ", "an", " ", "easy", "-", "to", "-", "use", " ", "access", " ", "to", " ", "wind", " ", "data", " ", "'_", "'", "source", "s", " ", "within", " ", "the", " ", "Pyth", "on", " ", "world", ",", " ", "buildi", "ng", " ", "upo", "n", " ", "nump", "y", ",", " ", "sci", "py", ",", " ", "skl", "earn", ",", " ", "and", " ", "'_", "'", "mat", "plotlib", ".", " ", "As", " ", "a", " ", "machine", " ", "learn", "ing", " ", "module", ",", " ", "it", " ", "provide", "s", " ", "versa", "tile", " ", "tool", "s", " ", "for", " ", "'_", "'", "vari", "ous", " ", "learn", "ing", " ", "task", "s", " ", "like", " ", "time", "-", "series", " ", "predicti", "on", ",", " ", "classificati", "on", ",", " ", "clusteri", "ng", ",", " ", "'_", "'", "dimensionality", " ", "reduc", "tion", ",", " ", "and", " ", "relate", "d", " ", "task", "s", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "wind", "ml_", "._", "\\u\\u", "author\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "wind", "ml_", "._", "\\u\\u", "author", "\\u", "email\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "5", " ", "-", " ", "Product", "ion", "/", "Sta", "ble", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Environ", "ment", " ", "::", " ", "Cons", "ole", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Environ", "ment", " ", "::", " ", "X1", "1", " ", "Applica", "tion", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Environ", "ment", " ", "::", " ", "X1", "1", " ", "Applica", "tion", "s", " ", "::", " ", "GTK", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Sci", "ence", "/", "Rese", "arch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "BS", "D", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Nat", "ural", " ", "Lang", "ua", "ge", " ", "::", " ", "Eng", "lish", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Mac", "OS", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "POSI", "X", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "POSI", "X", " ", "::", " ", "Lin", "ux", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "Uni", "x", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Ed", "uca", "tion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sci", "enti", "fic", "/", "Engine", "erin", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sci", "enti", "fic", "/", "Engine", "erin", "g", " ", "::", " ", "Arti", "ficia", "l", " ", "Intel", "lig", "ence", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Sci", "enti", "fic", "/", "Engine", "erin", "g", " ", "::", " ", "Atm", "osp", "heri", "c", " ", "Sci", "ence", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "files_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "DESCRIPTION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ext", "\\u", "modules_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "find", "\\u", "requirements_", "(_", "'", "require", "ment", "s", ".", "txt", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "wind", "ml_", "._", "\\u\\u", "license\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "DESCRIPTION_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "wind", "ml", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "find", "\\u", "packages_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "package", "\\u", "data_", "=_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "setup", "\\u", "requires_", "=_", "find", "\\u", "requirements_", "(_", "'", "require", "ment", "s", ".", "txt", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "wind", "ml_", "._", "\\u\\u", "url", "\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "2t", "o3", "_", "=_", "(_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "3_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "wind", "ml_", "._", "\\u\\u", "version\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "extract", "\\u", "package", "\\u", "name_", "(_", "requirement_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "requirement_", "._", "req_", ")_", "._", "replace_", "(_", "'-'_", ",_", "'\\u'_", ")_", "._", "split_", "(_", "'=='_", ")_", "[_", "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_", "find", "\\u", "requirements_", "(_", "req", "\\u", "file_", "=_", "'", "require", "ment", "s", ".", "txt", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "extract", "\\u", "package", "\\u", "name_", "(_", "r_", ")_", "for_", "r_", "in_", "parse", "\\u", "requirements_", "(_", "req", "\\u", "file_", ")_", "]_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
openstack/ironic/ironic/drivers/modules/drac/management.py
[ { "content": " @task_manager.require_exclusive_lock\n def set_boot_device(self, task, device, persistent=False):\n \"\"\"Set the boot device for a node.\n\n Set the boot device to use on next reboot of the node.\n\n :param task: a TaskManager instance containing the node to act on.\n :param device: the boot device, one of\n :mod:`ironic.common.boot_devices`.\n :param persistent: Boolean value. True if the boot device will\n persist to all future boots, False if not.\n Default: False.\n :raises: InvalidParameterValue if an invalid boot device is specified.\n \"\"\"\n node = task.node\n\n if device not in _BOOT_DEVICES_MAP:\n raise exception.InvalidParameterValue(\n _(\"set_boot_device called with invalid device '%(device)s' \"\n \"for node %(node_id)s.\") % {'device': device,\n 'node_id': node.uuid})\n\n # NOTE(ifarkas): DRAC interface doesn't allow changing the boot device\n # multiple times in a row without a reboot. This is\n # because a change need to be committed via a\n # configuration job, and further configuration jobs\n # cannot be created until the previous one is processed\n # at the next boot. As a workaround, saving it to\n # driver_internal_info and committing the change during\n # power state change.\n driver_internal_info = node.driver_internal_info\n driver_internal_info['drac_boot_device'] = {'boot_device': device,\n 'persistent': persistent}\n node.driver_internal_info = driver_internal_info\n node.save()", "metadata": "root.DracManagement.set_boot_device", "header": "['class', 'DracManagement', '(', 'base', '.', 'ManagementInterface', ')', ':', '___EOS___']", "index": 172 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Dra", "c", "Manage", "ment_", "(_", "base_", "._", "Manage", "ment", "Interface_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "task", "\\u", "manager_", "._", "require", "\\u", "exclu", "sive", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set\\u", "boot", "\\u", "device_", "(_", "self_", ",_", "task_", ",_", "device_", ",_", "persistent_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "boot", " ", "device", " ", "for", " ", "a", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "the", " ", "boot", " ", "device", " ", "to", " ", "use", " ", "on", " ", "next", " ", "rebo", "ot", " ", "of", " ", "the", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "task", ":", " ", "a", " ", "Task", "Manager", " ", "instance", " ", "contain", "ing", " ", "the", " ", "node", " ", "to", " ", "act", " ", "on", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "device", ":", " ", "the", " ", "boot", " ", "device", ",", " ", "one", " ", "of", "\\", "10", ";", " ", " ", " ", " ", " ", ":", "mod", ":`", "ironic", ".", "common", ".", "boot", "\\u", "device", "s", "`.", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "persiste", "nt", ":", " ", "Boo", "lean", " ", "value", ".", " ", "Tru", "e", " ", "if", " ", "the", " ", "boot", " ", "device", " ", "will", "\\", "10", ";", " ", " ", " ", " ", " ", "persist", " ", "to", " ", "all", " ", "future", " ", "boots", ",", " ", "Fal", "se", " ", "if", " ", "not", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "Default", ":", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Inva", "lid", "Parameter", "Value", " ", "if", " ", "an", " ", "invalid", " ", "boot", " ", "device", " ", "is", " ", "specified", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "task_", "._", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "device_", "not_", "in_", "\\u", "BOOT", "\\u", "DEVICES", "\\u", "MAP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Inva", "lid", "Parameter", "Value_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "set\\u", "boot", "\\u", "device", " ", "call", "ed", " ", "with", " ", "invalid", " ", "device", " ", "'%", "(", "device", ")", "s", "'", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "for", " ", "node", " ", "%", "(", "node", "\\u", "id", ")", "s", ".\"_", ")_", "%_", "{_", "'", "device", "'_", ":_", "device_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "node", "\\u", "id", "'_", ":_", "node_", "._", "uuid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", "(", "ifa", "rk", "as", "):", " ", "DRA", "C", " ", "interface", " ", "doe", "sn", "'", "t", " ", "allow", " ", "chang", "ing", " ", "the", " ", "boot", " ", "device_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "multiple", " ", "times", " ", "in", " ", "a", " ", "row", " ", "with", "out", " ", "a", " ", "rebo", "ot", ".", " ", "Thi", "s", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "bec", "aus", "e", " ", "a", " ", "change", " ", "need", " ", "to", " ", "be", " ", "committ", "ed", " ", "via", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "configura", "tion", " ", "job", ",", " ", "and", " ", "fur", "ther", " ", "configura", "tion", " ", "jobs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "cann", "ot", " ", "be", " ", "created", " ", "unti", "l", " ", "the", " ", "previ", "ous", " ", "one", " ", "is", " ", "processed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "at", " ", "the", " ", "next", " ", "boot", ".", " ", "As", " ", "a", " ", "workar", "ound", ",", " ", "saving", " ", "it", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "driver", "\\u", "internal", "\\u", "info", " ", "and", " ", "committ", "ing", " ", "the", " ", "change", " ", "dur", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "power", " ", "state", " ", "change", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "driver", "\\u", "internal", "\\u", "info_", "=_", "node_", "._", "driver", "\\u", "internal", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "driver", "\\u", "internal", "\\u", "info_", "[_", "'", "drac", "\\u", "boot", "\\u", "device", "'_", "]_", "=_", "{_", "'", "boot", "\\u", "device", "'_", ":_", "device_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "persiste", "nt", "'_", ":_", "persistent_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "driver", "\\u", "internal", "\\u", "info_", "=_", "driver", "\\u", "internal", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "save_", "(_", ")_", "\\u\\u\\uN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 topics and each topic has 3 distinct words.\n # (Each word only belongs to a single topic.)\n n_topics = 3\n block = n_topics * np.ones((3, 3))\n blocks = [block] * n_topics\n X = block_diag(*blocks)\n X = csr_matrix(X)\n return (n_topics, X)", "metadata": "root._build_sparse_mtx", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def test_lda_fit_batch():\n # Test LDA batch learning_offset (`fit` method with 'batch' learning)\n rng = np.random.RandomState(0)\n n_topics, X = _build_sparse_mtx()\n lda = LatentDirichletAllocation(n_topics=n_topics, evaluate_every=1,\n learning_method='batch', random_state=rng)\n lda.fit(X)\n\n correct_idx_grps = [(0, 1, 2), (3, 4, 5), (6, 7, 8)]\n for component in lda.components_:\n # Find top 3 words in each LDA component\n top_idx = set(component.argsort()[-3:][::-1])\n assert_true(tuple(sorted(top_idx)) in correct_idx_grps)", "metadata": "root.test_lda_fit_batch", "header": "['module', '___EOS___']", "index": 46 } ]
[]
[]
0
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "build", "\\u", "spars", "e\\u", "mtx", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "3", " ", "topic", "s", " ", "and", " ", "each", " ", "topic", " ", "has", " ", "3", " ", "distinct", " ", "words", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "Ea", "ch", " ", "word", " ", "only", " ", "belo", "ngs", " ", "to", " ", "a", " ", "single", " ", "topic", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n", "\\u", "topics_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block_", "=_", "n", "\\u", "topics_", "*_", "np_", "._", "ones_", "(_", "(_", "3_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blocks_", "=_", "[_", "block_", "]_", "*_", "n", "\\u", "topics_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "block", "\\u", "diag_", "(_", "*_", "blocks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "csr", "\\u", "matrix_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "n", "\\u", "topics_", ",_", "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_", "def_", "test\\u", "lda", "\\u", "fit", "\\u", "batch_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "LDA", " ", "batch", " ", "learn", "ing", "\\u", "offset", " ", "(", "`", "fit", "`", " ", "method", " ", "with", " ", "'", "batch", "'", " ", "learn", "ing", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rng_", "=_", "np_", "._", "random_", "._", "Random", "State_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "topics_", ",_", "X_", "=_", "\\u", "build", "\\u", "spars", "e\\u", "mtx", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lda", "_", "=_", "Late", "nt", "Dir", "ich", "let", "Allocati", "on_", "(_", "n", "\\u", "topics_", "=_", "n", "\\u", "topics_", ",_", "evaluate", "\\u", "every_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "ing", "\\u", "method_", "=_", "'", "batch", "'_", ",_", "random", "\\u", "state_", "=_", "rng_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lda", "_", "._", "fit_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "correct", "\\u", "idx", "\\u", "grp", "s_", "=_", "[_", "(_", "0_", ",_", "1_", ",_", "2_", ")_", ",_", "(_", "3_", ",_", "4_", ",_", "5_", ")_", ",_", "(_", "6_", ",_", "7_", ",_", "8_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "component_", "in_", "lda", "_", "._", "component", "s\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fin", "d", " ", "top", " ", "3", " ", "words", " ", "in", " ", "each", " ", "LDA", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "top", "\\u", "idx_", "=_", "set_", "(_", "component_", "._", "argsort_", "(_", ")_", "[_", "-_", "3_", ":_", "]_", "[_", ":_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "true_", "(_", "tuple_", "(_", "sorted_", "(_", "top", "\\u", "idx_", ")_", ")_", "in_", "correct", "\\u", "idx", "\\u", "grp", "s_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
enthought/pyface/pyface/ui/qt4/application_window.py
[ { "content": " def _set_window_icon(self):\n if self.icon is None:\n icon = ImageResource('application.png')\n else:\n icon = self.icon\n if self.control is not None:\n self.control.setWindowIcon(icon.create_icon())", "metadata": "root.ApplicationWindow._set_window_icon", "header": "['class', 'ApplicationWindow', '(', 'MApplicationWindow', ',', 'Window', ')', ':', '___EOS___']", "index": 96 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Applica", "tion", "Window_", "(_", "MA", "ppl", "ication", "Window_", ",_", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "window", "\\u", "icon_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "icon_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icon_", "=_", "Image", "Resource_", "(_", "'", "applica", "tion", ".", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icon_", "=_", "self_", "._", "icon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "control_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "control_", "._", "set", "Window", "Icon_", "(_", "icon_", "._", "create", "\\u", "icon_", "(_", ")_", ")_", "\\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 ]
Unused local variable
udibr/sketch/sketch.py
[ { "content": "def main(name, epochs, batch_size, learning_rate,\n dim, mix_dim, old_model_name, max_length, bokeh, GRU, dropout,\n depth, max_grad, step_method, epsilon, sample, skip, uniform, top):\n\n #----------------------------------------------------------------------\n datasource = name\n\n def shnum(x):\n \"\"\" Convert a positive float into a short tag-usable string\n E.g.: 0 -> 0, 0.005 -> 53, 100 -> 1-2\n \"\"\"\n return '0' if x <= 0 else '%s%d' % ((\"%e\"%x)[0], -np.floor(np.log10(x)))\n\n jobname = \"%s-%dX%dm%dd%dr%sb%de%s\" % (datasource, depth, dim, mix_dim,\n int(dropout*10),\n shnum(learning_rate), batch_size,\n shnum(epsilon))\n if max_length != 600:\n jobname += '-L%d'%max_length\n\n if GRU:\n jobname += 'g'\n if max_grad != 5.:\n jobname += 'G%g'%max_grad\n if step_method != 'adam':\n jobname += step_method\n if skip:\n jobname += 'D'\n assert depth > 1\n if top:\n jobname += 'T'\n assert depth > 1\n if uniform > 0.:\n jobname += 'u%d'%int(uniform*100)\n\n if debug:\n jobname += \".debug\"\n\n if sample:\n print(\"Sampling\")\n else:\n print(\"\\nRunning experiment %s\" % jobname)\n if old_model_name:\n print(\"starting from model %s\"%old_model_name)\n\n #----------------------------------------------------------------------\n transitions = [GatedRecurrent(dim=dim) if GRU else LSTM(dim=dim)\n for _ in range(depth)]\n if depth > 1:\n transition = RecurrentStack(transitions, name=\"transition\",\n skip_connections=skip or top)\n if skip:\n source_names=[RecurrentStack.suffix('states', d) for d in range(depth)]\n else:\n source_names=[RecurrentStack.suffix('states', depth-1)]\n else:\n transition = transitions[0]\n transition.name = \"transition\"\n source_names=['states']\n\n emitter = SketchEmitter(mix_dim=mix_dim,\n epsilon=epsilon,\n name=\"emitter\")\n readout = Readout(\n readout_dim=emitter.get_dim('inputs'),\n source_names=source_names,\n emitter=emitter,\n name=\"readout\")\n generator = SequenceGenerator(readout=readout, transition=transition)\n\n # Initialization settings\n if uniform > 0.:\n generator.weights_init = Uniform(width=uniform*2.)\n else:\n generator.weights_init = OrthogonalGlorot()\n generator.biases_init = Constant(0)\n\n # Build the cost computation graph [steps, batch_size, 3]\n x = T.tensor3('features', dtype=floatX)\n if debug:\n x.tag.test_value = np.ones((max_length,batch_size,3)).astype(floatX)\n x = x[:max_length,:,:] # has to be after setting test_value\n cost = generator.cost(x)\n cost.name = \"sequence_log_likelihood\"\n\n # Give an idea of what's going on\n model = Model(cost)\n params = model.get_parameter_dict()\n logger.info(\"Parameters:\\n\" +\n pprint.pformat(\n [(key, value.get_value().shape) for key, value\n in params.items()],\n width=120))\n model_size = 0\n for v in params.itervalues():\n s = v.get_value().shape\n model_size += s[0] * (s[1] if len(s) > 1 else 1)\n logger.info(\"Total number of parameters %d\"%model_size)\n\n #------------------------------------------------------------\n extensions = []\n if old_model_name:\n if old_model_name == 'continue':\n old_model_name = jobname\n with open(old_model_name + '_model', \"rb\") as f:\n old_model = pickle.load(f)\n model.set_parameter_values(old_model.get_parameter_values())\n del old_model\n else:\n # Initialize parameters\n for brick in model.get_top_bricks():\n brick.initialize()\n\n if sample:\n assert old_model_name and old_model_name != 'continue'\n Sample(generator, steps=max_length, path=old_model_name).do(None)\n exit(0)\n\n #------------------------------------------------------------\n # Define the training algorithm.\n cg = ComputationGraph(cost)\n if dropout > 0.:\n from blocks.roles import INPUT, OUTPUT\n dropout_target = VariableFilter(roles=[OUTPUT],\n bricks=transitions,\n name_regex='states')(cg.variables)\n print('# dropout %d' % len(dropout_target))\n cg = apply_dropout(cg, dropout_target, dropout)\n opt_cost = cg.outputs[0]\n else:\n opt_cost = cost\n\n if step_method == 'adam':\n step_rule = Adam(learning_rate)\n elif step_method == 'rmsprop':\n step_rule = RMSProp(learning_rate, decay_rate=0.95)\n elif step_method == 'adagrad':\n step_rule = AdaGrad(learning_rate)\n elif step_method == 'adadelta':\n step_rule = AdaDelta()\n elif step_method == 'scale':\n step_rule = Scale(learning_rate)\n else:\n raise Exception('Unknown sttep method %s'%step_method)\n\n step_rule = CompositeRule([StepClipping(max_grad), step_rule])\n\n algorithm = GradientDescent(\n cost=opt_cost, parameters=cg.parameters,\n step_rule=step_rule)\n\n #------------------------------------------------------------\n observables = [cost]\n\n # Fetch variables useful for debugging\n (energies,) = VariableFilter(\n applications=[generator.readout.readout],\n name_regex=\"output\")(cg.variables)\n min_energy = named_copy(energies.min(), \"min_energy\")\n max_energy = named_copy(energies.max(), \"max_energy\")\n observables += [min_energy, max_energy]\n\n # (activations,) = VariableFilter(\n # applications=[generator.transition.apply],\n # name=generator.transition.apply.states[0])(cg.variables)\n # mean_activation = named_copy(abs(activations).mean(),\n # \"mean_activation\")\n # observables.append(mean_activation)\n\n observables += [algorithm.total_step_norm, algorithm.total_gradient_norm]\n for name, param in params.items():\n observables.append(named_copy(\n param.norm(2), name + \"_norm\"))\n observables.append(named_copy(\n algorithm.gradients[param].norm(2), name + \"_grad_norm\"))\n\n #------------------------------------------------------------\n datasource_fname = os.path.join(fuel.config.data_path, datasource,\n datasource+'.hdf5')\n\n train_ds = H5PYDataset(datasource_fname, #max_length=max_length,\n which_sets=['train'], sources=('features',),\n load_in_memory=True)\n train_stream = DataStream(train_ds,\n iteration_scheme=ShuffledScheme(\n train_ds.num_examples, batch_size))\n\n test_ds = H5PYDataset(datasource_fname, #max_length=max_length,\n which_sets=['test'], sources=('features',),\n load_in_memory=True)\n test_stream = DataStream(test_ds,\n iteration_scheme=SequentialScheme(\n test_ds.num_examples, batch_size))\n\n train_stream = Mapping(train_stream, _transpose)\n test_stream = Mapping(test_stream, _transpose)\n\n def stream_stats(ds, label):\n itr = ds.get_epoch_iterator(as_dict=True)\n batch_count = 0\n examples_count = 0\n for batch in itr:\n batch_count += 1\n examples_count += batch['features'].shape[1]\n print('%s #batch %d #examples %d' %\n (label, batch_count, examples_count))\n\n stream_stats(train_stream, 'train')\n stream_stats(test_stream, 'test')\n\n extensions += [Timing(every_n_batches=10),\n TrainingDataMonitoring(\n observables, prefix=\"train\",\n every_n_batches=10),\n DataStreamMonitoring(\n [cost], # without dropout\n test_stream,\n prefix=\"test\",\n on_resumption=True,\n after_epoch=False, # by default this is True\n every_n_batches=100),\n # all monitored data is ready so print it...\n # (next steps may take more time and we want to see the\n # results as soon as possible so print as soon as you can)\n Printing(every_n_batches=10),\n # perform multiple dumps at different intervals\n # so if one of them breaks (has nan) we can hopefully\n # find a model from few batches ago in the other\n Checkpoint(jobname,\n before_training=False, after_epoch=True,\n save_separately=['log', 'model']),\n Sample(generator, steps=max_length,\n path=jobname+'.test',\n every_n_batches=100),\n ProgressBar(),\n FinishAfter(after_n_epochs=epochs)\n # This shows a way to handle NaN emerging during\n # training: simply finish it.\n .add_condition([\"after_batch\"], _is_nan),\n ]\n\n if bokeh:\n from blocks.extras.extensions.plot import Plot\n extensions.append(Plot(\n 'sketch',\n channels=[['cost']], every_n_batches=10))\n\n # Construct the main loop and start training!\n main_loop = MainLoop(\n model=model,\n data_stream=train_stream,\n algorithm=algorithm,\n extensions=extensions\n )\n\n main_loop.run()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 348 } ]
[]
[]
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_", "(_", "name_", ",_", "epochs_", ",_", "batch", "\\u", "size_", ",_", "learn", "ing", "\\u", "rate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dim_", ",_", "mix", "\\u", "dim_", ",_", "old", "\\u", "model", "\\u", "name_", ",_", "max", "\\u", "length_", ",_", "bokeh", "_", ",_", "GRU", "_", ",_", "dropout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "depth_", ",_", "max", "\\u", "grad_", ",_", "step", "\\u", "method_", ",_", "epsilon_", ",_", "sample_", ",_", "skip_", ",_", "uniform_", ",_", "top_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datasource_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "sh", "num_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Convert", " ", "a", " ", "posit", "ive", " ", "float", " ", "int", "o", " ", "a", " ", "short", " ", "tag", "-", "usable", " ", "string", "\\", "10", ";", " ", " ", " ", " ", " ", "E", ".", "g", ".:", " ", "0", " ", "->", " ", "0", ",", " ", "0.005", " ", "->", " ", "5", "3", ",", " ", "100", " ", "->", " ", "1", "-", "2", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'", "0", "'_", "if_", "x_", "<=_", "0_", "else_", "'%", "s", "%", "d", "'_", "%_", "(_", "(_", "\"%", "e", "\"_", "%_", "x_", ")_", "[_", "0_", "]_", ",_", "-_", "np_", "._", "floor_", "(_", "np_", "._", "log10_", "(_", "x_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "jobn", "ame_", "=_", "\"%", "s", "-%", "d", "X", "%", "dm", "%", "dd", "%", "dr", "%", "sb", "%", "de", "%", "s", "\"_", "%_", "(_", "datasource_", ",_", "depth_", ",_", "dim_", ",_", "mix", "\\u", "dim_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "dropout_", "*_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sh", "num_", "(_", "learn", "ing", "\\u", "rate_", ")_", ",_", "batch", "\\u", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sh", "num_", "(_", "epsilon_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "\\u", "length_", "!=_", "600_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jobn", "ame_", "+=_", "'-", "L", "%", "d", "'_", "%_", "max", "\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "GRU", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jobn", "ame_", "+=_", "'", "g", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "max", "\\u", "grad_", "!=_", "5._", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jobn", "ame_", "+=_", "'", "G", "%", "g", "'_", "%_", "max", "\\u", "grad_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "step", "\\u", "method_", "!=_", "'", "adam", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jobn", "ame_", "+=_", "step", "\\u", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jobn", "ame_", "+=_", "'", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "depth_", ">_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "top_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jobn", "ame_", "+=_", "'", "T", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "depth_", ">_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "uniform_", ">_", "0._", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jobn", "ame_", "+=_", "'", "u", "%", "d", "'_", "%_", "int_", "(_", "uniform_", "*_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jobn", "ame_", "+=_", "\".", "debug", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sample_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Sampl", "ing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "n", "Run", "ning", " ", "experiment", " ", "%", "s", "\"_", "%_", "jobn", "ame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "old", "\\u", "model", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "startin", "g", " ", "from", " ", "model", " ", "%", "s", "\"_", "%_", "old", "\\u", "model", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transitions_", "=_", "[_", "Gat", "ed", "Recurren", "t_", "(_", "dim_", "=_", "dim_", ")_", "if_", "GRU", "_", "else_", "LSTM", "_", "(_", "dim_", "=_", "dim_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "depth_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "depth_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transition_", "=_", "Recurren", "t", "Stack_", "(_", "transitions_", ",_", "name_", "=_", "\"", "transiti", "on", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "skip", "\\u", "connections_", "=_", "skip_", "or_", "top_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "names_", "=_", "[_", "Recurren", "t", "Stack_", "._", "suffix_", "(_", "'", "state", "s", "'_", ",_", "d_", ")_", "for_", "d_", "in_", "range_", "(_", "depth_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "names_", "=_", "[_", "Recurren", "t", "Stack_", "._", "suffix_", "(_", "'", "state", "s", "'_", ",_", "depth_", "-_", "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 ", " _", "transition_", "=_", "transitions_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transition_", "._", "name_", "=_", "\"", "transiti", "on", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "names_", "=_", "[_", "'", "state", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "emitter_", "=_", "Sketch", "Emitte", "r_", "(_", "mix", "\\u", "dim_", "=_", "mix", "\\u", "dim_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "epsilon_", "=_", "epsilon_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "emitte", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "readout", "_", "=_", "Read", "out_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "readout", "\\u", "dim_", "=_", "emitter_", "._", "get", "\\u", "dim_", "(_", "'", "inputs", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "names_", "=_", "source", "\\u", "names_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "emitter_", "=_", "emitter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "readout", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generator_", "=_", "Sequ", "ence", "Generator_", "(_", "readout", "_", "=_", "readout", "_", ",_", "transition_", "=_", "transition_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "ation", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "uniform_", ">_", "0._", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "generator_", "._", "weight", "s", "\\u", "init_", "=_", "Uniform", "_", "(_", "width_", "=_", "uniform_", "*_", "2._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "generator_", "._", "weight", "s", "\\u", "init_", "=_", "Ortho", "gon", "al", "Glo", "rot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "generator_", "._", "bias", "es", "\\u", "init_", "=_", "Constant_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "the", " ", "cost", " ", "computation", " ", "graph", " ", "[", "step", "s", ",", " ", "batch", "\\u", "size", ",", " ", "3", "]_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "T_", "._", "tensor", "3_", "(_", "'", "features", "'_", ",_", "dtype_", "=_", "float", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "._", "tag_", "._", "test\\u", "value_", "=_", "np_", "._", "ones_", "(_", "(_", "max", "\\u", "length_", ",_", "batch", "\\u", "size_", ",_", "3_", ")_", ")_", "._", "astype_", "(_", "float", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", "=_", "x_", "[_", ":_", "max", "\\u", "length_", ",_", ":_", ",_", ":_", "]_", "#", " ", "has", " ", "to", " ", "be", " ", "after", " ", "setti", "ng", " ", "test\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cost_", "=_", "generator_", "._", "cost_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cost_", "._", "name_", "=_", "\"", "sequence", "\\u", "log", "\\u", "likelihood", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Give", " ", "an", " ", "idea", " ", "of", " ", "what", "'", "s", " ", "goi", "ng", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "Model_", "(_", "cost_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "model_", "._", "get", "\\u", "parameter", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Parameter", "s", ":\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "pprint_", "._", "pformat_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "key_", ",_", "value_", "._", "get", "\\u", "value_", "(_", ")_", "._", "shape_", ")_", "for_", "key_", ",_", "value_", "\\u\\u\\uNL\\u\\u\\u_", "in_", "params_", "._", "items_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "width_", "=_", "120_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "size_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "params_", "._", "itervalues_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "v_", "._", "get", "\\u", "value_", "(_", ")_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "size_", "+=_", "s_", "[_", "0_", "]_", "*_", "(_", "s_", "[_", "1_", "]_", "if_", "len_", "(_", "s_", ")_", ">_", "1_", "else_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "Total", " ", "number", " ", "of", " ", "parameter", "s", " ", "%", "d", "\"_", "%_", "model", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "model", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old", "\\u", "model", "\\u", "name_", "==_", "'", "continue", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "model", "\\u", "name_", "=_", "jobn", "ame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "old", "\\u", "model", "\\u", "name_", "+_", "'\\u", "model", "'_", ",_", "\"", "rb", "\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "model_", "=_", "pickle_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model_", "._", "set\\u", "parameter", "\\u", "values_", "(_", "old", "\\u", "model_", "._", "get", "\\u", "parameter", "\\u", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "old", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "brick_", "in_", "model_", "._", "get", "\\u", "top", "\\u", "bricks", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "brick_", "._", "initialize_", "(_", ")_", "\\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_", "sample_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "old", "\\u", "model", "\\u", "name_", "and_", "old", "\\u", "model", "\\u", "name_", "!=_", "'", "continue", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sample_", "(_", "generator_", ",_", "steps_", "=_", "max", "\\u", "length_", ",_", "path_", "=_", "old", "\\u", "model", "\\u", "name_", ")_", "._", "do_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "the", " ", "train", "ing", " ", "algo", "rit", "hm", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cg_", "=_", "Computation", "Graph_", "(_", "cost_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dropout_", ">_", "0._", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "blocks_", "._", "roles_", "import_", "INPUT_", ",_", "OUTPUT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drop", "out", "\\u", "target_", "=_", "Varia", "ble", "Filter_", "(_", "roles_", "=_", "[_", "OUTPUT_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bricks", "_", "=_", "transitions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name", "\\u", "regex_", "=_", "'", "state", "s", "'_", ")_", "(_", "cg_", "._", "variables_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'#", " ", "drop", "out", " ", "%", "d", "'_", "%_", "len_", "(_", "drop", "out", "\\u", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cg_", "=_", "appl", "y", "\\u", "dropout_", "(_", "cg_", ",_", "drop", "out", "\\u", "target_", ",_", "dropout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "\\u", "cost_", "=_", "cg_", "._", "outputs_", "[_", "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 ", " _", "opt", "\\u", "cost_", "=_", "cost_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "step", "\\u", "method_", "==_", "'", "adam", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "\\u", "rule_", "=_", "Adam", "_", "(_", "learn", "ing", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "step", "\\u", "method_", "==_", "'", "rms", "prop", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "\\u", "rule_", "=_", "RMS", "Prop_", "(_", "learn", "ing", "\\u", "rate_", ",_", "deca", "y", "\\u", "rate_", "=_", "0.95_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "step", "\\u", "method_", "==_", "'", "ada", "grad", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "\\u", "rule_", "=_", "Ada", "Grad", "_", "(_", "learn", "ing", "\\u", "rate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "step", "\\u", "method_", "==_", "'", "ada", "delta", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "\\u", "rule_", "=_", "Ada", "Delta_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "step", "\\u", "method_", "==_", "'", "scale", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "step", "\\u", "rule_", "=_", "Scale_", "(_", "learn", "ing", "\\u", "rate_", ")_", "\\u\\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", " ", "stt", "ep", " ", "method", " ", "%", "s", "'_", "%_", "step", "\\u", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "step", "\\u", "rule_", "=_", "Composit", "e", "Rule_", "(_", "[_", "Step", "Clip", "ping_", "(_", "max", "\\u", "grad_", ")_", ",_", "step", "\\u", "rule_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "algorithm_", "=_", "Grad", "ient", "Descen", "t_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cost_", "=_", "opt", "\\u", "cost_", ",_", "parameters_", "=_", "cg_", "._", "parameters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "step", "\\u", "rule_", "=_", "step", "\\u", "rule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "observable", "s_", "=_", "[_", "cost_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fe", "tch", " ", "variab", "les", " ", "usef", "ul", " ", "for", " ", "debugg", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "energies_", ",_", ")_", "=_", "Varia", "ble", "Filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "applications_", "=_", "[_", "generator_", "._", "readout", "_", "._", "readout", "_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name", "\\u", "regex_", "=_", "\"", "output", "\"_", ")_", "(_", "cg_", "._", "variables_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "energy_", "=_", "named", "\\u", "copy_", "(_", "energies_", "._", "min_", "(_", ")_", ",_", "\"", "min", "\\u", "energ", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "energy_", "=_", "named", "\\u", "copy_", "(_", "energies_", "._", "max_", "(_", ")_", ",_", "\"", "max", "\\u", "energ", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "observable", "s_", "+=_", "[_", "min", "\\u", "energy_", ",_", "max", "\\u", "energy_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "activation", "s", ",)", " ", "=", " ", "Varia", "ble", "Filter", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "applica", "tion", "s", "=[", "generat", "or", ".", "transiti", "on", ".", "appl", "y", "],", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "name", "=", "generat", "or", ".", "transiti", "on", ".", "appl", "y", ".", "state", "s", "[", "0", "])(", "cg", ".", "variab", "les", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mean", "\\u", "activation", " ", "=", " ", "named", "\\u", "copy", "(", "abs", "(", "activation", "s", ").", "mean", "()", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "mean", "\\u", "activation", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "observable", "s", ".", "append", "(", "mean", "\\u", "activation", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "observable", "s_", "+=_", "[_", "algorithm_", "._", "total", "\\u", "step", "\\u", "norm_", ",_", "algorithm_", "._", "total", "\\u", "gradi", "ent", "\\u", "norm_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "param_", "in_", "params_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "observable", "s_", "._", "append_", "(_", "named", "\\u", "copy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "param_", "._", "norm_", "(_", "2_", ")_", ",_", "name_", "+_", "\"\\u", "norm", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "observable", "s_", "._", "append_", "(_", "named", "\\u", "copy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "algorithm_", "._", "gradients_", "[_", "param_", "]_", "._", "norm_", "(_", "2_", ")_", ",_", "name_", "+_", "\"\\u", "grad", "\\u", "norm", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "datas", "ource", "\\u", "fname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "fuel", "_", "._", "config_", "._", "data\\u", "path_", ",_", "datasource_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datasource_", "+_", "'.", "hdf5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "ds_", "=_", "H", "5", "PY", "Dataset_", "(_", "datas", "ource", "\\u", "fname_", ",_", "#", "max", "\\u", "length", "=", "max", "\\u", "length", ",_", "\\u\\u\\uNL\\u\\u\\u_", "whi", "ch", "\\u", "sets_", "=_", "[_", "'", "train", "'_", "]_", ",_", "sources_", "=_", "(_", "'", "features", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "in", "\\u", "memory_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "stream_", "=_", "Data", "Stream_", "(_", "train", "\\u", "ds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iterati", "on", "\\u", "scheme_", "=_", "Shuffle", "d", "Scheme_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "ds_", "._", "num", "\\u", "examples_", ",_", "batch", "\\u", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "ds_", "=_", "H", "5", "PY", "Dataset_", "(_", "datas", "ource", "\\u", "fname_", ",_", "#", "max", "\\u", "length", "=", "max", "\\u", "length", ",_", "\\u\\u\\uNL\\u\\u\\u_", "whi", "ch", "\\u", "sets_", "=_", "[_", "'", "test", "'_", "]_", ",_", "sources_", "=_", "(_", "'", "features", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "load", "\\u", "in", "\\u", "memory_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "stream_", "=_", "Data", "Stream_", "(_", "test\\u", "ds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "iterati", "on", "\\u", "scheme_", "=_", "Sequ", "ential", "Scheme_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "ds_", "._", "num", "\\u", "examples_", ",_", "batch", "\\u", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "stream_", "=_", "Mapping_", "(_", "train", "\\u", "stream_", ",_", "\\u", "transpose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "stream_", "=_", "Mapping_", "(_", "test\\u", "stream_", ",_", "\\u", "transpose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "stream", "\\u", "stats_", "(_", "ds_", ",_", "label_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "itr_", "=_", "ds_", "._", "get", "\\u", "epoch", "\\u", "iterator_", "(_", "as", "\\u", "dict_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "example", "s", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "batch_", "in_", "itr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "batch", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "example", "s", "\\u", "count_", "+=_", "batch_", "[_", "'", "features", "'_", "]_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'%", "s", " ", "#", "batch", " ", "%", "d", " ", "#", "example", "s", " ", "%", "d", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "label_", ",_", "batch", "\\u", "count_", ",_", "example", "s", "\\u", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stream", "\\u", "stats_", "(_", "train", "\\u", "stream_", ",_", "'", "train", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream", "\\u", "stats_", "(_", "test\\u", "stream_", ",_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "+=_", "[_", "Tim", "ing_", "(_", "every", "\\u", "n", "\\u", "batches_", "=_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Train", "ing", "Data", "Monitor", "ing_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "observable", "s_", ",_", "prefix_", "=_", "\"", "train", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "every", "\\u", "n", "\\u", "batches_", "=_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Data", "Stream", "Monitor", "ing_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "cost_", "]_", ",_", "#", " ", "with", "out", " ", "dropout_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "stream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "\"", "test", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "resum", "ption_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "after", "\\u", "epoch_", "=_", "False_", ",_", "#", " ", "by", " ", "default", " ", "this", " ", "is", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "every", "\\u", "n", "\\u", "batches_", "=_", "100_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "monitored", " ", "data", " ", "is", " ", "read", "y", " ", "so", " ", "print", " ", "it", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "next", " ", "step", "s", " ", "may", " ", "take", " ", "more", " ", "time", " ", "and", " ", "we", " ", "want", " ", "to", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "results", " ", "as", " ", "soo", "n", " ", "as", " ", "possib", "le", " ", "so", " ", "print", " ", "as", " ", "soo", "n", " ", "as", " ", "you", " ", "can", ")_", "\\u\\u\\uNL\\u\\u\\u_", "Printing", "_", "(_", "every", "\\u", "n", "\\u", "batches_", "=_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "perform", " ", "multiple", " ", "dump", "s", " ", "at", " ", "different", " ", "intervals_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "if", " ", "one", " ", "of", " ", "them", " ", "breaks", " ", "(", "has", " ", "nan", ")", " ", "we", " ", "can", " ", "hop", "efu", "ll", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "a", " ", "model", " ", "from", " ", "few", " ", "batche", "s", " ", "ago", " ", "in", " ", "the", " ", "other_", "\\u\\u\\uNL\\u\\u\\u_", "Checkpoint", "_", "(_", "jobn", "ame_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bef", "ore", "\\u", "training_", "=_", "False_", ",_", "after", "\\u", "epoch_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "save", "\\u", "separately", "_", "=_", "[_", "'", "log", "'_", ",_", "'", "model", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sample_", "(_", "generator_", ",_", "steps_", "=_", "max", "\\u", "length_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "jobn", "ame_", "+_", "'.", "test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "every", "\\u", "n", "\\u", "batches_", "=_", "100_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Progres", "s", "Bar_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Finish", "After_", "(_", "after", "\\u", "n", "\\u", "epochs_", "=_", "epochs_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "show", "s", " ", "a", " ", "way", " ", "to", " ", "handle", " ", "Na", "N", " ", "emerg", "ing", " ", "dur", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "train", "ing", ":", " ", "simp", "ly", " ", "finish", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "._", "add", "\\u", "condition_", "(_", "[_", "\"", "after", "\\u", "batch", "\"_", "]_", ",_", "\\u", "is", "\\u", "nan_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bokeh", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "blocks_", "._", "extras_", "._", "extensions_", "._", "plot_", "import_", "Plot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extensions_", "._", "append_", "(_", "Plot_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sketch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "channels_", "=_", "[_", "[_", "'", "cost", "'_", "]_", "]_", ",_", "every", "\\u", "n", "\\u", "batches_", "=_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Construct", " ", "the", " ", "main", " ", "loop", " ", "and", " ", "start", " ", "train", "ing", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "main", "\\u", "loop_", "=_", "Main", "Loop_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "=_", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "stream_", "=_", "train", "\\u", "stream_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "algorithm_", "=_", "algorithm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "main", "\\u", "loop_", "._", "run_", "(_", ")_", "\\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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
cloudera/hue/desktop/libs/liboozie/src/liboozie/submission2.py
[ { "content": " def _is_workflow(self):\n from oozie.models2 import Workflow\n return Workflow.PROPERTY_APP_PATH in self.properties", "metadata": "root.Submission._is_workflow", "header": "['class', 'Submission', '(', 'object', ')', ':', '___EOS___']", "index": 347 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Submission_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "is", "\\u", "workflow_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "oozie", "_", "._", "model", "s2_", "import_", "Workflow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Workflow_", "._", "PROPERTY", "\\u", "APP", "\\u", "PATH_", "in_", "self_", "._", "properties_", "\\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 ]
Unused local variable
RetroMelon/PatchWords/patchwords_project/patchwords/duncansforms.py
[ { "content": "class NewParagraph(forms.ModelForm):\n content = forms.CharField(max_length=200, help_text=\"Write your paragraph!\")\n choices = (\n (True, 'yes'),\n (False, 'no'))\n end = forms.ChoiceField(choices=choices, widget=forms.RadioSelect)\n\n class Meta:\n model = Paragraph\n exclude = ('story', 'parent', 'author','created_datetime')", "metadata": "root.NewParagraph", "header": "['module', '___EOS___']", "index": 5 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "New", "Paragraph_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "forms_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "200_", ",_", "help", "\\u", "text_", "=_", "\"", "Write", " ", "your", " ", "paragraph", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choices_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "True_", ",_", "'", "ye", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "False_", ",_", "'", "no", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "forms_", "._", "Choi", "ce", "Field_", "(_", "choices_", "=_", "choices_", ",_", "widget_", "=_", "forms_", "._", "Radio", "Select_", ")_", "\\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 ", " _", "model_", "=_", "Paragraph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclude_", "=_", "(_", "'", "stor", "y", "'_", ",_", "'", "parent", "'_", ",_", "'", "author", "'_", ",_", "'", "created", "\\u", "datetime", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
Cysu/dlearn/docs/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# dlearn documentation build configuration file, created by\n# sphinx-quickstart on Thu Apr 3 15:41:15 2014.\n#\n# This file is execfile()d with the current directory set to its\n# containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys\nimport os\nimport mock\n\n# Mock some third-party modules\nmock_modules = ['numpy', 'theano', 'theano.tensor',\n 'matplotlib', 'matplotlib.pyplot', 'mpl_toolkits.axes_grid1',\n 'skimage', 'skimage.transform', 'skimage.color',\n 'sklearn', 'sklearn.preprocessing']\n\nfor m in mock_modules:\n sys.modules[m] = mock.Mock()\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\nsys.path.insert(0, os.path.abspath('..'))\n\n# -- General configuration ------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n 'sphinx.ext.autodoc',\n 'sphinx.ext.coverage',\n 'sphinx.ext.mathjax',\n 'sphinxcontrib.napoleon'\n]\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The encoding of source files.\n#source_encoding = 'utf-8-sig'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = u'dlearn'\ncopyright = u'2014, Tong Xiao'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = 'dev'\n# The full version, including alpha/beta/rc tags.\nrelease = 'dev'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\nexclude_patterns = ['_build']\n\n# The reST default role (used for this markup: `text`) to use for all\n# documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n# If true, keep warnings as \"system message\" paragraphs in the built documents.\n#keep_warnings = False\n\n\n# -- Options for HTML output ----------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\nhtml_theme = 'default'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# Add any extra paths that contain custom files (such as robots.txt or\n# .htaccess) here, relative to this directory. These files are copied\n# directly to the root of the documentation.\n#html_extra_path = []\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_domain_indices = True\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, links to the reST sources are added to the pages.\n#html_show_sourcelink = True\n\n# If true, \"Created using Sphinx\" is shown in the HTML footer. Default is True.\n#html_show_sphinx = True\n\n# If true, \"(C) Copyright ...\" is shown in the HTML footer. Default is True.\n#html_show_copyright = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# This is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = None\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'dlearndoc'\n\n\n# -- Options for LaTeX output ---------------------------------------------\n\nlatex_elements = {\n # The paper size ('letterpaper' or 'a4paper').\n #'papersize': 'letterpaper',\n\n # The font size ('10pt', '11pt' or '12pt').\n #'pointsize': '10pt',\n\n # Additional stuff for the LaTeX preamble.\n #'preamble': '',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n# author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n ('index', 'dlearn.tex', u'dlearn Documentation',\n u'Tong Xiao', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# If true, show page references after internal links.\n#latex_show_pagerefs = False\n\n# If true, show URL addresses after external links.\n#latex_show_urls = False\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\n#latex_domain_indices = True\n\n\n# -- Options for manual page output ---------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n ('index', 'dlearn', u'dlearn Documentation',\n [u'Tong Xiao'], 1)\n]\n\n# If true, show URL addresses after external links.\n#man_show_urls = False\n\n\n# -- Options for Texinfo output -------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n ('index', 'dlearn', u'dlearn Documentation', u'Tong Xiao',\n 'dlearn', 'One line description of project.', 'Miscellaneous')\n]\n\n# Documents to append as an appendix to all manuals.\n#texinfo_appendices = []\n\n# If false, no module index is generated.\n#texinfo_domain_indices = True\n\n# How to display URL addresses: 'footnote', 'no', or 'inline'.\n#texinfo_show_urls = 'footnote'\n\n# If true, do not generate a @detailmenu in the \"Top\" node's menu.\n#texinfo_no_detailmenu = False\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
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_", "#", " ", "dle", "arn", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Thu", " ", "Ap", "r", " ", " ", "3", " ", "15", ":", "4", "1", ":", "15", " ", "2014", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Moc", "k", " ", "some", " ", "third", "-", "part", "y", " ", "modules_", "\\u\\u\\uNL\\u\\u\\u_", "mock", "\\u", "modules_", "=_", "[_", "'", "nump", "y", "'_", ",_", "'", "theano", "'_", ",_", "'", "theano", ".", "tensor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mat", "plotlib", "'_", ",_", "'", "mat", "plotlib", ".", "pypl", "ot", "'_", ",_", "'", "mpl", "\\u", "tool", "kit", "s", ".", "axes", "\\u", "grid", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ski", "mage", "'_", ",_", "'", "ski", "mage", ".", "transform", "'_", ",_", "'", "ski", "mage", ".", "color", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "skl", "earn", "'_", ",_", "'", "skl", "earn", ".", "preproc", "essi", "ng", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "m_", "in_", "mock", "\\u", "modules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "modules_", "[_", "m_", "]_", "=_", "mock_", "._", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "os_", "._", "path_", "._", "abspath_", "(_", "'..'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "documentation", " ", "need", "s", " ", "a", " ", "minima", "l", " ", "Sph", "inx", " ", "version", ",", " ", "state", " ", "it", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "need", "s", "\\u", "sphinx", " ", "=", " ", "'", "1.0", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extensi", "ons", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sphinx", ".", "ext", ".", "autod", "oc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sphinx", ".", "ext", ".", "covera", "ge", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sphinx", ".", "ext", ".", "math", "jax", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sphinx", "contrib", ".", "napoleon", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "encoding", " ", "of", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "source", "\\u", "encoding", " ", "=", " ", "'", "utf", "-", "8", "-", "sig", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "u", "'", "dle", "arn", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "2014", ",", " ", "Ton", "g", " ", "Xia", "o", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "dev", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "'", "dev", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "pattern", "s", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "y", ",", " ", "tha", "t", " ", "match", " ", "files", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "director", "ies", " ", "to", " ", "ignore", " ", "whe", "n", " ", "look", "ing", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "exclu", "de", "\\u", "patterns_", "=_", "[_", "'\\u", "build", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "keep", " ", "warn", "ings", " ", "as", " ", "\"", "system", " ", "message", "\"", " ", "paragraph", "s", " ", "in", " ", "the", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "keep", "\\u", "warn", "ings", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output", " ", "--------------", "--------------", "--------------", "----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "them", "e", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", " ", "See", " ", "the", " ", "documentation", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "list", " ", "of", " ", "bui", "lti", "n", " ", "themes", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "extra", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "robots", ".", "txt", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", ".", "hta", "ccess", ")", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "se", " ", "files", " ", "are", " ", "copied_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "direct", "ly", " ", "to", " ", "the", " ", "root", " ", "of", " ", "the", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "extra", "\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"", "Creat", "ed", " ", "usi", "ng", " ", "Sph", "inx", "\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "sphinx", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "\"(", "C", ")", " ", "Copy", "right", " ", "...\"", " ", "is", " ", "shown", " ", "in", " ", "the", " ", "HTM", "L", " ", "footer", ".", " ", "Default", " ", "is", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "copyr", "ight", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "dle", "arn", "doc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output", " ", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "elements_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "pape", "r", "'", " ", "or", " ", "'", "a4", "pape", "r", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "papers", "ize", "':", " ", "'", "letter", "pape", "r", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "points", "ize", "':", " ", "'", "10", "pt", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#'", "preamble", "':", " ", "''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", ",", " ", "manu", "al", ",", " ", "or", " ", "own", " ", "class", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "dle", "arn", ".", "tex", "'_", ",_", "u", "'", "dle", "arn", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Ton", "g", " ", "Xia", "o", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "page", " ", "reference", "s", " ", "after", " ", "internal", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "pager", "ef", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "manu", "al", " ", "page", " ", "output", " ", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "One", " ", "entry", " ", "per", " ", "manu", "al", " ", "page", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "name", ",", " ", "description", ",", " ", "author", "s", ",", " ", "manu", "al", " ", "section", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "man", "\\u", "pages_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "dle", "arn", "'_", ",_", "u", "'", "dle", "arn", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "u", "'", "Ton", "g", " ", "Xia", "o", "'_", "]_", ",_", "1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "show", " ", "URL", " ", "addresse", "s", " ", "after", " ", "external", " ", "link", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "man", "\\u", "show", "\\u", "urls", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "Optio", "ns", " ", "for", " ", "Tex", "info", " ", "output", " ", "--------------", "--------------", "--------------", "-_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "Tex", "info", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "dir", " ", "menu", " ", "entry", ",", " ", "description", ",", " ", "category", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tex", "info", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "dle", "arn", "'_", ",_", "u", "'", "dle", "arn", " ", "Document", "ation", "'_", ",_", "u", "'", "Ton", "g", " ", "Xia", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dle", "arn", "'_", ",_", "'", "One", " ", "line", " ", "description", " ", "of", " ", "project", ".'_", ",_", "'", "Mis", "cell", "ane", "ous", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "domain", "\\u", "indice", "s", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "w", " ", "to", " ", "display", " ", "URL", " ", "addresse", "s", ":", " ", "'", "footnote", "',", " ", "'", "no", "',", " ", "or", " ", "'", "inline", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "show", "\\u", "urls", " ", "=", " ", "'", "footnote", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "do", " ", "not", " ", "generat", "e", " ", "a", " ", "@", "deta", "il", "menu", " ", "in", " ", "the", " ", "\"", "Top", "\"", " ", "node", "'", "s", " ", "menu", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "tex", "info", "\\u", "no", "\\u", "deta", "il", "menu", " ", "=", " ", "False_", "\\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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[sys.executable, filename]\n log.write(\" | Running %s, content below\\n\" % \" \".join(cmd))\n log.writelines([\" | | %s\\n\" % line for line in code.splitlines()])\n\n fp = open(filename, \"wt\")\n try:\n fp.write(code)\n finally:\n fp.close()\n\n buf = BytesIO()\n st = logged_run(cmd, buf)\n\n # FIXME: handle this correctly\n log.write(\" | return of the command is %d and output is\\n\" % st)\n val = buf.getvalue()\n if val:\n log.writelines([\" | | %s\\n\" % line for line in val.splitlines()])\n log.write(\"\\n\")\n else:\n log.write(\" | (None)\\n\")\n log.write(\"\\n\")\n return st == 0\n finally:\n shutil.rmtree(d)", "metadata": "root._test", "header": "['module', '___EOS___']", "index": 212 } ]
[]
[]
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", "test_", "(_", "code_", ",_", "setup", "\\u", "py_", ",_", "show", "\\u", "output_", ",_", "log_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "op_", "._", "join_", "(_", "d_", ",_", "\"", "setup", ".", "py", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "sys_", "._", "executable_", ",_", "filename_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "write_", "(_", "\"", " ", "|", " ", "Run", "ning", " ", "%", "s", ",", " ", "content", " ", "belo", "w", "\\\\", "n", "\"_", "%_", "\"", " ", "\"_", "._", "join_", "(_", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "writelines_", "(_", "[_", "\"", " ", "|", " ", "|", " ", "%", "s", "\\\\", "n", "\"_", "%_", "line_", "for_", "line_", "in_", "code_", "._", "splitlines_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fp_", "=_", "open_", "(_", "filename_", ",_", "\"", "wt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fp_", "._", "write_", "(_", "code_", ")_", "\\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 ", " _", "fp_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buf_", "=_", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "st_", "=_", "logged", "\\u", "run_", "(_", "cmd_", ",_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "handle", " ", "this", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "write_", "(_", "\"", " ", "|", " ", "return", " ", "of", " ", "the", " ", "command", " ", "is", " ", "%", "d", " ", "and", " ", "output", " ", "is", "\\\\", "n", "\"_", "%_", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "buf_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "writelines_", "(_", "[_", "\"", " ", "|", " ", "|", " ", "%", "s", "\\\\", "n", "\"_", "%_", "line_", "for_", "line_", "in_", "val_", "._", "splitlines_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "write_", "(_", "\"\\\\", "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 ", " _", "log_", "._", "write_", "(_", "\"", " ", "|", " ", "(", "Non", "e", ")\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "write_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "st_", "==_", "0_", "\\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 ", " _", "shutil_", "._", "rmtree_", "(_", "d_", ")_", "\\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 ]
NotImplemented is not an Exception
hyperopt/hyperopt/hyperopt/utils.py
[ { "content": "def json_call(json, args=(), kwargs=None):\n \"\"\"\n Return a dataset class instance based on a string, tuple or dictionary\n\n .. code-block:: python\n\n iris = json_call('datasets.toy.Iris')\n\n This function works by parsing the string, and calling import and getattr a\n lot. (XXX)\n\n \"\"\"\n if kwargs is None:\n kwargs = {}\n if isinstance(json, basestring):\n symbol = json_lookup(json)\n return symbol(*args, **kwargs)\n elif isinstance(json, dict):\n raise NotImplementedError('dict calling convention undefined', json)\n elif isinstance(json, (tuple, list)):\n raise NotImplementedError('seq calling convention undefined', json)\n else:\n raise TypeError(json)", "metadata": "root.json_call", "header": "['module', '___EOS___']", "index": 43 } ]
[]
[]
0
true
[ "[CLS]_", "Not", "Implemented_", "is_", "not_", "an_", "Exception_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "json", "\\u", "call_", "(_", "json_", ",_", "args_", "=_", "(_", ")_", ",_", "kwargs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "dataset", " ", "class", " ", "instance", " ", "based", " ", "on", " ", "a", " ", "string", ",", " ", "tuple", " ", "or", " ", "dictionar", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "iri", "s", " ", "=", " ", "json", "\\u", "call", "('", "dataset", "s", ".", "toy", ".", "Ir", "is", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "works", " ", "by", " ", "pars", "ing", " ", "the", " ", "string", ",", " ", "and", " ", "calling", " ", "import", " ", "and", " ", "getattr", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "lot", ".", " ", "(", "XX", "X", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kwargs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "json_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symbol_", "=_", "json", "\\u", "lookup_", "(_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "symbol_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "json_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "dict", " ", "calling", " ", "convention", " ", "undefined", "'_", ",_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "json_", ",_", "(_", "tuple_", ",_", "list_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "seq", " ", "calling", " ", "convention", " ", "undefined", "'_", ",_", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "json_", ")_", "\\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 ]
Implicit string concatenation in a list
tanghaibao/jcvi/assembly/pbjelly.py
[ { "content": "def patch(args):\n \"\"\"\n %prog patch reference.fasta reads.fasta\n\n Run PBJelly with reference and reads.\n \"\"\"\n from jcvi.formats.base import write_file\n from jcvi.formats.fasta import format\n\n p = OptionParser(patch.__doc__)\n p.add_option(\"--cleanfasta\", default=False, action=\"store_true\",\n help=\"Clean FASTA to remove description [default: %default]\")\n p.add_option(\"--highqual\", default=False, action=\"store_true\",\n help=\"Reads are of high quality [default: %default]\")\n p.set_home(\"pbjelly\")\n p.set_cpus()\n opts, args = p.parse_args(args)\n\n if len(args) != 2:\n sys.exit(not p.print_help())\n\n ref, reads = args\n cpus = opts.cpus\n cmd = op.join(opts.pbjelly_home, \"setup.sh\")\n setup = \"source {0}\".format(cmd)\n if not which(\"fakeQuals.py\"):\n sh(setup)\n\n pf = ref.rsplit(\".\", 1)[0]\n pr, px = reads.rsplit(\".\", 1)\n # Remove description line\n if opts.cleanfasta:\n oref = pf + \".f.fasta\"\n oreads = pr + \".f.fasta\"\n format([ref, oref])\n format([reads, oreads])\n ref, reads = oref, oreads\n\n # Check if the FASTA has qual\n ref, refq = fake_quals(ref)\n convert_reads = not px in (\"fq\", \"fastq\", \"txt\")\n if convert_reads:\n reads, readsq = fake_quals(reads)\n readsfiles = \" \".join((reads, readsq))\n else:\n readsfiles = reads\n\n # Make directory structure\n dref, dreads = \"data/reference\", \"data/reads\"\n cwd = os.getcwd()\n reference = op.join(cwd, \"{0}/{1}\".format(dref, ref))\n reads = op.join(cwd, \"{0}/{1}\".format(dreads, reads))\n if not op.exists(reference):\n sh(\"mkdir -p {0}\".format(dref))\n sh(\"cp {0} {1}/\".format(\" \".join((ref, refq)), dref))\n if not op.exists(reads):\n sh(\"mkdir -p {0}\".format(dreads))\n sh(\"cp {0} {1}/\".format(readsfiles, dreads))\n\n outputDir = cwd\n p = Protocol(outputDir, reference, reads, highqual=opts.highqual)\n p.write_xml()\n\n # Build the pipeline\n runsh = [setup]\n for action in \"setup|mapping|support|extraction\".split(\"|\"):\n runsh.append(\"Jelly.py {0} Protocol.xml\".format(action))\n\n runsh.append('Jelly.py assembly Protocol.xml -x \"--nproc={0}\"'.format(cpus))\n runsh.append(\"Jelly.py output Protocol.xml\")\n\n runfile = \"run.sh\"\n contents = \"\\n\".join(runsh)\n write_file(runfile, contents)", "metadata": "root.patch", "header": "['module', '___EOS___']", "index": 170 } ]
[]
[]
0
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "patch_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "%", "prog", " ", "patch", " ", "reference", ".", "fasta", " ", "reads", ".", "fasta", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "PB", "Je", "ll", "y", " ", "with", " ", "reference", " ", "and", " ", "reads", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "jc", "vi_", "._", "formats_", "._", "base_", "import_", "write", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "jc", "vi_", "._", "formats_", "._", "fasta_", "import_", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "Optio", "n", "Parser_", "(_", "patch_", "._", "\\u\\u", "doc\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "add", "\\u", "option_", "(_", "\"--", "clean", "fasta", "\"_", ",_", "default_", "=_", "False_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Clean", " ", "FAST", "A", " ", "to", " ", "remove", " ", "description", " ", "[", "default", ":", " ", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "add", "\\u", "option_", "(_", "\"--", "high", "qual", "\"_", ",_", "default_", "=_", "False_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"", "Read", "s", " ", "are", " ", "of", " ", "high", " ", "quali", "ty", " ", "[", "default", ":", " ", "%", "default", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "set\\u", "home_", "(_", "\"", "pb", "jel", "ly", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "set\\u", "cpus_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", ",_", "args_", "=_", "p_", "._", "parse", "\\u", "args_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "not_", "p_", "._", "print", "\\u", "help_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ref_", ",_", "reads_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpus_", "=_", "opts_", "._", "cpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "op_", "._", "join_", "(_", "opts_", "._", "pb", "jel", "ly", "\\u", "home_", ",_", "\"", "setup", ".", "sh", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setup_", "=_", "\"", "source", " ", "{", "0", "}\"_", "._", "format_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "which_", "(_", "\"", "fake", "Qual", "s", ".", "py", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sh_", "(_", "setup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pf_", "=_", "ref_", "._", "rsplit_", "(_", "\".\"_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pr_", ",_", "px_", "=_", "reads_", "._", "rsplit_", "(_", "\".\"_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "description", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "opts_", "._", "clean", "fasta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ore", "f_", "=_", "pf_", "+_", "\".", "f", ".", "fasta", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ore", "ads_", "=_", "pr_", "+_", "\".", "f", ".", "fasta", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format_", "(_", "[_", "ref_", ",_", "ore", "f_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format_", "(_", "[_", "reads_", ",_", "ore", "ads_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref_", ",_", "reads_", "=_", "ore", "f_", ",_", "ore", "ads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "FAST", "A", " ", "has", " ", "qual_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ref_", ",_", "ref", "q_", "=_", "fake", "\\u", "qual", "s_", "(_", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "convert", "\\u", "reads_", "=_", "not_", "px_", "in_", "(_", "\"", "fq", "\"_", ",_", "\"", "fastq", "\"_", ",_", "\"", "txt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "convert", "\\u", "reads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reads_", ",_", "reads", "q_", "=_", "fake", "\\u", "qual", "s_", "(_", "reads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reads", "files_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "(_", "reads_", ",_", "reads", "q_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reads", "files_", "=_", "reads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "director", "y", " ", "structure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dre", "f_", ",_", "dre", "ads_", "=_", "\"", "data", "/", "reference", "\"_", ",_", "\"", "data", "/", "reads", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cwd_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reference_", "=_", "op_", "._", "join_", "(_", "cwd_", ",_", "\"{", "0", "}/", "{", "1", "}\"_", "._", "format_", "(_", "dre", "f_", ",_", "ref_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reads_", "=_", "op_", "._", "join_", "(_", "cwd_", ",_", "\"{", "0", "}/", "{", "1", "}\"_", "._", "format_", "(_", "dre", "ads_", ",_", "reads_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "op_", "._", "exists_", "(_", "reference_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sh_", "(_", "\"", "mkd", "ir", " ", "-", "p", " ", "{", "0", "}\"_", "._", "format_", "(_", "dre", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "(_", "\"", "cp", " ", "{", "0", "}", " ", "{", "1", "}/", "\"_", "._", "format_", "(_", "\"", " ", "\"_", "._", "join_", "(_", "(_", "ref_", ",_", "ref", "q_", ")_", ")_", ",_", "dre", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "op_", "._", "exists_", "(_", "reads_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sh_", "(_", "\"", "mkd", "ir", " ", "-", "p", " ", "{", "0", "}\"_", "._", "format_", "(_", "dre", "ads_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "(_", "\"", "cp", " ", "{", "0", "}", " ", "{", "1", "}/", "\"_", "._", "format_", "(_", "reads", "files_", ",_", "dre", "ads_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "Dir_", "=_", "cwd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Protocol_", "(_", "output", "Dir_", ",_", "reference_", ",_", "reads_", ",_", "high", "qual_", "=_", "opts_", "._", "high", "qual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "write", "\\u", "xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "the", " ", "pipeline_", "\\u\\u\\uNL\\u\\u\\u_", "runs", "h_", "=_", "[_", "setup_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "\"", "setup", "|", "mapping", "|", "support", "|", "extracti", "on", "\"_", "._", "split_", "(_", "\"|\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "runs", "h_", "._", "append_", "(_", "\"", "Je", "ll", "y", ".", "py", " ", "{", "0", "}", " ", "Proto", "col", ".", "xml", "\"_", "._", "format_", "(_", "action_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "runs", "h_", "._", "append_", "(_", "'", "Je", "ll", "y", ".", "py", " ", "assem", "bly", " ", "Proto", "col", ".", "xml", " ", "-", "x", " ", "\"--", "nproc", "={", "0", "}\"'_", "._", "format_", "(_", "cpus_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "runs", "h_", "._", "append_", "(_", "\"", "Je", "ll", "y", ".", "py", " ", "output", " ", "Proto", "col", ".", "xml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "runf", "ile_", "=_", "\"", "run", ".", "sh", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "runs", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "file_", "(_", "runf", "ile_", ",_", "contents_", ")_", "\\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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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 ]
First argument to super() is not enclosing class
circuits/circuits/circuits/core/pollers.py
[ { "content": " def removeReader(self, fd):\n super(Poll, self).removeReader(fd)\n self._updateRegistration(fd)", "metadata": "root.Poll.removeReader", "header": "['class', 'Poll', '(', 'BasePoller', ')', ':', '___EOS___']", "index": 269 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "argument_", "to_", "super_", "(_", ")_", "is_", "not_", "encl", "osin", "g_", "class_", "[SEP]_", "class_", "Poll", "_", "(_", "Base", "Poller", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "Reader_", "(_", "self_", ",_", "fd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Poll", "_", ",_", "self_", ")_", "._", "remove", "Reader_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "Registration", "_", "(_", "fd_", ")_", "\\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 ]
Unused import
dokterbob/satchmo/satchmo/apps/shipping/modules/dummy/shipper.py
[ { "content": "\"\"\"\nThis dummy module can be used as a basis for creating your own\n\n- Copy this module to a new name\n- Make the changes described below\n\"\"\"\n\n# Note, make sure you use decimal math everywhere!\nfrom decimal import Decimal\nfrom django.utils.translation import ugettext as _\nfrom shipping.modules.base import BaseShipper\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Shipper(BaseShipper):\n\n flatRateFee = Decimal(\"15.00\")\n id = \"Dumy\"\n \n \n\n\n\n", "metadata": "root.Shipper", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __str__(self):\n \"\"\"\n This is mainly helpful for debugging purposes\n \"\"\"\n return \"Dummy Flat Rate\"", "metadata": "root.Shipper.__str__", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 17 }, { "content": " def description(self):\n \"\"\"\n A basic description that will be displayed to the user when selecting their shipping options\n \"\"\"\n return _(\"Dummy Flat Rate Shipping\")", "metadata": "root.Shipper.description", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 23 }, { "content": " def cost(self):\n \"\"\"\n Complex calculations can be done here as long as the return value is a decimal figure\n \"\"\"\n assert(self._calculated)\n return(self.flatRateFee)", "metadata": "root.Shipper.cost", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 29 }, { "content": " def method(self):\n \"\"\"\n Describes the actual delivery service (Mail, FedEx, DHL, UPS, etc)\n \"\"\"\n return _(\"US Mail\")", "metadata": "root.Shipper.method", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 36 }, { "content": " def expectedDelivery(self):\n \"\"\"\n Can be a plain string or complex calcuation returning an actual date\n \"\"\"\n return _(\"3 - 4 business days\")", "metadata": "root.Shipper.expectedDelivery", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 42 }, { "content": " def valid(self, order=None):\n \"\"\"\n Can do complex validation about whether or not this option is valid.\n For example, may check to see if the recipient is in an allowed country\n or location.\n \"\"\"\n return True", "metadata": "root.Shipper.valid", "header": "['class', 'Shipper', '(', 'BaseShipper', ')', ':', '___EOS___']", "index": 48 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "dummy", " ", "module", " ", "can", " ", "be", " ", "used", " ", "as", " ", "a", " ", "basi", "s", " ", "for", " ", "creati", "ng", " ", "your", " ", "own", "\\", "10", ";", "\\", "10", ";", "-", " ", "Copy", " ", "this", " ", "module", " ", "to", " ", "a", " ", "new", " ", "name", "\\", "10", ";", "-", " ", "Make", " ", "the", " ", "change", "s", " ", "descri", "bed", " ", "belo", "w", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ",", " ", "make", " ", "sure", " ", "you", " ", "use", " ", "decima", "l", " ", "math", " ", "every", "where", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "decimal_", "import_", "Decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shipping", "_", "._", "modules_", "._", "base_", "import_", "Base", "Ship", "per_", "\\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_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flat", "Rat", "e", "Fee", "_", "=_", "Decimal_", "(_", "\"", "15.", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "\"", "Du", "my", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "mainl", "y", " ", "help", "ful", " ", "for", " ", "debugg", "ing", " ", "purpose", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "Du", "mm", "y", " ", "Flat", " ", "Rat", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "basic", " ", "description", " ", "tha", "t", " ", "will", " ", "be", " ", "displaye", "d", " ", "to", " ", "the", " ", "user", " ", "whe", "n", " ", "selecti", "ng", " ", "thei", "r", " ", "shipping", " ", "options", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u_", "(_", "\"", "Du", "mm", "y", " ", "Flat", " ", "Rat", "e", " ", "Ship", "ping", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cost_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Comple", "x", " ", "calculati", "ons", " ", "can", " ", "be", " ", "don", "e", " ", "here", " ", "as", " ", "long", " ", "as", " ", "the", " ", "return", " ", "value", " ", "is", " ", "a", " ", "decima", "l", " ", "figure", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "self_", "._", "\\u", "calculated", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "self_", "._", "flat", "Rat", "e", "Fee", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Describe", "s", " ", "the", " ", "actual", " ", "delivery", " ", "service", " ", "(", "Mail", ",", " ", "Fe", "d", "Ex", ",", " ", "DH", "L", ",", " ", "UPS", ",", " ", "etc", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u_", "(_", "\"", "US", " ", "Mail", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "expected", "Deliver", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Can", " ", "be", " ", "a", " ", "plain", " ", "string", " ", "or", " ", "complex", " ", "calc", "uation", " ", "return", "ing", " ", "an", " ", "actual", " ", "date", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u_", "(_", "\"", "3", " ", "-", " ", "4", " ", "business", " ", "day", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ship", "per_", "(_", "Base", "Ship", "per_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "valid_", "(_", "self_", ",_", "order_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Can", " ", "do", " ", "complex", " ", "validation", " ", "abo", "ut", " ", "whe", "ther", " ", "or", " ", "not", " ", "this", " ", "option", " ", "is", " ", "valid", ".", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "may", " ", "check", " ", "to", " ", "see", " ", "if", " ", "the", " ", "recip", "ient", " ", "is", " ", "in", " ", "an", " ", "allow", "ed", " ", "countr", "y", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "location", ".", "\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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 ]
Unused local variable
matrix-org/synapse/scripts-dev/tail-synapse.py
[ { "content": "def parse_response(content):\n streams = json.loads(content)\n result = {}\n for name, value in streams.items():\n row_type = row_type_for_columns(name, value[\"field_names\"])\n position = value[\"position\"]\n rows = [row_type(*row) for row in value[\"rows\"]]\n result[name] = Entry(name, position, rows)\n return result", "metadata": "root.parse_response", "header": "['module', '___EOS___']", "index": 20 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "response_", "(_", "content_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "streams_", "=_", "json_", "._", "loads_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "value_", "in_", "streams_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row", "\\u", "type_", "=_", "row", "\\u", "type", "\\u", "for", "\\u", "columns_", "(_", "name_", ",_", "value_", "[_", "\"", "field", "\\u", "names", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "position_", "=_", "value_", "[_", "\"", "position", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "[_", "row", "\\u", "type_", "(_", "*_", "row_", ")_", "for_", "row_", "in_", "value_", "[_", "\"", "rows", "\"_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "name_", "]_", "=_", "Entry_", "(_", "name_", ",_", "position_", ",_", "rows_", ")_", "\\u\\u\\uNEWLINE\\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 ]
Unused local variable
Ron89/thesaurus_query.vim/autoload/thesaurus_query/thesaurus_com_lookup.py
[ { "content": "def online_thesaurus_lookup(target):\n '''\n Direct query from thesaurus.com. All returns are encoded with utf-8.\n '''\n output = \"\"\n try:\n response = urllib2.urlopen(fixurl(u'http://www.thesaurus.com/browse/{}'.format(target)))\n parser = StringIO(response.read())\n response.close()\n except urllib2.HTTPError, error:\n output = \"The word \\\"{}\\\" has not been found on dictionary.com!\\n\".format(encode_utf_8(target))\n return output\n except urllib2.URLError, error:\n output = \"Internet Error. The word \\\"{}\\\" has not been found on dictionary.com!\\n\".format(encode_utf_8(target))\n return output\n\n end_tag_count=2\n while True:\n line_curr = parser.readline()\n if not line_curr:\n break\n if \"no thesaurus results\" in line_curr:\n output = \"The word \\\"{}\\\" has not been found on thesaurus.com!\\n\".format(target)\n break\n if \"synonym-description\" in line_curr:\n end_tag_count=0\n continue\n elif end_tag_count<2:\n if \"</div>\" in line_curr:\n end_tag_count+=1\n continue\n fields = re.split(\"<|>|&quot;\", line_curr)\n if len(fields)<3:\n continue\n elif len(fields)<10:\n if \"txt\" in fields[1]:\n output+=\"\\nDefinition: {}. \".format(fields[2])\n continue\n elif \"ttl\" in fields[1]:\n output+=\"{}\\nSynonyms:\\n\".format(fields[2])\n continue\n elif \"www.thesaurus.com\" in fields[3]:\n output+=\"{} {}\\n\".format(fields[6], fields[14])\n parser.close()\n return output", "metadata": "root.online_thesaurus_lookup", "header": "['module', '___EOS___']", "index": 95 } ]
[]
[]
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_", "onli", "ne", "\\u", "thes", "aur", "us", "\\u", "lookup_", "(_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Direct", " ", "query", " ", "from", " ", "thes", "aur", "us", ".", "com", ".", " ", "All", " ", "return", "s", " ", "are", " ", "encode", "d", " ", "with", " ", "utf", "-", "8", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "fix", "url_", "(_", "u", "'", "http", "://", "www", ".", "thes", "aur", "us", ".", "com", "/", "browse", "/{}'_", "._", "format_", "(_", "target_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "String", "IO_", "(_", "response_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", ",_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "\"", "The", " ", "word", " ", "\\\\\"{", "}\\\\\"", " ", "has", " ", "not", " ", "bee", "n", " ", "found", " ", "on", " ", "dictionar", "y", ".", "com", "!\\\\", "n", "\"_", "._", "format_", "(_", "encode", "\\u", "utf", "\\u", "8_", "(_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "URL", "Error_", ",_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "\"", "Intern", "et", " ", "Error", ".", " ", "The", " ", "word", " ", "\\\\\"{", "}\\\\\"", " ", "has", " ", "not", " ", "bee", "n", " ", "found", " ", "on", " ", "dictionar", "y", ".", "com", "!\\\\", "n", "\"_", "._", "format_", "(_", "encode", "\\u", "utf", "\\u", "8_", "(_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end", "\\u", "tag", "\\u", "count_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "\\u", "curr_", "=_", "parser_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "line", "\\u", "curr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "no", " ", "thes", "aur", "us", " ", "results", "\"_", "in_", "line", "\\u", "curr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "\"", "The", " ", "word", " ", "\\\\\"{", "}\\\\\"", " ", "has", " ", "not", " ", "bee", "n", " ", "found", " ", "on", " ", "thes", "aur", "us", ".", "com", "!\\\\", "n", "\"_", "._", "format_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "synonym", "-", "description", "\"_", "in_", "line", "\\u", "curr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "tag", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "end", "\\u", "tag", "\\u", "count_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"<", "/", "div", ">\"_", "in_", "line", "\\u", "curr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "tag", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fields_", "=_", "re_", "._", "split_", "(_", "\"<", "|", ">", "|", "&", "quot", ";\"_", ",_", "line", "\\u", "curr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "fields_", ")_", "<_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "fields_", ")_", "<_", "10_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "txt", "\"_", "in_", "fields_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "output_", "+=_", "\"\\\\", "n", "Definit", "ion", ":", " ", "{}.", " ", "\"_", "._", "format_", "(_", "fields_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "ttl", "\"_", "in_", "fields_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "output_", "+=_", "\"{}\\\\", "n", "Syno", "nym", "s", ":\\\\", "n", "\"_", "._", "format_", "(_", "fields_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "www", ".", "thes", "aur", "us", ".", "com", "\"_", "in_", "fields_", "[_", "3_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "+=_", "\"{}", " ", "{}", "\\\\", "n", "\"_", "._", "format_", "(_", "fields_", "[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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
rlpy/rlpy/rlpy/Domains/PacmanPackage/reinforcementTestClasses.py
[ { "content": "def parseGrid(string):\n grid = [[entry.strip() for entry in line.split()]\n for line in string.split('\\n')]\n for row in grid:\n for x, col in enumerate(row):\n try:\n col = int(col)\n except:\n pass\n if col == \"_\":\n col = ' '\n row[x] = col\n return gridworld.makeGrid(grid)", "metadata": "root.parseGrid", "header": "['module', '___EOS___']", "index": 927 } ]
[]
[]
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_", "def_", "parse", "Grid_", "(_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "grid_", "=_", "[_", "[_", "entry_", "._", "strip_", "(_", ")_", "for_", "entry_", "in_", "line_", "._", "split_", "(_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "string_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "grid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", ",_", "col_", "in_", "enumerate_", "(_", "row_", ")_", ":_", "\\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 ", " _", "col_", "=_", "int_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "==_", "\"\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col_", "=_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", "[_", "x_", "]_", "=_", "col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "grid", "world_", "._", "make", "Grid_", "(_", "grid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
chexov/queueit/beanstalkd/queueit/beanstalkc.py
[ { "content": " def _priority(self):\n stats = self.stats()\n if isinstance(stats, dict):\n return stats['pri']\n return DEFAULT_PRIORITY", "metadata": "root.Job._priority", "header": "['class', 'Job', '(', 'object', ')', ':', '___EOS___']", "index": 261 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Job_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "priority_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "=_", "self_", "._", "stats_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "stats_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "stats_", "[_", "'", "pri", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "DEF", "AUL", "T", "\\u", "PRIORITY", "_", "\\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 ]
Unused import
dtroyer/python-openstackclient/openstackclient/network/v2/port.py
[ { "content": "# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n#\n\n\"\"\"Port action implementations\"\"\"\n\nimport argparse\nimport logging\n\nfrom openstackclient.common import command\nfrom openstackclient.common import exceptions\nfrom openstackclient.common import parseractions\nfrom openstackclient.common import utils\nfrom openstackclient.i18n import _ # noqa\nfrom openstackclient.identity import common as identity_common\n\n\nLOG = logging.getLogger(__name__)\n\n\n\n\n_formatters = {\n 'admin_state_up': _format_admin_state,\n 'allowed_address_pairs': utils.format_list_of_dicts,\n 'binding_profile': utils.format_dict,\n 'binding_vif_details': utils.format_dict,\n 'dns_assignment': utils.format_list_of_dicts,\n 'extra_dhcp_opts': utils.format_list_of_dicts,\n 'fixed_ips': utils.format_list_of_dicts,\n 'security_groups': utils.format_list,\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _format_admin_state(state):\n return 'UP' if state else 'DOWN'", "metadata": "root._format_admin_state", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def _get_columns(item):\n columns = list(item.keys())\n if 'tenant_id' in columns:\n columns.remove('tenant_id')\n columns.append('project_id')\n binding_columns = [\n 'binding:host_id',\n 'binding:profile',\n 'binding:vif_details',\n 'binding:vif_type',\n 'binding:vnic_type',\n ]\n for binding_column in binding_columns:\n if binding_column in columns:\n columns.remove(binding_column)\n columns.append(binding_column.replace('binding:', 'binding_', 1))\n return tuple(sorted(columns))", "metadata": "root._get_columns", "header": "['module', '___EOS___']", "index": 45 }, { "content": "def _get_attrs(client_manager, parsed_args):\n attrs = {}\n\n # Handle deprecated options\n # NOTE(dtroyer): --device-id and --host-id were deprecated in Mar 2016.\n # Do not remove before 3.x release or Mar 2017.\n if parsed_args.device_id:\n attrs['device_id'] = parsed_args.device_id\n LOG.warning(_(\n 'The --device-id option is deprecated, '\n 'please use --device instead.'\n ))\n if parsed_args.host_id:\n attrs['binding:host_id'] = parsed_args.host_id\n LOG.warning(_(\n 'The --host-id option is deprecated, '\n 'please use --host instead.'\n ))\n\n if parsed_args.fixed_ip is not None:\n attrs['fixed_ips'] = parsed_args.fixed_ip\n if parsed_args.device:\n attrs['device_id'] = parsed_args.device\n if parsed_args.device_owner is not None:\n attrs['device_owner'] = parsed_args.device_owner\n if parsed_args.enable:\n attrs['admin_state_up'] = True\n if parsed_args.disable:\n attrs['admin_state_up'] = False\n if parsed_args.binding_profile is not None:\n attrs['binding:profile'] = parsed_args.binding_profile\n if parsed_args.vnic_type is not None:\n attrs['binding:vnic_type'] = parsed_args.vnic_type\n if parsed_args.host:\n attrs['binding:host_id'] = parsed_args.host\n\n # It is possible that name is not updated during 'port set'\n if parsed_args.name is not None:\n attrs['name'] = str(parsed_args.name)\n # The remaining options do not support 'port set' command, so they require\n # additional check\n if 'mac_address' in parsed_args and parsed_args.mac_address is not None:\n attrs['mac_address'] = parsed_args.mac_address\n if 'network' in parsed_args and parsed_args.network is not None:\n attrs['network_id'] = parsed_args.network\n if 'project' in parsed_args and parsed_args.project is not None:\n # TODO(singhj): since 'project' logic is common among\n # router, network, port etc., maybe move it to a common file.\n identity_client = client_manager.identity\n project_id = identity_common.find_project(\n identity_client,\n parsed_args.project,\n parsed_args.project_domain,\n ).id\n attrs['tenant_id'] = project_id\n\n return attrs", "metadata": "root._get_attrs", "header": "['module', '___EOS___']", "index": 64 }, { "content": "def _prepare_fixed_ips(client_manager, parsed_args):\n \"\"\"Fix and properly format fixed_ip option.\n\n Appropriately convert any subnet names to their respective ids.\n Convert fixed_ips in parsed args to be in valid dictionary format:\n {'subnet': 'foo'}.\n \"\"\"\n client = client_manager.network\n ips = []\n\n if parsed_args.fixed_ip:\n for ip_spec in parsed_args.fixed_ip:\n if 'subnet' in ip_spec:\n subnet_name_id = ip_spec['subnet']\n if subnet_name_id:\n _subnet = client.find_subnet(subnet_name_id,\n ignore_missing=False)\n ip_spec['subnet_id'] = _subnet.id\n del ip_spec['subnet']\n\n if 'ip-address' in ip_spec:\n ip_spec['ip_address'] = ip_spec['ip-address']\n del ip_spec['ip-address']\n\n ips.append(ip_spec)\n\n if ips:\n parsed_args.fixed_ip = ips", "metadata": "root._prepare_fixed_ips", "header": "['module', '___EOS___']", "index": 123 }, { "content": "def _add_updatable_args(parser):\n # NOTE(dtroyer): --device-id is deprecated in Mar 2016. Do not\n # remove before 3.x release or Mar 2017.\n device_group = parser.add_mutually_exclusive_group()\n device_group.add_argument(\n '--device',\n metavar='<device-id>',\n help=_(\"Port device ID\")\n )\n device_group.add_argument(\n '--device-id',\n metavar='<device-id>',\n help=argparse.SUPPRESS,\n )\n parser.add_argument(\n '--device-owner',\n metavar='<device-owner>',\n help=_(\"Device owner of this port\")\n )\n parser.add_argument(\n '--vnic-type',\n metavar='<vnic-type>',\n choices=['direct', 'direct-physical', 'macvtap',\n 'normal', 'baremetal'],\n help=_(\"VNIC type for this port (direct | direct-physical | \"\n \"macvtap | normal | baremetal, default: normal)\")\n )\n # NOTE(dtroyer): --host-id is deprecated in Mar 2016. Do not\n # remove before 3.x release or Mar 2017.\n host_group = parser.add_mutually_exclusive_group()\n host_group.add_argument(\n '--host',\n metavar='<host-id>',\n help=_(\"Allocate port on host <host-id> (ID only)\")\n )\n host_group.add_argument(\n '--host-id',\n metavar='<host-id>',\n help=argparse.SUPPRESS,\n )", "metadata": "root._add_updatable_args", "header": "['module', '___EOS___']", "index": 153 }, { "content": "class CreatePort(command.ShowOne):\n \"\"\"Create a new port\"\"\"\n\n", "metadata": "root.CreatePort", "header": "['module', '___EOS___']", "index": 195 }, { "content": " def get_parser(self, prog_name):\n parser = super(CreatePort, self).get_parser(prog_name)\n\n parser.add_argument(\n '--network',\n metavar='<network>',\n required=True,\n help=_(\"Network this port belongs to (name or ID)\")\n )\n _add_updatable_args(parser)\n parser.add_argument(\n '--fixed-ip',\n metavar='subnet=<subnet>,ip-address=<ip-address>',\n action=parseractions.MultiKeyValueAction,\n optional_keys=['subnet', 'ip-address'],\n help=_(\"Desired IP and/or subnet (name or ID) for this port: \"\n \"subnet=<subnet>,ip-address=<ip-address> \"\n \"(repeat option to set multiple fixed IP addresses)\")\n )\n parser.add_argument(\n '--binding-profile',\n metavar='<binding-profile>',\n action=parseractions.KeyValueAction,\n help=_(\"Custom data to be passed as binding:profile: \"\n \"<key>=<value> \"\n \"(repeat option to set multiple binding:profile data)\")\n )\n admin_group = parser.add_mutually_exclusive_group()\n admin_group.add_argument(\n '--enable',\n action='store_true',\n default=True,\n help=_(\"Enable port (default)\")\n )\n admin_group.add_argument(\n '--disable',\n action='store_true',\n help=_(\"Disable port\")\n )\n parser.add_argument(\n '--mac-address',\n metavar='<mac-address>',\n help=_(\"MAC address of this port\")\n )\n parser.add_argument(\n '--project',\n metavar='<project>',\n help=_(\"Owner's project (name or ID)\")\n )\n identity_common.add_project_domain_option_to_parser(parser)\n parser.add_argument(\n 'name',\n metavar='<name>',\n help=_(\"Name of this port\")\n )\n # TODO(singhj): Add support for extended options:\n # qos,security groups,dhcp, address pairs\n return parser", "metadata": "root.CreatePort.get_parser", "header": "['class', 'CreatePort', '(', 'command', '.', 'ShowOne', ')', ':', '___EOS___']", "index": 198 }, { "content": " def take_action(self, parsed_args):\n client = self.app.client_manager.network\n _network = client.find_network(parsed_args.network,\n ignore_missing=False)\n parsed_args.network = _network.id\n _prepare_fixed_ips(self.app.client_manager, parsed_args)\n attrs = _get_attrs(self.app.client_manager, parsed_args)\n obj = client.create_port(**attrs)\n columns = _get_columns(obj)\n data = utils.get_item_properties(obj, columns, formatters=_formatters)\n\n return columns, data", "metadata": "root.CreatePort.take_action", "header": "['class', 'CreatePort', '(', 'command', '.', 'ShowOne', ')', ':', '___EOS___']", "index": 257 }, { "content": "class DeletePort(command.Command):\n \"\"\"Delete port(s)\"\"\"\n\n", "metadata": "root.DeletePort", "header": "['module', '___EOS___']", "index": 271 }, { "content": " def get_parser(self, prog_name):\n parser = super(DeletePort, self).get_parser(prog_name)\n parser.add_argument(\n 'port',\n metavar=\"<port>\",\n nargs=\"+\",\n help=_(\"Port(s) to delete (name or ID)\")\n )\n return parser", "metadata": "root.DeletePort.get_parser", "header": "['class', 'DeletePort', '(', 'command', '.', 'Command', ')', ':', '___EOS___']", "index": 274 }, { "content": " def take_action(self, parsed_args):\n client = self.app.client_manager.network\n\n for port in parsed_args.port:\n res = client.find_port(port)\n client.delete_port(res)", "metadata": "root.DeletePort.take_action", "header": "['class', 'DeletePort', '(', 'command', '.', 'Command', ')', ':', '___EOS___']", "index": 284 }, { "content": "class ListPort(command.Lister):\n \"\"\"List ports\"\"\"\n\n", "metadata": "root.ListPort", "header": "['module', '___EOS___']", "index": 292 }, { "content": " def get_parser(self, prog_name):\n parser = super(ListPort, self).get_parser(prog_name)\n parser.add_argument(\n '--router',\n metavar='<router>',\n dest='router',\n help=_(\"List only ports attached to this router (name or ID)\")\n )\n return parser", "metadata": "root.ListPort.get_parser", "header": "['class', 'ListPort', '(', 'command', '.', 'Lister', ')', ':', '___EOS___']", "index": 295 }, { "content": " def take_action(self, parsed_args):\n client = self.app.client_manager.network\n\n columns = (\n 'id',\n 'name',\n 'mac_address',\n 'fixed_ips',\n )\n column_headers = (\n 'ID',\n 'Name',\n 'MAC Address',\n 'Fixed IP Addresses',\n )\n\n filters = {}\n if parsed_args.router:\n _router = client.find_router(parsed_args.router,\n ignore_missing=False)\n filters = {'device_id': _router.id}\n\n data = client.ports(**filters)\n\n return (column_headers,\n (utils.get_item_properties(\n s, columns,\n formatters=_formatters,\n ) for s in data))", "metadata": "root.ListPort.take_action", "header": "['class', 'ListPort', '(', 'command', '.', 'Lister', ')', ':', '___EOS___']", "index": 305 }, { "content": "class SetPort(command.Command):\n \"\"\"Set port properties\"\"\"\n\n", "metadata": "root.SetPort", "header": "['module', '___EOS___']", "index": 336 }, { "content": " def get_parser(self, prog_name):\n parser = super(SetPort, self).get_parser(prog_name)\n _add_updatable_args(parser)\n admin_group = parser.add_mutually_exclusive_group()\n admin_group.add_argument(\n '--enable',\n action='store_true',\n default=None,\n help=_(\"Enable port\")\n )\n admin_group.add_argument(\n '--disable',\n action='store_true',\n help=_(\"Disable port\")\n )\n parser.add_argument(\n '--name',\n metavar=\"<name>\",\n help=_(\"Set port name\")\n )\n fixed_ip = parser.add_mutually_exclusive_group()\n fixed_ip.add_argument(\n '--fixed-ip',\n metavar='subnet=<subnet>,ip-address=<ip-address>',\n action=parseractions.MultiKeyValueAction,\n optional_keys=['subnet', 'ip-address'],\n help=_(\"Desired IP and/or subnet (name or ID) for this port: \"\n \"subnet=<subnet>,ip-address=<ip-address> \"\n \"(repeat option to set multiple fixed IP addresses)\")\n )\n fixed_ip.add_argument(\n '--no-fixed-ip',\n action='store_true',\n help=_(\"Clear existing information of fixed IP addresses\")\n )\n binding_profile = parser.add_mutually_exclusive_group()\n binding_profile.add_argument(\n '--binding-profile',\n metavar='<binding-profile>',\n action=parseractions.KeyValueAction,\n help=_(\"Custom data to be passed as binding:profile: \"\n \"<key>=<value> \"\n \"(repeat option to set multiple binding:profile data)\")\n )\n binding_profile.add_argument(\n '--no-binding-profile',\n action='store_true',\n help=_(\"Clear existing information of binding:profile\")\n )\n parser.add_argument(\n 'port',\n metavar=\"<port>\",\n help=_(\"Port to modify (name or ID)\")\n )\n return parser", "metadata": "root.SetPort.get_parser", "header": "['class', 'SetPort', '(', 'command', '.', 'Command', ')', ':', '___EOS___']", "index": 339 }, { "content": " def take_action(self, parsed_args):\n client = self.app.client_manager.network\n\n _prepare_fixed_ips(self.app.client_manager, parsed_args)\n attrs = _get_attrs(self.app.client_manager, parsed_args)\n obj = client.find_port(parsed_args.port, ignore_missing=False)\n if 'binding:profile' in attrs:\n attrs['binding:profile'].update(obj.binding_profile)\n elif parsed_args.no_binding_profile:\n attrs['binding:profile'] = {}\n if 'fixed_ips' in attrs:\n # When user unsets the fixed_ips, obj.fixed_ips = [{}].\n # Adding the obj.fixed_ips list to attrs['fixed_ips']\n # would therefore add an empty dictionary, while we need\n # to append the attrs['fixed_ips'] iff there is some info\n # in the obj.fixed_ips. Therefore I have opted for this `for` loop\n attrs['fixed_ips'] += [ip for ip in obj.fixed_ips if ip]\n elif parsed_args.no_fixed_ip:\n attrs['fixed_ips'] = []\n\n if attrs == {}:\n msg = \"Nothing specified to be set\"\n raise exceptions.CommandError(msg)\n client.update_port(obj, **attrs)", "metadata": "root.SetPort.take_action", "header": "['class', 'SetPort', '(', 'command', '.', 'Command', ')', ':', '___EOS___']", "index": 395 }, { "content": "class ShowPort(command.ShowOne):\n \"\"\"Display port details\"\"\"\n\n", "metadata": "root.ShowPort", "header": "['module', '___EOS___']", "index": 421 }, { "content": " def get_parser(self, prog_name):\n parser = super(ShowPort, self).get_parser(prog_name)\n parser.add_argument(\n 'port',\n metavar=\"<port>\",\n help=_(\"Port to display (name or ID)\")\n )\n return parser", "metadata": "root.ShowPort.get_parser", "header": "['class', 'ShowPort', '(', 'command', '.', 'ShowOne', ')', ':', '___EOS___']", "index": 424 }, { "content": " def take_action(self, parsed_args):\n client = self.app.client_manager.network\n obj = client.find_port(parsed_args.port, ignore_missing=False)\n columns = _get_columns(obj)\n data = utils.get_item_properties(obj, columns, formatters=_formatters)\n return columns, data", "metadata": "root.ShowPort.take_action", "header": "['class', 'ShowPort', '(', 'command', '.', 'ShowOne', ')', ':', '___EOS___']", "index": 433 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\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_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Port", " ", "action", " ", "implementation", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openst", "ack", "client_", "._", "common_", "import_", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openst", "ack", "client_", "._", "common_", "import_", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openst", "ack", "client_", "._", "common_", "import_", "parser", "actions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openst", "ack", "client_", "._", "common_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openst", "ack", "client_", "._", "i18n_", "import_", "\\u_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openst", "ack", "client_", "._", "identity_", "import_", "common_", "as_", "identi", "ty", "\\u", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "formatters_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "admin", "\\u", "state", "\\u", "up", "'_", ":_", "\\u", "format\\u", "admin", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "ed", "\\u", "address", "\\u", "pair", "s", "'_", ":_", "utils_", "._", "format\\u", "list", "\\u", "of", "\\u", "dicts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bindi", "ng", "\\u", "profile", "'_", ":_", "utils_", "._", "format\\u", "dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bindi", "ng", "\\u", "vi", "f", "\\u", "deta", "il", "s", "'_", ":_", "utils_", "._", "format\\u", "dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dns", "\\u", "assign", "ment", "'_", ":_", "utils_", "._", "format\\u", "list", "\\u", "of", "\\u", "dicts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "\\u", "dhcp", "\\u", "opts", "'_", ":_", "utils_", "._", "format\\u", "list", "\\u", "of", "\\u", "dicts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fixed", "\\u", "ips", "'_", ":_", "utils_", "._", "format\\u", "list", "\\u", "of", "\\u", "dicts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "security", "\\u", "group", "s", "'_", ":_", "utils_", "._", "format\\u", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "format\\u", "admin", "\\u", "state_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "UP", "'_", "if_", "state_", "else_", "'", "DOWN", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "columns_", "(_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "columns_", "=_", "list_", "(_", "item_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "tenan", "t", "\\u", "id", "'_", "in_", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "columns_", "._", "remove_", "(_", "'", "tenan", "t", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "columns_", "._", "append_", "(_", "'", "project", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bindi", "ng", "\\u", "columns_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bindi", "ng", ":", "host", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bindi", "ng", ":", "profile", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bindi", "ng", ":", "vi", "f", "\\u", "deta", "il", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bindi", "ng", ":", "vi", "f", "\\u", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bindi", "ng", ":", "vnic", "\\u", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "bindi", "ng", "\\u", "column_", "in_", "bindi", "ng", "\\u", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bindi", "ng", "\\u", "column_", "in_", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "columns_", "._", "remove_", "(_", "bindi", "ng", "\\u", "column_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "columns_", "._", "append_", "(_", "bindi", "ng", "\\u", "column_", "._", "replace_", "(_", "'", "bindi", "ng", ":'_", ",_", "'", "bindi", "ng", "\\u'_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tuple_", "(_", "sorted_", "(_", "columns_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "attrs_", "(_", "client", "\\u", "manager_", ",_", "parsed", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Handle", " ", "depre", "cated", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", "(", "dtr", "oy", "er", "):", " ", "--", "device", "-", "id", " ", "and", " ", "--", "host", "-", "id", " ", "wer", "e", " ", "depre", "cated", " ", "in", " ", "Mar", " ", "2016", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Do", " ", "not", " ", "remove", " ", "bef", "ore", " ", "3", ".", "x", " ", "release", " ", "or", " ", "Mar", " ", "2017", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "device", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "device", "\\u", "id", "'_", "]_", "=_", "parsed", "\\u", "args_", "._", "device", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "warning_", "(_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "--", "device", "-", "id", " ", "option", " ", "is", " ", "depre", "cated", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plea", "se", " ", "use", " ", "--", "device", " ", "inst", "ead", ".'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "host", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "bindi", "ng", ":", "host", "\\u", "id", "'_", "]_", "=_", "parsed", "\\u", "args_", "._", "host", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "warning_", "(_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "--", "host", "-", "id", " ", "option", " ", "is", " ", "depre", "cated", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "plea", "se", " ", "use", " ", "--", "host", " ", "inst", "ead", ".'_", "\\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_", "parsed", "\\u", "args_", "._", "fixed", "\\u", "ip_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "=_", "parsed", "\\u", "args_", "._", "fixed", "\\u", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "device_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "device", "\\u", "id", "'_", "]_", "=_", "parsed", "\\u", "args_", "._", "device_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "device", "\\u", "owner_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "device", "\\u", "owner", "'_", "]_", "=_", "parsed", "\\u", "args_", "._", "device", "\\u", "owner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "enable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "admin", "\\u", "state", "\\u", "up", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "disable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "admin", "\\u", "state", "\\u", "up", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "bindi", "ng", "\\u", "profile_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "bindi", "ng", ":", "profile", "'_", "]_", "=_", "parsed", "\\u", "args_", "._", "bindi", "ng", "\\u", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "vnic", "\\u", "type_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "bindi", "ng", ":", "vnic", "\\u", "type", "'_", "]_", "=_", "parsed", "\\u", "args_", "._", "vnic", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "host_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "bindi", "ng", ":", "host", "\\u", "id", "'_", "]_", "=_", "parsed", "\\u", "args_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "is", " ", "possib", "le", " ", "tha", "t", " ", "name", " ", "is", " ", "not", " ", "update", "d", " ", "dur", "ing", " ", "'", "port", " ", "set", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "name_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "name", "'_", "]_", "=_", "str_", "(_", "parsed", "\\u", "args_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "rema", "inin", "g", " ", "options", " ", "do", " ", "not", " ", "support", " ", "'", "port", " ", "set", "'", " ", "command", ",", " ", "so", " ", "the", "y", " ", "require_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addition", "al", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "mac", "\\u", "address", "'_", "in_", "parsed", "\\u", "args_", "and_", "parsed", "\\u", "args_", "._", "mac", "\\u", "address_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "mac", "\\u", "address", "'_", "]_", "=_", "parsed", "\\u", "args_", "._", "mac", "\\u", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "network", "'_", "in_", "parsed", "\\u", "args_", "and_", "parsed", "\\u", "args_", "._", "network_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "network", "\\u", "id", "'_", "]_", "=_", "parsed", "\\u", "args_", "._", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "project", "'_", "in_", "parsed", "\\u", "args_", "and_", "parsed", "\\u", "args_", "._", "project_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "(", "sing", "hj", "):", " ", "sinc", "e", " ", "'", "project", "'", " ", "logic", " ", "is", " ", "common", " ", "amo", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "router", ",", " ", "network", ",", " ", "port", " ", "etc", ".,", " ", "may", "be", " ", "move", " ", "it", " ", "to", " ", "a", " ", "common", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "identi", "ty", "\\u", "client_", "=_", "client", "\\u", "manager_", "._", "identity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "\\u", "id_", "=_", "identi", "ty", "\\u", "common_", "._", "find", "\\u", "project_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "identi", "ty", "\\u", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parsed", "\\u", "args_", "._", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parsed", "\\u", "args_", "._", "project", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "[_", "'", "tenan", "t", "\\u", "id", "'_", "]_", "=_", "project", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "attrs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "prepar", "e\\u", "fixed", "\\u", "ips_", "(_", "client", "\\u", "manager_", ",_", "parsed", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fix", " ", "and", " ", "proper", "ly", " ", "format", " ", "fixed", "\\u", "ip", " ", "option", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Appro", "pri", "ate", "ly", " ", "convert", " ", "any", " ", "subnet", " ", "names", " ", "to", " ", "thei", "r", " ", "respec", "tiv", "e", " ", "ids", ".", "\\", "10", ";", " ", " ", " ", " ", "Convert", " ", "fixed", "\\u", "ips", " ", "in", " ", "parsed", " ", "args", " ", "to", " ", "be", " ", "in", " ", "valid", " ", "dictionar", "y", " ", "format", ":", "\\", "10", ";", " ", " ", " ", " ", "{", "'", "subnet", "':", " ", "'", "foo", "'}", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "client", "\\u", "manager_", "._", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ips_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "fixed", "\\u", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ip", "\\u", "spec_", "in_", "parsed", "\\u", "args_", "._", "fixed", "\\u", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "subnet", "'_", "in_", "ip", "\\u", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subnet", "\\u", "name", "\\u", "id_", "=_", "ip", "\\u", "spec_", "[_", "'", "subnet", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "subnet", "\\u", "name", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "subnet_", "=_", "client_", "._", "find", "\\u", "subnet_", "(_", "subnet", "\\u", "name", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "missing_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip", "\\u", "spec_", "[_", "'", "subnet", "\\u", "id", "'_", "]_", "=_", "\\u", "subnet_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "ip", "\\u", "spec_", "[_", "'", "subnet", "'_", "]_", "\\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_", "'", "ip", "-", "address", "'_", "in_", "ip", "\\u", "spec_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ip", "\\u", "spec_", "[_", "'", "ip", "\\u", "address", "'_", "]_", "=_", "ip", "\\u", "spec_", "[_", "'", "ip", "-", "address", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "ip", "\\u", "spec_", "[_", "'", "ip", "-", "address", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ips_", "._", "append_", "(_", "ip", "\\u", "spec_", ")_", "\\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_", "ips_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parsed", "\\u", "args_", "._", "fixed", "\\u", "ip_", "=_", "ips_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "add", "\\u", "updat", "able", "\\u", "args_", "(_", "parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "dtr", "oy", "er", "):", " ", "--", "device", "-", "id", " ", "is", " ", "depre", "cated", " ", "in", " ", "Mar", " ", "2016", ".", " ", " ", "Do", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "remove", " ", "bef", "ore", " ", "3", ".", "x", " ", "release", " ", "or", " ", "Mar", " ", "2017", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "device", "\\u", "group_", "=_", "parser_", "._", "add", "\\u", "mutual", "ly", "\\u", "exclu", "sive", "\\u", "group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "device", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "device", "-", "id", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Port", " ", "device", " ", "ID", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "device", "-", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "device", "-", "id", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "argparse_", "._", "SUPPRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "device", "-", "owner", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "device", "-", "owner", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Dev", "ice", " ", "owner", " ", "of", " ", "this", " ", "port", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "vnic", "-", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "vnic", "-", "type", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "[_", "'", "direct", "'_", ",_", "'", "direct", "-", "physical", "'_", ",_", "'", "mac", "vta", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "normal", "'_", ",_", "'", "baremetal", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "VN", "IC", " ", "type", " ", "for", " ", "this", " ", "port", " ", "(", "direct", " ", "|", " ", "direct", "-", "physical", " ", "|", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mac", "vta", "p", " ", "|", " ", "normal", " ", "|", " ", "baremetal", ",", " ", "default", ":", " ", "normal", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "dtr", "oy", "er", "):", " ", "--", "host", "-", "id", " ", "is", " ", "depre", "cated", " ", "in", " ", "Mar", " ", "2016", ".", " ", " ", "Do", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "remove", " ", "bef", "ore", " ", "3", ".", "x", " ", "release", " ", "or", " ", "Mar", " ", "2017", "._", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "group_", "=_", "parser_", "._", "add", "\\u", "mutual", "ly", "\\u", "exclu", "sive", "\\u", "group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "host", "-", "id", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Allocate", " ", "port", " ", "on", " ", "host", " ", "<", "host", "-", "id", ">", " ", "(", "ID", " ", "only", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "host", "-", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "host", "-", "id", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "argparse_", "._", "SUPPRESS", "_", ",_", "\\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_", "Creat", "e", "Port_", "(_", "command_", "._", "Show", "One_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "new", " ", "port", "\"\"\"_", "\\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_", "Creat", "e", "Port_", "(_", "command_", "._", "Show", "One_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "parser_", "(_", "self_", ",_", "prog", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "super_", "(_", "Creat", "e", "Port_", ",_", "self_", ")_", "._", "get", "\\u", "parser_", "(_", "prog", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "network", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "network", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Network", " ", "this", " ", "port", " ", "belo", "ngs", " ", "to", " ", "(", "name", " ", "or", " ", "ID", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "add", "\\u", "updat", "able", "\\u", "args_", "(_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "fixed", "-", "ip", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'", "subnet", "=", "<", "subnet", ">", ",", "ip", "-", "address", "=", "<", "ip", "-", "address", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "parser", "actions_", "._", "Multi", "Key", "Value", "Action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "option", "al", "\\u", "keys_", "=_", "[_", "'", "subnet", "'_", ",_", "'", "ip", "-", "address", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Des", "ired", " ", "IP", " ", "and", "/", "or", " ", "subnet", " ", "(", "name", " ", "or", " ", "ID", ")", " ", "for", " ", "this", " ", "port", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "subnet", "=", "<", "subnet", ">", ",", "ip", "-", "address", "=", "<", "ip", "-", "address", ">", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "repeat", " ", "option", " ", "to", " ", "set", " ", "multiple", " ", "fixed", " ", "IP", " ", "addresse", "s", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "bindi", "ng", "-", "profile", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "bindi", "ng", "-", "profile", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "parser", "actions_", "._", "Key", "Value", "Action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Custom", " ", "data", " ", "to", " ", "be", " ", "pass", "ed", " ", "as", " ", "bindi", "ng", ":", "profile", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "key", ">=", "<", "value", ">", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "repeat", " ", "option", " ", "to", " ", "set", " ", "multiple", " ", "bindi", "ng", ":", "profile", " ", "data", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "group_", "=_", "parser_", "._", "add", "\\u", "mutual", "ly", "\\u", "exclu", "sive", "\\u", "group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "enable", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Enable", " ", "port", " ", "(", "default", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "disable", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Disa", "ble", " ", "port", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "mac", "-", "address", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "mac", "-", "address", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "MAC", " ", "address", " ", "of", " ", "this", " ", "port", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "project", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "project", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Owne", "r", "'", "s", " ", "project", " ", "(", "name", " ", "or", " ", "ID", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "identi", "ty", "\\u", "common_", "._", "add", "\\u", "project", "\\u", "domain", "\\u", "option", "\\u", "to", "\\u", "parser_", "(_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "name", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Name", " ", "of", " ", "this", " ", "port", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "(", "sing", "hj", "):", " ", "Add", " ", "support", " ", "for", " ", "extend", "ed", " ", "options", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "qo", "s", ",", "security", " ", "group", "s", ",", "dhcp", ",", " ", "address", " ", "pairs_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Port_", "(_", "command_", "._", "Show", "One_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "take", "\\u", "action_", "(_", "self_", ",_", "parsed", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "app_", "._", "client", "\\u", "manager_", "._", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "network_", "=_", "client_", "._", "find", "\\u", "network_", "(_", "parsed", "\\u", "args_", "._", "network_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "missing_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parsed", "\\u", "args_", "._", "network_", "=_", "\\u", "network_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "prepar", "e\\u", "fixed", "\\u", "ips_", "(_", "self_", "._", "app_", "._", "client", "\\u", "manager_", ",_", "parsed", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "=_", "\\u", "get", "\\u", "attrs_", "(_", "self_", "._", "app_", "._", "client", "\\u", "manager_", ",_", "parsed", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "client_", "._", "create", "\\u", "port_", "(_", "**_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "columns_", "=_", "\\u", "get", "\\u", "columns_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "utils_", "._", "get", "\\u", "item", "\\u", "properties_", "(_", "obj_", ",_", "columns_", ",_", "formatters_", "=_", "\\u", "formatters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "columns_", ",_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Delete", "Port_", "(_", "command_", "._", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "port", "(", "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_", "[SEP]_", "class_", "Delete", "Port_", "(_", "command_", "._", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "parser_", "(_", "self_", ",_", "prog", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "super_", "(_", "Delete", "Port_", ",_", "self_", ")_", "._", "get", "\\u", "parser_", "(_", "prog", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"<", "port", ">\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nargs_", "=_", "\"+\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Port", "(", "s", ")", " ", "to", " ", "delete", " ", "(", "name", " ", "or", " ", "ID", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Delete", "Port_", "(_", "command_", "._", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "take", "\\u", "action_", "(_", "self_", ",_", "parsed", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "app_", "._", "client", "\\u", "manager_", "._", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "port_", "in_", "parsed", "\\u", "args_", "._", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "client_", "._", "find", "\\u", "port_", "(_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "delete", "\\u", "port_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "List", "Port_", "(_", "command_", "._", "Liste", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "List", " ", "port", "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_", "[SEP]_", "class_", "List", "Port_", "(_", "command_", "._", "Liste", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "parser_", "(_", "self_", ",_", "prog", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "super_", "(_", "List", "Port_", ",_", "self_", ")_", "._", "get", "\\u", "parser_", "(_", "prog", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "router", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "router", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", "=_", "'", "router", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "List", " ", "only", " ", "port", "s", " ", "attache", "d", " ", "to", " ", "this", " ", "router", " ", "(", "name", " ", "or", " ", "ID", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "List", "Port_", "(_", "command_", "._", "Liste", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "take", "\\u", "action_", "(_", "self_", ",_", "parsed", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "app_", "._", "client", "\\u", "manager_", "._", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mac", "\\u", "address", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fixed", "\\u", "ips", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column", "\\u", "headers_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ID", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MAC", " ", "Address", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fix", "ed", " ", "IP", " ", "Address", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "parsed", "\\u", "args_", "._", "router_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "router_", "=_", "client_", "._", "find", "\\u", "router_", "(_", "parsed", "\\u", "args_", "._", "router_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "missing_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "{_", "'", "device", "\\u", "id", "'_", ":_", "\\u", "router_", "._", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "client_", "._", "ports_", "(_", "**_", "filters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "column", "\\u", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "utils_", "._", "get", "\\u", "item", "\\u", "properties_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "s_", ",_", "columns_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatters_", "=_", "\\u", "formatters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "for_", "s_", "in_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Set", "Port_", "(_", "command_", "._", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "port", " ", "proper", "ties", "\"\"\"_", "\\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_", "Set", "Port_", "(_", "command_", "._", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "parser_", "(_", "self_", ",_", "prog", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "super_", "(_", "Set", "Port_", ",_", "self_", ")_", "._", "get", "\\u", "parser_", "(_", "prog", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "add", "\\u", "updat", "able", "\\u", "args_", "(_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "group_", "=_", "parser_", "._", "add", "\\u", "mutual", "ly", "\\u", "exclu", "sive", "\\u", "group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "enable", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Enable", " ", "port", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "disable", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Disa", "ble", " ", "port", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"<", "name", ">\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Set", " ", "port", " ", "name", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fixed", "\\u", "ip_", "=_", "parser_", "._", "add", "\\u", "mutual", "ly", "\\u", "exclu", "sive", "\\u", "group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fixed", "\\u", "ip_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "fixed", "-", "ip", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'", "subnet", "=", "<", "subnet", ">", ",", "ip", "-", "address", "=", "<", "ip", "-", "address", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "parser", "actions_", "._", "Multi", "Key", "Value", "Action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "option", "al", "\\u", "keys_", "=_", "[_", "'", "subnet", "'_", ",_", "'", "ip", "-", "address", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Des", "ired", " ", "IP", " ", "and", "/", "or", " ", "subnet", " ", "(", "name", " ", "or", " ", "ID", ")", " ", "for", " ", "this", " ", "port", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "subnet", "=", "<", "subnet", ">", ",", "ip", "-", "address", "=", "<", "ip", "-", "address", ">", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "repeat", " ", "option", " ", "to", " ", "set", " ", "multiple", " ", "fixed", " ", "IP", " ", "addresse", "s", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fixed", "\\u", "ip_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "-", "fixed", "-", "ip", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Clear", " ", "exist", "ing", " ", "informati", "on", " ", "of", " ", "fixed", " ", "IP", " ", "addresse", "s", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bindi", "ng", "\\u", "profile_", "=_", "parser_", "._", "add", "\\u", "mutual", "ly", "\\u", "exclu", "sive", "\\u", "group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bindi", "ng", "\\u", "profile_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "bindi", "ng", "-", "profile", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "'<", "bindi", "ng", "-", "profile", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "parser", "actions_", "._", "Key", "Value", "Action_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Custom", " ", "data", " ", "to", " ", "be", " ", "pass", "ed", " ", "as", " ", "bindi", "ng", ":", "profile", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "key", ">=", "<", "value", ">", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "repeat", " ", "option", " ", "to", " ", "set", " ", "multiple", " ", "bindi", "ng", ":", "profile", " ", "data", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bindi", "ng", "\\u", "profile_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "-", "bindi", "ng", "-", "profile", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Clear", " ", "exist", "ing", " ", "informati", "on", " ", "of", " ", "bindi", "ng", ":", "profile", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"<", "port", ">\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Port", " ", "to", " ", "modif", "y", " ", "(", "name", " ", "or", " ", "ID", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Set", "Port_", "(_", "command_", "._", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "take", "\\u", "action_", "(_", "self_", ",_", "parsed", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "app_", "._", "client", "\\u", "manager_", "._", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "prepar", "e\\u", "fixed", "\\u", "ips_", "(_", "self_", "._", "app_", "._", "client", "\\u", "manager_", ",_", "parsed", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attrs_", "=_", "\\u", "get", "\\u", "attrs_", "(_", "self_", "._", "app_", "._", "client", "\\u", "manager_", ",_", "parsed", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "client_", "._", "find", "\\u", "port_", "(_", "parsed", "\\u", "args_", "._", "port_", ",_", "ignore", "\\u", "missing_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "bindi", "ng", ":", "profile", "'_", "in_", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "bindi", "ng", ":", "profile", "'_", "]_", "._", "update_", "(_", "obj_", "._", "bindi", "ng", "\\u", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "parsed", "\\u", "args_", "._", "no", "\\u", "bindi", "ng", "\\u", "profile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "bindi", "ng", ":", "profile", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "fixed", "\\u", "ips", "'_", "in_", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Whe", "n", " ", "user", " ", "unse", "ts", " ", "the", " ", "fixed", "\\u", "ips", ",", " ", "obj", ".", "fixed", "\\u", "ips", " ", "=", " ", "[{}]", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "the", " ", "obj", ".", "fixed", "\\u", "ips", " ", "list", " ", "to", " ", "attr", "s", "['", "fixed", "\\u", "ips", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wou", "ld", " ", "there", "fore", " ", "add", " ", "an", " ", "empty", " ", "dictionar", "y", ",", " ", "whi", "le", " ", "we", " ", "need", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "append", " ", "the", " ", "attr", "s", "['", "fixed", "\\u", "ips", "']", " ", "iff", " ", "there", " ", "is", " ", "some", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "obj", ".", "fixed", "\\u", "ips", ".", " ", "There", "fore", " ", "I", " ", "have", " ", "opt", "ed", " ", "for", " ", "this", " ", "`", "for", "`", " ", "loop_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "+=_", "[_", "ip_", "for_", "ip_", "in_", "obj_", "._", "fixed", "\\u", "ips_", "if_", "ip_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "parsed", "\\u", "args_", "._", "no", "\\u", "fixed", "\\u", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attrs_", "[_", "'", "fixed", "\\u", "ips", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "attrs_", "==_", "{_", "}_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "Not", "hing", " ", "specified", " ", "to", " ", "be", " ", "set", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exceptions_", "._", "Command", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client_", "._", "update", "\\u", "port_", "(_", "obj_", ",_", "**_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Show", "Port_", "(_", "command_", "._", "Show", "One_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Display", " ", "port", " ", "deta", "il", "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_", "[SEP]_", "class_", "Show", "Port_", "(_", "command_", "._", "Show", "One_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "parser_", "(_", "self_", ",_", "prog", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "super_", "(_", "Show", "Port_", ",_", "self_", ")_", "._", "get", "\\u", "parser_", "(_", "prog", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metavar_", "=_", "\"<", "port", ">\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\\u_", "(_", "\"", "Port", " ", "to", " ", "display", " ", "(", "name", " ", "or", " ", "ID", ")\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Show", "Port_", "(_", "command_", "._", "Show", "One_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "take", "\\u", "action_", "(_", "self_", ",_", "parsed", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", "=_", "self_", "._", "app_", "._", "client", "\\u", "manager_", "._", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "client_", "._", "find", "\\u", "port_", "(_", "parsed", "\\u", "args_", "._", "port_", ",_", "ignore", "\\u", "missing_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "columns_", "=_", "\\u", "get", "\\u", "columns_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "utils_", "._", "get", "\\u", "item", "\\u", "properties_", "(_", "obj_", ",_", "columns_", ",_", "formatters_", "=_", "\\u", "formatters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "columns_", ",_", "data_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
'import *' may pollute namespace
dcramer/logan/logan/runner.py
[ { "content": "\"\"\"\nlogan.runner\n~~~~~~~~~~~~\n\n:copyright: (c) 2012 David Cramer.\n:license: Apache License 2.0, see LICENSE for more details.\n\"\"\"\n\nfrom __future__ import absolute_import, print_function\n\nfrom django.core import management\nfrom optparse import OptionParser\nimport os\nimport re\nimport sys\n\nfrom logan import importer\nfrom logan.settings import create_default_settings\n\n\ntry:\n raw_input\nexcept NameError: # PYthon 3\n raw_input = input\n\n\n__configured = False\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n run_app()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "log", "an", ".", "runn", "er", "\\", "10", ";", "~~~~~~~~~~~", "~", "\\", "10", ";", "\\", "10", ";", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2012", " ", "Dav", "id", " ", "Cra", "mer", ".", "\\", "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_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "management_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "log", "an_", "import_", "importer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "log", "an_", "._", "settings_", "import_", "create", "\\u", "default", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "#", " ", "PY", "tho", "n", " ", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "input_", "=_", "input_", "\\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", "configured_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u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, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
AppScale/appscale/AppServer/lib/django-1.4/django/contrib/formtools/tests/wizard/storage.py
[ { "content": "from datetime import datetime\n\nfrom django.http import HttpRequest\nfrom django.conf import settings\nfrom django.utils.importlib import import_module\n\nfrom django.contrib.auth.models import User\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_request():\n request = HttpRequest()\n engine = import_module(settings.SESSION_ENGINE)\n request.session = engine.SessionStore(None)\n return request", "metadata": "root.get_request", "header": "['module', '___EOS___']", "index": 9 }, { "content": "class TestStorage(object):\n\n\n", "metadata": "root.TestStorage", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def setUp(self):\n self.testuser, created = User.objects.get_or_create(username='testuser1')", "metadata": "root.TestStorage.setUp", "header": "['class', 'TestStorage', '(', 'object', ')', ':', '___EOS___']", "index": 17 }, { "content": " def test_current_step(self):\n request = get_request()\n storage = self.get_storage()('wizard1', request, None)\n my_step = 2\n\n self.assertEqual(storage.current_step, None)\n\n storage.current_step = my_step\n self.assertEqual(storage.current_step, my_step)\n\n storage.reset()\n self.assertEqual(storage.current_step, None)\n\n storage.current_step = my_step\n storage2 = self.get_storage()('wizard2', request, None)\n self.assertEqual(storage2.current_step, None)", "metadata": "root.TestStorage.test_current_step", "header": "['class', 'TestStorage', '(', 'object', ')', ':', '___EOS___']", "index": 20 }, { "content": " def test_step_data(self):\n request = get_request()\n storage = self.get_storage()('wizard1', request, None)\n step1 = 'start'\n step_data1 = {'field1': 'data1',\n 'field2': 'data2',\n 'field3': datetime.now(),\n 'field4': self.testuser}\n\n self.assertEqual(storage.get_step_data(step1), None)\n\n storage.set_step_data(step1, step_data1)\n self.assertEqual(storage.get_step_data(step1), step_data1)\n\n storage.reset()\n self.assertEqual(storage.get_step_data(step1), None)\n\n storage.set_step_data(step1, step_data1)\n storage2 = self.get_storage()('wizard2', request, None)\n self.assertEqual(storage2.get_step_data(step1), None)", "metadata": "root.TestStorage.test_step_data", "header": "['class', 'TestStorage', '(', 'object', ')', ':', '___EOS___']", "index": 37 }, { "content": " def test_extra_context(self):\n request = get_request()\n storage = self.get_storage()('wizard1', request, None)\n extra_context = {'key1': 'data1',\n 'key2': 'data2',\n 'key3': datetime.now(),\n 'key4': self.testuser}\n\n self.assertEqual(storage.extra_data, {})\n\n storage.extra_data = extra_context\n self.assertEqual(storage.extra_data, extra_context)\n\n storage.reset()\n self.assertEqual(storage.extra_data, {})\n\n storage.extra_data = extra_context\n storage2 = self.get_storage()('wizard2', request, None)\n self.assertEqual(storage2.extra_data, {})", "metadata": "root.TestStorage.test_extra_context", "header": "['class', 'TestStorage', '(', 'object', ')', ':', '___EOS___']", "index": 58 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "importlib_", "import_", "import", "\\u", "module_", "\\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_", "\\u\\u\\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", "request_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "Http", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "=_", "import", "\\u", "module_", "(_", "settings_", "._", "SES", "SION", "\\u", "ENGINE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "=_", "engine_", "._", "Sess", "ion", "Store_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "class_", "Test", "Storage_", "(_", "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_", "[SEP]_", "class_", "Test", "Storage_", "(_", "object_", ")_", ":_", "\\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_", "._", "testu", "ser_", ",_", "created_", "=_", "User_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "username_", "=_", "'", "testu", "ser", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "current", "\\u", "step_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "get", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "storage_", "=_", "self_", "._", "get", "\\u", "storage_", "(_", ")_", "(_", "'", "wiz", "ard", "1", "'_", ",_", "request_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "\\u", "step_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage_", "._", "current", "\\u", "step_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "._", "current", "\\u", "step_", "=_", "my", "\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage_", "._", "current", "\\u", "step_", ",_", "my", "\\u", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage_", "._", "current", "\\u", "step_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "._", "current", "\\u", "step_", "=_", "my", "\\u", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "storage", "2_", "=_", "self_", "._", "get", "\\u", "storage_", "(_", ")_", "(_", "'", "wiz", "ard", "2", "'_", ",_", "request_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage", "2_", "._", "current", "\\u", "step_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "step", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "get", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "storage_", "=_", "self_", "._", "get", "\\u", "storage_", "(_", ")_", "(_", "'", "wiz", "ard", "1", "'_", ",_", "request_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "1_", "=_", "'", "start", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step", "\\u", "data1_", "=_", "{_", "'", "field", "1", "'_", ":_", "'", "data", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "2", "'_", ":_", "'", "data", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "3", "'_", ":_", "datetime_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "field", "4", "'_", ":_", "self_", "._", "testu", "ser_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage_", "._", "get", "\\u", "step", "\\u", "data_", "(_", "step", "1_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "._", "set\\u", "step", "\\u", "data_", "(_", "step", "1_", ",_", "step", "\\u", "data1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage_", "._", "get", "\\u", "step", "\\u", "data_", "(_", "step", "1_", ")_", ",_", "step", "\\u", "data1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage_", "._", "get", "\\u", "step", "\\u", "data_", "(_", "step", "1_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "._", "set\\u", "step", "\\u", "data_", "(_", "step", "1_", ",_", "step", "\\u", "data1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "storage", "2_", "=_", "self_", "._", "get", "\\u", "storage_", "(_", ")_", "(_", "'", "wiz", "ard", "2", "'_", ",_", "request_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage", "2_", "._", "get", "\\u", "step", "\\u", "data_", "(_", "step", "1_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Storage_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "extra", "\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "get", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "storage_", "=_", "self_", "._", "get", "\\u", "storage_", "(_", ")_", "(_", "'", "wiz", "ard", "1", "'_", ",_", "request_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "context_", "=_", "{_", "'", "key", "1", "'_", ":_", "'", "data", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "2", "'_", ":_", "'", "data", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "3", "'_", ":_", "datetime_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "4", "'_", ":_", "self_", "._", "testu", "ser_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage_", "._", "extra", "\\u", "data_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "._", "extra", "\\u", "data_", "=_", "extra", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage_", "._", "extra", "\\u", "data_", ",_", "extra", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage_", "._", "extra", "\\u", "data_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "storage_", "._", "extra", "\\u", "data_", "=_", "extra", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "storage", "2_", "=_", "self_", "._", "get", "\\u", "storage_", "(_", ")_", "(_", "'", "wiz", "ard", "2", "'_", ",_", "request_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "storage", "2_", "._", "extra", "\\u", "data_", ",_", "{_", "}_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
django/django/tests/template_tests/syntax_tests/test_if_equal.py
[ { "content": " @setup({'ifequal-split05': '{% ifequal a \\'i \"love\" you\\' %}yes{% else %}no{% endifequal %}'})\n def test_ifequal_split05(self):\n output = self.engine.render_to_string('ifequal-split05', {'a': ''})\n self.assertEqual(output, 'no')", "metadata": "root.IfEqualTagTests.test_ifequal_split05", "header": "['class', 'IfEqualTagTests', '(', 'SimpleTestCase', ')', ':', '___EOS___']", "index": 78 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "If", "Equal", "Ta", "g", "Tests_", "(_", "Simple", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "setup_", "(_", "{_", "'", "ife", "qual", "-", "split", "05", "'_", ":_", "'{", "%", " ", "ife", "qual", " ", "a", " ", "\\\\'", "i", " ", "\"", "love", "\"", " ", "you", "\\\\'", " ", "%}", "ye", "s", "{%", " ", "else", " ", "%}", "no", "{%", " ", "endi", "fe", "qual", " ", "%}", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "ife", "qual", "\\u", "split", "05_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "self_", "._", "engine_", "._", "render", "\\u", "to", "\\u", "string_", "(_", "'", "ife", "qual", "-", "split", "05", "'_", ",_", "{_", "'", "a", "'_", ":_", "''_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "output_", ",_", "'", "no", "'_", ")_", "\\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 ]
Redundant assignment
AppScale/appscale/AppServer/lib/yaml/lib/yaml/__init__.py
[ { "content": "def load(stream, Loader=Loader):\n \"\"\"\n Parse the first YAML document in a stream\n and produce the corresponding Python object.\n \"\"\"\n loader = Loader(stream)\n if loader.check_data():\n return loader.get_data()", "metadata": "root.load", "header": "['module', '___EOS___']", "index": 58 } ]
[]
[]
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "stream_", ",_", "Loader_", "=_", "Loader_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "the", " ", "first", " ", "YAM", "L", " ", "document", " ", "in", " ", "a", " ", "stream", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "produce", " ", "the", " ", "correspond", "ing", " ", "Pyth", "on", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loader_", "=_", "Loader_", "(_", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "loader_", "._", "check", "\\u", "data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "loader_", "._", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Redundant comparison
Southpaw-TACTIC/TACTIC/src/context/client/tactic-api-python-4.0.api04/Tools/versioncheck/pyversioncheck.py
[ { "content": "def _check1version(package, url, version, verbose=0):\n if verbose >= VERBOSE_EACHFILE:\n print ' Checking %s'%url\n try:\n fp = urllib.urlopen(url)\n except IOError, arg:\n if verbose >= VERBOSE_EACHFILE:\n print ' Cannot open:', arg\n return -1, None, None\n msg = rfc822.Message(fp, seekable=0)\n newversion = msg.getheader('current-version')\n if not newversion:\n if verbose >= VERBOSE_EACHFILE:\n print ' No \"Current-Version:\" header in URL or URL not found'\n return -1, None, None\n version = version.lower().strip()\n newversion = newversion.lower().strip()\n if version == newversion:\n if verbose >= VERBOSE_EACHFILE:\n print ' Version identical (%s)'%newversion\n return 1, version, fp\n else:\n if verbose >= VERBOSE_EACHFILE:\n print ' Versions different (installed: %s, new: %s)'% \\\n (version, newversion)\n return 0, newversion, fp", "metadata": "root._check1version", "header": "['module', '___EOS___']", "index": 46 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "1", "version_", "(_", "package_", ",_", "url_", ",_", "version_", ",_", "verbose_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbose_", ">=_", "VERBOS", "E", "\\u", "EAC", "HF", "ILE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", " ", " ", "Check", "ing", " ", "%", "s", "'_", "%_", "url_", "\\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 ", " _", "fp_", "=_", "urllib_", "._", "urlopen_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ",_", "arg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbose_", ">=_", "VERBOS", "E", "\\u", "EAC", "HF", "ILE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", " ", " ", " ", " ", "Cann", "ot", " ", "open", ":'_", ",_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "-_", "1_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "rfc", "822", "_", "._", "Message_", "(_", "fp_", ",_", "seek", "able_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newv", "ersion_", "=_", "msg_", "._", "getheader_", "(_", "'", "current", "-", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "newv", "ersion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbose_", ">=_", "VERBOS", "E", "\\u", "EAC", "HF", "ILE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", " ", " ", " ", " ", "No", " ", "\"", "Curr", "ent", "-", "Version", ":\"", " ", "header", " ", "in", " ", "URL", " ", "or", " ", "URL", " ", "not", " ", "found", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "-_", "1_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "version_", "=_", "version_", "._", "lower_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newv", "ersion_", "=_", "newv", "ersion_", "._", "lower_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "version_", "==_", "newv", "ersion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbose_", ">=_", "VERBOS", "E", "\\u", "EAC", "HF", "ILE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", " ", " ", " ", " ", "Version", " ", "identi", "cal", " ", "(%", "s", ")'_", "%_", "newv", "ersion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "1_", ",_", "version_", ",_", "fp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbose_", ">=_", "VERBOS", "E", "\\u", "EAC", "HF", "ILE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", " ", " ", " ", " ", "Version", "s", " ", "different", " ", "(", "install", "ed", ":", " ", "%", "s", ",", " ", "new", ":", " ", "%", "s", ")'_", "%_", "(_", "version_", ",_", "newv", "ersion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", ",_", "newv", "ersion_", ",_", "fp_", "\\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 ]
Redundant comparison
hyde/hyde/tests/test_site.py
[ { "content": "def test_node_url():\n s = Site(TEST_SITE_ROOT)\n r = RootNode(TEST_SITE_ROOT.child_folder('content'), s)\n assert not r.module\n n = r.add_node(TEST_SITE_ROOT.child_folder('content/blog'))\n assert n.url == '/' + n.relative_path\n assert n.url == '/blog'\n c = r.add_node(TEST_SITE_ROOT.child_folder('content/blog/2010/december'))\n assert c.url == '/' + c.relative_path\n assert c.url == '/blog/2010/december'", "metadata": "root.test_node_url", "header": "['module', '___EOS___']", "index": 50 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "node", "\\u", "url_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "Site_", "(_", "TEST", "\\u", "SITE", "\\u", "ROOT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "Roo", "t", "Node_", "(_", "TEST", "\\u", "SITE", "\\u", "ROOT_", "._", "child", "\\u", "folder_", "(_", "'", "content", "'_", ")_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "r_", "._", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "r_", "._", "add", "\\u", "node_", "(_", "TEST", "\\u", "SITE", "\\u", "ROOT_", "._", "child", "\\u", "folder_", "(_", "'", "content", "/", "blog", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n_", "._", "url_", "==_", "'/'_", "+_", "n_", "._", "relative", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n_", "._", "url_", "==_", "'/", "blog", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "r_", "._", "add", "\\u", "node_", "(_", "TEST", "\\u", "SITE", "\\u", "ROOT_", "._", "child", "\\u", "folder_", "(_", "'", "content", "/", "blog", "/", "2010", "/", "dece", "mber", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "c_", "._", "url_", "==_", "'/'_", "+_", "c_", "._", "relative", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "c_", "._", "url_", "==_", "'/", "blog", "/", "2010", "/", "dece", "mber", "'_", "\\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 ]
Unused import
openruko/gitmouth/gitmouth/checker.py
[ { "content": "import base64\n\nfrom twisted.conch.checkers import SSHPublicKeyDatabase\nfrom twisted.internet import reactor, defer\nfrom twisted.python import log\nfrom twisted.web.client import Agent\nfrom twisted.web.http_headers import Headers\nfrom twisted.conch.ssh.keys import Key\n\nfrom .extractors import UserExtractor\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class OpenRukoCredentialChecker(SSHPublicKeyDatabase):\n\n agent = Agent(reactor)\n\n", "metadata": "root.OpenRukoCredentialChecker", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __init__(self, settings):\n self.settings = settings", "metadata": "root.OpenRukoCredentialChecker.__init__", "header": "['class', 'OpenRukoCredentialChecker', '(', 'SSHPublicKeyDatabase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def checkKey(self, credentials):\n\n # dont bother checking until we've confirmed the key\n if not credentials.signature:\n return True\n\n cmp_key = Key.fromString(\n credentials.blob).fingerprint().replace(':', '')\n\n apiserver_base_url = '%s://%s:%d/' % (\n self.settings['apiserver_protocol'],\n self.settings['apiserver_hostname'],\n self.settings['apiserver_port']\n )\n\n lookup_url = '%sinternal/lookupUserByPublicKey?fingerprint=%s' % (\n apiserver_base_url ,cmp_key)\n\n log.msg(\"Checking fingerprint: \" + lookup_url)\n\n d = defer.Deferred()\n\n def cbResponse(resp):\n if resp.code == 200:\n resp.deliverBody(UserExtractor(d, cmp_key, credentials))\n else:\n log.err('Key auth failed for ' + cmp_key)\n d.errback(False)\n\n def cbErrResponse(failure):\n log.err('Unable to contact api server')\n d.errback(False)\n\n auth_key = base64.b64encode(':%s' % self.settings['apiserver_key'])\n headers = Headers({'Authorization': [' Basic %s' % auth_key]})\n\n req = self.agent.request('GET', lookup_url, headers=headers)\n req.addCallback(cbResponse)\n req.addErrback(cbErrResponse)\n\n return d", "metadata": "root.OpenRukoCredentialChecker.checkKey", "header": "['class', 'OpenRukoCredentialChecker', '(', 'SSHPublicKeyDatabase', ')', ':', '___EOS___']", "index": 19 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "conc", "h_", "._", "checkers", "_", "import_", "SSH", "Public", "Key", "Database_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "reactor_", ",_", "defer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "web_", "._", "client_", "import_", "Agent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "web_", "._", "http", "\\u", "headers_", "import_", "Headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "conc", "h_", "._", "ssh_", "._", "keys_", "import_", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "extractors", "_", "import_", "User", "Extractor_", "\\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_", "Open", "Ru", "ko", "Cred", "ential", "Checker_", "(_", "SSH", "Public", "Key", "Database_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "agent_", "=_", "Agent_", "(_", "reactor_", ")_", "\\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_", "Open", "Ru", "ko", "Cred", "ential", "Checker_", "(_", "SSH", "Public", "Key", "Database_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "settings_", "=_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Open", "Ru", "ko", "Cred", "ential", "Checker_", "(_", "SSH", "Public", "Key", "Database_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Key_", "(_", "self_", ",_", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "t", " ", "bot", "her", " ", "checking", " ", "unti", "l", " ", "we", "'", "ve", " ", "confirm", "ed", " ", "the", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "credentials_", "._", "signature_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmp", "\\u", "key_", "=_", "Key_", "._", "from", "String_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "credentials_", "._", "blob_", ")_", "._", "fingerprint_", "(_", ")_", "._", "replace_", "(_", "':'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "apis", "erver", "\\u", "base", "\\u", "url_", "=_", "'%", "s", "://", "%", "s", ":", "%", "d", "/'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "settings_", "[_", "'", "apis", "erver", "\\u", "protoc", "ol", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "settings_", "[_", "'", "apis", "erver", "\\u", "host", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "settings_", "[_", "'", "apis", "erver", "\\u", "port", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "look", "up", "\\u", "url_", "=_", "'%", "sint", "erna", "l", "/", "look", "up", "User", "By", "Public", "Key", "?", "fingerprint", "=", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "apis", "erver", "\\u", "base", "\\u", "url_", ",_", "cmp", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "msg_", "(_", "\"", "Check", "ing", " ", "fingerprint", ":", " ", "\"_", "+_", "look", "up", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "defer_", "._", "Deferred_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "cb", "Response_", "(_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "resp_", "._", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "._", "deliver", "Body_", "(_", "User", "Extractor_", "(_", "d_", ",_", "cmp", "\\u", "key_", ",_", "credentials_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "err_", "(_", "'", "Key", " ", "auth", " ", "fail", "ed", " ", "for", " ", "'_", "+_", "cmp", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "errback", "_", "(_", "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_", "def_", "cb", "Err", "Response_", "(_", "failure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "err_", "(_", "'", "Una", "ble", " ", "to", " ", "contact", " ", "api", " ", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "errback", "_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "auth", "\\u", "key_", "=_", "base64_", "._", "b64encode_", "(_", "':", "%", "s", "'_", "%_", "self_", "._", "settings_", "[_", "'", "apis", "erver", "\\u", "key", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "Headers_", "(_", "{_", "'", "Authoriz", "ation", "'_", ":_", "[_", "'", " ", "Basic", " ", "%", "s", "'_", "%_", "auth", "\\u", "key_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "req_", "=_", "self_", "._", "agent_", "._", "request_", "(_", "'", "GET", "'_", ",_", "look", "up", "\\u", "url_", ",_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "add", "Callback_", "(_", "cb", "Response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "add", "Errback_", "(_", "cb", "Err", "Response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "d_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
gmr/rabbitpy/tests/queue_tests.py
[ { "content": " def test_dead_letter_routing_key_assign_raises_type_error(self):\n def assign_value():\n self.queue.dead_letter_routing_key = 1234\n self.assertRaises(ValueError, assign_value)", "metadata": "root.QueueAssignmentTests.test_dead_letter_routing_key_assign_raises_type_error", "header": "['class', 'QueueAssignmentTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 341 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Queue", "Assign", "ment", "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", "dead", "\\u", "letter", "\\u", "routin", "g", "\\u", "key", "\\u", "assign", "\\u", "raise", "s", "\\u", "type", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "assign", "\\u", "value_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "queue_", "._", "dead", "\\u", "letter", "\\u", "routin", "g", "\\u", "key_", "=_", "1234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "assign", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
CiscoSystems/avos/openstack_dashboard/dashboards/admin/defaults/views.py
[ { "content": " def get_initial(self):\n initial = super(UpdateDefaultQuotasView, self).get_initial()\n\n # get initial quota defaults\n try:\n quota_defaults = quotas.get_default_quota_data(self.request)\n for field in (quotas.QUOTA_FIELDS + quotas.MISSING_QUOTA_FIELDS):\n initial[field] = quota_defaults.get(field).limit\n\n except Exception:\n error_msg = _('Unable to retrieve default quota values.')\n self.add_error_to_step(error_msg, 'update_default_quotas')\n\n return initial", "metadata": "root.UpdateDefaultQuotasView.get_initial", "header": "['class', 'UpdateDefaultQuotasView', '(', 'workflows', '.', 'WorkflowView', ')', ':', '___EOS___']", "index": 33 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Update", "Default", "Quota", "s", "View_", "(_", "workflows_", "._", "Work", "flow", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "initial_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "=_", "super_", "(_", "Update", "Default", "Quota", "s", "View_", ",_", "self_", ")_", "._", "get", "\\u", "initial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "initial", " ", "quot", "a", " ", "defaults_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quot", "a", "\\u", "defaults_", "=_", "quotas_", "._", "get", "\\u", "default", "\\u", "quot", "a", "\\u", "data_", "(_", "self_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "(_", "quotas_", "._", "QUOTA", "\\u", "FIELDS_", "+_", "quotas_", "._", "MISSING", "\\u", "QUOTA", "\\u", "FIELDS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "[_", "field_", "]_", "=_", "quot", "a", "\\u", "defaults_", "._", "get_", "(_", "field_", ")_", "._", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "msg_", "=_", "\\u_", "(_", "'", "Una", "ble", " ", "to", " ", "retrieve", " ", "default", " ", "quot", "a", " ", "values", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "error", "\\u", "to", "\\u", "step_", "(_", "error", "\\u", "msg_", ",_", "'", "update", "\\u", "default", "\\u", "quotas", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "initial_" ]
[ 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 ]
Unused import
sympy/sympy/sympy/printing/fcode.py
[ { "content": "\"\"\"\nFortran code printer\n\nThe FCodePrinter converts single sympy expressions into single Fortran\nexpressions, using the functions defined in the Fortran 77 standard where\npossible. Some useful pointers to Fortran can be found on wikipedia:\n\nhttp://en.wikipedia.org/wiki/Fortran\n\nMost of the code below is based on the \"Professional Programmer\\'s Guide to\nFortran77\" by Clive G. Page:\n\nhttp://www.star.le.ac.uk/~cgp/prof77.html\n\nFortran is a case-insensitive language. This might cause trouble because\nSymPy is case sensitive. The implementation below does not care and leaves\nthe responsibility for generating properly cased Fortran code to the user.\n\"\"\"\n\nfrom __future__ import print_function, division\n\nimport string\n\nfrom sympy.core import S, Add, N\nfrom sympy.core.compatibility import string_types, range\nfrom sympy.core.function import Function\nfrom sympy.printing.codeprinter import CodePrinter, Assignment\nfrom sympy.printing.precedence import precedence\n\nknown_functions = {\n \"sin\": \"sin\",\n \"cos\": \"cos\",\n \"tan\": \"tan\",\n \"asin\": \"asin\",\n \"acos\": \"acos\",\n \"atan\": \"atan\",\n \"atan2\": \"atan2\",\n \"sinh\": \"sinh\",\n \"cosh\": \"cosh\",\n \"tanh\": \"tanh\",\n \"log\": \"log\",\n \"exp\": \"exp\",\n \"erf\": \"erf\",\n \"Abs\": \"Abs\",\n \"sign\": \"sign\",\n \"conjugate\": \"conjg\"\n}\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class FCodePrinter(CodePrinter):\n \"\"\"A printer to convert sympy expressions to strings of Fortran code\"\"\"\n printmethod = \"_fcode\"\n language = \"Fortran\"\n\n _default_settings = {\n 'order': None,\n 'full_prec': 'auto',\n 'precision': 15,\n 'user_functions': {},\n 'human': True,\n 'source_format': 'fixed',\n 'contract': True,\n 'standard': 77\n }\n\n _operators = {\n 'and': '.and.',\n 'or': '.or.',\n 'xor': '.neqv.',\n 'equivalent': '.eqv.',\n 'not': '.not. ',\n }\n\n _relationals = {\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.FCodePrinter", "header": "['module', '___EOS___']", "index": 48 }, { "content": " def __init__(self, settings={}):\n CodePrinter.__init__(self, settings)\n self.known_functions = dict(known_functions)\n userfuncs = settings.get('user_functions', {})\n self.known_functions.update(userfuncs)\n # leading columns depend on fixed or free format\n if self._settings['source_format'] == 'fixed':\n self._lead_code = \" \"\n self._lead_cont = \" @ \"\n self._lead_comment = \"C \"\n elif self._settings['source_format'] == 'free':\n self._lead_code = \"\"\n self._lead_cont = \" \"\n self._lead_comment = \"! \"\n else:\n raise ValueError(\"Unknown source format: %s\" % self._settings[\n 'source_format'])\n standards = {66, 77, 90, 95, 2003, 2008}\n if self._settings['standard'] not in standards:\n raise ValueError(\"Unknown Fortran standard: %s\" % self._settings[\n 'standard'])", "metadata": "root.FCodePrinter.__init__", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 76 }, { "content": " def _rate_index_position(self, p):\n return -p*5", "metadata": "root.FCodePrinter._rate_index_position", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 98 }, { "content": " def _get_statement(self, codestring):\n return codestring", "metadata": "root.FCodePrinter._get_statement", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 101 }, { "content": " def _get_comment(self, text):\n return \"! {0}\".format(text)", "metadata": "root.FCodePrinter._get_comment", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 104 }, { "content": " def _declare_number_const(self, name, value):\n return \"parameter ({0} = {1})\".format(name, value)", "metadata": "root.FCodePrinter._declare_number_const", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 107 }, { "content": " def _format_code(self, lines):\n return self._wrap_fortran(self.indent_code(lines))", "metadata": "root.FCodePrinter._format_code", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 110 }, { "content": " def _traverse_matrix_indices(self, mat):\n rows, cols = mat.shape\n return ((i, j) for j in range(cols) for i in range(rows))", "metadata": "root.FCodePrinter._traverse_matrix_indices", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 113 }, { "content": " def _get_loop_opening_ending(self, indices):\n open_lines = []\n close_lines = []\n for i in indices:\n # fortran arrays start at 1 and end at dimension\n var, start, stop = map(self._print,\n [i.label, i.lower + 1, i.upper + 1])\n open_lines.append(\"do %s = %s, %s\" % (var, start, stop))\n close_lines.append(\"end do\")\n return open_lines, close_lines", "metadata": "root.FCodePrinter._get_loop_opening_ending", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 117 }, { "content": " def _print_Piecewise(self, expr):\n if expr.args[-1].cond != True:\n # We need the last conditional to be a True, otherwise the resulting\n # function may not return a result.\n raise ValueError(\"All Piecewise expressions must contain an \"\n \"(expr, True) statement to be used as a default \"\n \"condition. Without one, the generated \"\n \"expression may not evaluate to anything under \"\n \"some condition.\")\n lines = []\n if expr.has(Assignment):\n for i, (e, c) in enumerate(expr.args):\n if i == 0:\n lines.append(\"if (%s) then\" % self._print(c))\n elif i == len(expr.args) - 1 and c == True:\n lines.append(\"else\")\n else:\n lines.append(\"else if (%s) then\" % self._print(c))\n lines.append(self._print(e))\n lines.append(\"end if\")\n return \"\\n\".join(lines)\n elif self._settings[\"standard\"] >= 95:\n # Only supported in F95 and newer:\n # The piecewise was used in an expression, need to do inline\n # operators. This has the downside that inline operators will\n # not work for statements that span multiple lines (Matrix or\n # Indexed expressions).\n pattern = \"merge({T}, {F}, {COND})\"\n code = self._print(expr.args[-1].expr)\n terms = list(expr.args[:-1])\n while terms:\n e, c = terms.pop()\n expr = self._print(e)\n cond = self._print(c)\n code = pattern.format(T=expr, F=code, COND=cond)\n return code\n else:\n # `merge` is not supported prior to F95\n raise NotImplementedError(\"Using Piecewise as an expression using \"\n \"inline operators is not supported in \"\n \"standards earlier than Fortran95.\")", "metadata": "root.FCodePrinter._print_Piecewise", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 128 }, { "content": " def _print_MatrixElement(self, expr):\n return \"{0}({1}, {2})\".format(expr.parent, expr.i + 1, expr.j + 1)", "metadata": "root.FCodePrinter._print_MatrixElement", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 170 }, { "content": " def _print_Add(self, expr):\n # purpose: print complex numbers nicely in Fortran.\n # collect the purely real and purely imaginary parts:\n pure_real = []\n pure_imaginary = []\n mixed = []\n for arg in expr.args:\n if arg.is_number and arg.is_real:\n pure_real.append(arg)\n elif arg.is_number and arg.is_imaginary:\n pure_imaginary.append(arg)\n else:\n mixed.append(arg)\n if len(pure_imaginary) > 0:\n if len(mixed) > 0:\n PREC = precedence(expr)\n term = Add(*mixed)\n t = self._print(term)\n if t.startswith('-'):\n sign = \"-\"\n t = t[1:]\n else:\n sign = \"+\"\n if precedence(term) < PREC:\n t = \"(%s)\" % t\n\n return \"cmplx(%s,%s) %s %s\" % (\n self._print(Add(*pure_real)),\n self._print(-S.ImaginaryUnit*Add(*pure_imaginary)),\n sign, t,\n )\n else:\n return \"cmplx(%s,%s)\" % (\n self._print(Add(*pure_real)),\n self._print(-S.ImaginaryUnit*Add(*pure_imaginary)),\n )\n else:\n return CodePrinter._print_Add(self, expr)", "metadata": "root.FCodePrinter._print_Add", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 173 }, { "content": " def _print_Function(self, expr):\n # All constant function args are evaluated as floats\n prec = self._settings['precision']\n args = [N(a, prec) for a in expr.args]\n eval_expr = expr.func(*args)\n if not isinstance(eval_expr, Function):\n return self._print(eval_expr)\n else:\n return CodePrinter._print_Function(self, expr.func(*args))", "metadata": "root.FCodePrinter._print_Function", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 212 }, { "content": " def _print_ImaginaryUnit(self, expr):\n # purpose: print complex numbers nicely in Fortran.\n return \"cmplx(0,1)\"", "metadata": "root.FCodePrinter._print_ImaginaryUnit", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 222 }, { "content": " def _print_int(self, expr):\n return str(expr)", "metadata": "root.FCodePrinter._print_int", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 226 }, { "content": " def _print_Mul(self, expr):\n # purpose: print complex numbers nicely in Fortran.\n if expr.is_number and expr.is_imaginary:\n return \"cmplx(0,%s)\" % (\n self._print(-S.ImaginaryUnit*expr)\n )\n else:\n return CodePrinter._print_Mul(self, expr)", "metadata": "root.FCodePrinter._print_Mul", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 229 }, { "content": " def _print_Pow(self, expr):\n PREC = precedence(expr)\n if expr.exp == -1:\n return '1.0/%s' % (self.parenthesize(expr.base, PREC))\n elif expr.exp == 0.5:\n if expr.base.is_integer:\n # Fortan intrinsic sqrt() does not accept integer argument\n if expr.base.is_Number:\n return 'sqrt(%s.0d0)' % self._print(expr.base)\n else:\n return 'sqrt(dble(%s))' % self._print(expr.base)\n else:\n return 'sqrt(%s)' % self._print(expr.base)\n else:\n return CodePrinter._print_Pow(self, expr)", "metadata": "root.FCodePrinter._print_Pow", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 238 }, { "content": " def _print_Rational(self, expr):\n p, q = int(expr.p), int(expr.q)\n return \"%d.0d0/%d.0d0\" % (p, q)", "metadata": "root.FCodePrinter._print_Rational", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 254 }, { "content": " def _print_Float(self, expr):\n printed = CodePrinter._print_Float(self, expr)\n e = printed.find('e')\n if e > -1:\n return \"%sd%s\" % (printed[:e], printed[e + 1:])\n return \"%sd0\" % printed", "metadata": "root.FCodePrinter._print_Float", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 258 }, { "content": " def _print_Indexed(self, expr):\n inds = [ self._print(i) for i in expr.indices ]\n return \"%s(%s)\" % (self._print(expr.base.label), \", \".join(inds))", "metadata": "root.FCodePrinter._print_Indexed", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 265 }, { "content": " def _print_Idx(self, expr):\n return self._print(expr.label)", "metadata": "root.FCodePrinter._print_Idx", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 269 }, { "content": " def _pad_leading_columns(self, lines):\n result = []\n for line in lines:\n if line.startswith('!'):\n result.append(self._lead_comment + line[1:].lstrip())\n else:\n result.append(self._lead_code + line)\n return result", "metadata": "root.FCodePrinter._pad_leading_columns", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 272 }, { "content": " def _wrap_fortran(self, lines):\n \"\"\"Wrap long Fortran lines\n\n Argument:\n lines -- a list of lines (without \\\\n character)\n\n A comment line is split at white space. Code lines are split with a more\n complex rule to give nice results.\n \"\"\"\n # routine to find split point in a code line\n my_alnum = set(\"_+-.\" + string.digits + string.ascii_letters)\n my_white = set(\" \\t()\")\n\n def split_pos_code(line, endpos):\n if len(line) <= endpos:\n return len(line)\n pos = endpos\n split = lambda pos: \\\n (line[pos] in my_alnum and line[pos - 1] not in my_alnum) or \\\n (line[pos] not in my_alnum and line[pos - 1] in my_alnum) or \\\n (line[pos] in my_white and line[pos - 1] not in my_white) or \\\n (line[pos] not in my_white and line[pos - 1] in my_white)\n while not split(pos):\n pos -= 1\n if pos == 0:\n return endpos\n return pos\n # split line by line and add the splitted lines to result\n result = []\n if self._settings['source_format'] == 'free':\n trailing = ' &'\n else:\n trailing = ''\n for line in lines:\n if line.startswith(self._lead_comment):\n # comment line\n if len(line) > 72:\n pos = line.rfind(\" \", 6, 72)\n if pos == -1:\n pos = 72\n hunk = line[:pos]\n line = line[pos:].lstrip()\n result.append(hunk)\n while len(line) > 0:\n pos = line.rfind(\" \", 0, 66)\n if pos == -1 or len(line) < 66:\n pos = 66\n hunk = line[:pos]\n line = line[pos:].lstrip()\n result.append(\"%s%s\" % (self._lead_comment, hunk))\n else:\n result.append(line)\n elif line.startswith(self._lead_code):\n # code line\n pos = split_pos_code(line, 72)\n hunk = line[:pos].rstrip()\n line = line[pos:].lstrip()\n if line:\n hunk += trailing\n result.append(hunk)\n while len(line) > 0:\n pos = split_pos_code(line, 65)\n hunk = line[:pos].rstrip()\n line = line[pos:].lstrip()\n if line:\n hunk += trailing\n result.append(\"%s%s\" % (self._lead_cont, hunk))\n else:\n result.append(line)\n return result", "metadata": "root.FCodePrinter._wrap_fortran", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 281 }, { "content": " def indent_code(self, code):\n \"\"\"Accepts a string of code or a list of code lines\"\"\"\n if isinstance(code, string_types):\n code_lines = self.indent_code(code.splitlines(True))\n return ''.join(code_lines)\n\n free = self._settings['source_format'] == 'free'\n code = [ line.lstrip(' \\t') for line in code ]\n\n inc_keyword = ('do ', 'if(', 'if ', 'do\\n', 'else')\n dec_keyword = ('end do', 'enddo', 'end if', 'endif', 'else')\n\n increase = [ int(any(map(line.startswith, inc_keyword)))\n for line in code ]\n decrease = [ int(any(map(line.startswith, dec_keyword)))\n for line in code ]\n continuation = [ int(any(map(line.endswith, ['&', '&\\n'])))\n for line in code ]\n\n level = 0\n cont_padding = 0\n tabwidth = 3\n new_code = []\n for i, line in enumerate(code):\n if line == '' or line == '\\n':\n new_code.append(line)\n continue\n level -= decrease[i]\n\n if free:\n padding = \" \"*(level*tabwidth + cont_padding)\n else:\n padding = \" \"*level*tabwidth\n\n line = \"%s%s\" % (padding, line)\n if not free:\n line = self._pad_leading_columns([line])[0]\n\n new_code.append(line)\n\n if continuation[i]:\n cont_padding = 2*tabwidth\n else:\n cont_padding = 0\n level += increase[i]\n\n if not free:\n return self._wrap_fortran(new_code)\n return new_code", "metadata": "root.FCodePrinter.indent_code", "header": "['class', 'FCodePrinter', '(', 'CodePrinter', ')', ':', '___EOS___']", "index": 352 }, { "content": "def fcode(expr, assign_to=None, **settings):\n \"\"\"Converts an expr to a string of c code\n\n Parameters\n ==========\n\n expr : Expr\n A sympy expression to be converted.\n assign_to : optional\n When given, the argument is used as the name of the variable to which\n the expression is assigned. Can be a string, ``Symbol``,\n ``MatrixSymbol``, or ``Indexed`` type. This is helpful in case of\n line-wrapping, or for expressions that generate multi-line statements.\n precision : integer, optional\n The precision for numbers such as pi [default=15].\n user_functions : dict, optional\n A dictionary where keys are ``FunctionClass`` instances and values are\n their string representations. Alternatively, the dictionary value can\n be a list of tuples i.e. [(argument_test, cfunction_string)]. See below\n for examples.\n human : bool, optional\n If True, the result is a single string that may contain some constant\n declarations for the number symbols. If False, the same information is\n returned in a tuple of (symbols_to_declare, not_supported_functions,\n code_text). [default=True].\n contract: bool, optional\n If True, ``Indexed`` instances are assumed to obey tensor contraction\n rules and the corresponding nested loops over indices are generated.\n Setting contract=False will not generate loops, instead the user is\n responsible to provide values for the indices in the code.\n [default=True].\n source_format : optional\n The source format can be either 'fixed' or 'free'. [default='fixed']\n standard : integer, optional\n The Fortran standard to be followed. This is specified as an integer.\n Acceptable standards are 66, 77, 90, 95, 2003, and 2008. Default is 77.\n Note that currently the only distinction internally is between\n standards before 95, and those 95 and after. This may change later as\n more features are added.\n\n Examples\n ========\n\n >>> from sympy import fcode, symbols, Rational, sin, ceiling, floor\n >>> x, tau = symbols(\"x, tau\")\n >>> fcode((2*tau)**Rational(7, 2))\n ' 8*sqrt(2.0d0)*tau**(7.0d0/2.0d0)'\n >>> fcode(sin(x), assign_to=\"s\")\n ' s = sin(x)'\n\n Custom printing can be defined for certain types by passing a dictionary of\n \"type\" : \"function\" to the ``user_functions`` kwarg. Alternatively, the\n dictionary value can be a list of tuples i.e. [(argument_test,\n cfunction_string)].\n\n >>> custom_functions = {\n ... \"ceiling\": \"CEIL\",\n ... \"floor\": [(lambda x: not x.is_integer, \"FLOOR1\"),\n ... (lambda x: x.is_integer, \"FLOOR2\")]\n ... }\n >>> fcode(floor(x) + ceiling(x), user_functions=custom_functions)\n ' CEIL(x) + FLOOR1(x)'\n\n ``Piecewise`` expressions are converted into conditionals. If an\n ``assign_to`` variable is provided an if statement is created, otherwise\n the ternary operator is used. Note that if the ``Piecewise`` lacks a\n default term, represented by ``(expr, True)`` then an error will be thrown.\n This is to prevent generating an expression that may not evaluate to\n anything.\n\n >>> from sympy import Piecewise\n >>> expr = Piecewise((x + 1, x > 0), (x, True))\n >>> print(fcode(expr, tau))\n if (x > 0) then\n tau = x + 1\n else\n tau = x\n end if\n\n Support for loops is provided through ``Indexed`` types. With\n ``contract=True`` these expressions will be turned into loops, whereas\n ``contract=False`` will just print the assignment expression that should be\n looped over:\n\n >>> from sympy import Eq, IndexedBase, Idx\n >>> len_y = 5\n >>> y = IndexedBase('y', shape=(len_y,))\n >>> t = IndexedBase('t', shape=(len_y,))\n >>> Dy = IndexedBase('Dy', shape=(len_y-1,))\n >>> i = Idx('i', len_y-1)\n >>> e=Eq(Dy[i], (y[i+1]-y[i])/(t[i+1]-t[i]))\n >>> fcode(e.rhs, assign_to=e.lhs, contract=False)\n ' Dy(i) = (y(i + 1) - y(i))/(t(i + 1) - t(i))'\n\n Matrices are also supported, but a ``MatrixSymbol`` of the same dimensions\n must be provided to ``assign_to``. Note that any expression that can be\n generated normally can also exist inside a Matrix:\n\n >>> from sympy import Matrix, MatrixSymbol\n >>> mat = Matrix([x**2, Piecewise((x + 1, x > 0), (x, True)), sin(x)])\n >>> A = MatrixSymbol('A', 3, 1)\n >>> print(fcode(mat, A))\n A(1, 1) = x**2\n if (x > 0) then\n A(2, 1) = x + 1\n else\n A(2, 1) = x\n end if\n A(3, 1) = sin(x)\n \"\"\"\n\n return FCodePrinter(settings).doprint(expr, assign_to)", "metadata": "root.fcode", "header": "['module', '___EOS___']", "index": 403 }, { "content": "def print_fcode(expr, **settings):\n \"\"\"Prints the Fortran representation of the given expression.\n\n See fcode for the meaning of the optional arguments.\n \"\"\"\n print(fcode(expr, **settings))", "metadata": "root.print_fcode", "header": "['module', '___EOS___']", "index": 517 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Fort", "ran", " ", "code", " ", "printer", "\\", "10", ";", "\\", "10", ";", "The", " ", "FC", "ode", "Print", "er", " ", "convert", "s", " ", "single", " ", "symp", "y", " ", "express", "ion", "s", " ", "int", "o", " ", "single", " ", "Fort", "ran", "\\", "10", ";", "express", "ion", "s", ",", " ", "usi", "ng", " ", "the", " ", "function", "s", " ", "defin", "ed", " ", "in", " ", "the", " ", "Fort", "ran", " ", "7", "7", " ", "standard", " ", "where", "\\", "10", ";", "possib", "le", ".", " ", "Some", " ", "usef", "ul", " ", "pointers", " ", "to", " ", "Fort", "ran", " ", "can", " ", "be", " ", "found", " ", "on", " ", "wikip", "edia", ":", "\\", "10", ";", "\\", "10", ";", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "Fort", "ran", "\\", "10", ";", "\\", "10", ";", "Mos", "t", " ", "of", " ", "the", " ", "code", " ", "belo", "w", " ", "is", " ", "based", " ", "on", " ", "the", " ", "\"", "Profess", "ional", " ", "Programm", "er", "\\\\'", "s", " ", "Guide", " ", "to", "\\", "10", ";", "Fort", "ran", "7", "7", "\"", " ", "by", " ", "Cli", "ve", " ", "G", ".", " ", "Page", ":", "\\", "10", ";", "\\", "10", ";", "http", "://", "www", ".", "star", ".", "le", ".", "ac", ".", "uk", "/", "~", "cg", "p", "/", "prof", "77.", "html", "\\", "10", ";", "\\", "10", ";", "Fort", "ran", " ", "is", " ", "a", " ", "case", "-", "inse", "nsitive", " ", "language", ".", " ", "Thi", "s", " ", "mig", "ht", " ", "caus", "e", " ", "trouble", " ", "bec", "aus", "e", "\\", "10", ";", "Sym", "Py", " ", "is", " ", "case", " ", "sensi", "tiv", "e", ".", " ", "The", " ", "implementation", " ", "belo", "w", " ", "doe", "s", " ", "not", " ", "care", " ", "and", " ", "lea", "ves", "\\", "10", ";", "the", " ", "responsib", "ilit", "y", " ", "for", " ", "generat", "ing", " ", "proper", "ly", " ", "case", "d", " ", "Fort", "ran", " ", "code", " ", "to", " ", "the", " ", "user", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", ",_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sympy_", "._", "core_", "import_", "S_", ",_", "Add_", ",_", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "core_", "._", "compatibility", "_", "import_", "string", "\\u", "types_", ",_", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "core_", "._", "function_", "import_", "Function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "printin", "g_", "._", "code", "printer_", "import_", "Code", "Printer_", ",_", "Assignment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sympy_", "._", "printin", "g_", "._", "preceden", "ce_", "import_", "preceden", "ce_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "know", "n", "\\u", "functions_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sin", "\"_", ":_", "\"", "sin", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cos", "\"_", ":_", "\"", "cos", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tan", "\"_", ":_", "\"", "tan", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "asin", "\"_", ":_", "\"", "asin", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "acos", "\"_", ":_", "\"", "acos", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "atan", "\"_", ":_", "\"", "atan", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "atan", "2", "\"_", ":_", "\"", "atan", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sinh", "\"_", ":_", "\"", "sinh", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cos", "h", "\"_", ":_", "\"", "cos", "h", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tan", "h", "\"_", ":_", "\"", "tan", "h", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "log", "\"_", ":_", "\"", "log", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "exp", "\"_", ":_", "\"", "exp", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "erf", "\"_", ":_", "\"", "erf", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Abs", "\"_", ":_", "\"", "Abs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sign", "\"_", ":_", "\"", "sign", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "conjugate", "\"_", ":_", "\"", "conj", "g", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "printer", " ", "to", " ", "convert", " ", "symp", "y", " ", "express", "ion", "s", " ", "to", " ", "string", "s", " ", "of", " ", "Fort", "ran", " ", "code", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "method_", "=_", "\"\\u", "fco", "de", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "language_", "=_", "\"", "Fort", "ran", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "default", "\\u", "settings_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "full", "\\u", "prec", "'_", ":_", "'", "auto", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "preci", "sion", "'_", ":_", "15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "function", "s", "'_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "human", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "format", "'_", ":_", "'", "fixed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contract", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "standard", "'_", ":_", "77_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "operators_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "and", "'_", ":_", "'.", "and", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "or", "'_", ":_", "'.", "or", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xor", "'_", ":_", "'.", "neq", "v", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "equivalent", "'_", ":_", "'.", "eq", "v", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "not", "'_", ":_", "'.", "not", ".", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "relation", "als_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'!='_", ":_", "'/", "='_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "settings_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Code", "Printer_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "know", "n", "\\u", "functions_", "=_", "dict_", "(_", "know", "n", "\\u", "functions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "funcs_", "=_", "settings_", "._", "get_", "(_", "'", "user", "\\u", "function", "s", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "know", "n", "\\u", "functions_", "._", "update_", "(_", "user", "funcs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "lead", "ing", " ", "column", "s", " ", "depend", " ", "on", " ", "fixed", " ", "or", " ", "free", " ", "format_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "settings_", "[_", "'", "source", "\\u", "format", "'_", "]_", "==_", "'", "fixed", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lead", "\\u", "code_", "=_", "\"", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lead", "\\u", "cont_", "=_", "\"", " ", "@", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lead", "\\u", "comment_", "=_", "\"", "C", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "settings_", "[_", "'", "source", "\\u", "format", "'_", "]_", "==_", "'", "free", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lead", "\\u", "code_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lead", "\\u", "cont_", "=_", "\"", " ", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lead", "\\u", "comment_", "=_", "\"!", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Un", "know", "n", " ", "source", " ", "format", ":", " ", "%", "s", "\"_", "%_", "self_", "._", "\\u", "settings_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "standard", "s_", "=_", "{_", "66_", ",_", "77_", ",_", "90_", ",_", "95_", ",_", "2003", "_", ",_", "2008_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "settings_", "[_", "'", "standard", "'_", "]_", "not_", "in_", "standard", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Un", "know", "n", " ", "Fort", "ran", " ", "standard", ":", " ", "%", "s", "\"_", "%_", "self_", "._", "\\u", "settings_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "standard", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\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", "rate", "\\u", "index", "\\u", "position_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "p_", "*_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "statement_", "(_", "self_", ",_", "codes", "tring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "codes", "tring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "comment_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"!", " ", "{", "0", "}\"_", "._", "format_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "declar", "e\\u", "number", "\\u", "const_", "(_", "self_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "parameter", " ", "({", "0", "}", " ", "=", " ", "{", "1", "})\"_", "._", "format_", "(_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "format\\u", "code_", "(_", "self_", ",_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "wrap", "\\u", "fortran", "_", "(_", "self_", "._", "indent", "\\u", "code_", "(_", "lines_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "traverse", "\\u", "matrix", "\\u", "indices_", "(_", "self_", ",_", "mat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", ",_", "cols_", "=_", "mat_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "(_", "i_", ",_", "j_", ")_", "for_", "j_", "in_", "range_", "(_", "cols_", ")_", "for_", "i_", "in_", "range_", "(_", "rows_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "loop", "\\u", "opening", "\\u", "ending_", "(_", "self_", ",_", "indices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "open", "\\u", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "close", "\\u", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "indices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "fortran", " ", "arrays", " ", "start", " ", "at", " ", "1", " ", "and", " ", "end", " ", "at", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "var_", ",_", "start_", ",_", "stop_", "=_", "map_", "(_", "self_", "._", "\\u", "print_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "i_", "._", "label_", ",_", "i_", "._", "lower_", "+_", "1_", ",_", "i_", "._", "upper_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open", "\\u", "lines_", "._", "append_", "(_", "\"", "do", " ", "%", "s", " ", "=", " ", "%", "s", ",", " ", "%", "s", "\"_", "%_", "(_", "var_", ",_", "start_", ",_", "stop_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "close", "\\u", "lines_", "._", "append_", "(_", "\"", "end", " ", "do", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "open", "\\u", "lines_", ",_", "close", "\\u", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "print", "\\u", "Piece", "wise_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "expr_", "._", "args_", "[_", "-_", "1_", "]_", "._", "cond_", "!=_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "the", " ", "last", " ", "conditional", " ", "to", " ", "be", " ", "a", " ", "Tru", "e", ",", " ", "other", "wis", "e", " ", "the", " ", "result", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", " ", "may", " ", "not", " ", "return", " ", "a", " ", "result", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "All", " ", "Piece", "wis", "e", " ", "express", "ion", "s", " ", "must", " ", "contain", " ", "an", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "expr", ",", " ", "Tru", "e", ")", " ", "statem", "ent", " ", "to", " ", "be", " ", "used", " ", "as", " ", "a", " ", "default", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "condition", ".", " ", "With", "out", " ", "one", ",", " ", "the", " ", "generat", "ed", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "express", "ion", " ", "may", " ", "not", " ", "evaluate", " ", "to", " ", "anyt", "hing", " ", "under", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "some", " ", "condition", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expr_", "._", "has_", "(_", "Assignment_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "(_", "e_", ",_", "c_", ")_", "in_", "enumerate_", "(_", "expr_", "._", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "._", "append_", "(_", "\"", "if", " ", "(%", "s", ")", " ", "then", "\"_", "%_", "self_", "._", "\\u", "print_", "(_", "c_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "==_", "len_", "(_", "expr_", "._", "args_", ")_", "-_", "1_", "and_", "c_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "._", "append_", "(_", "\"", "else", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "._", "append_", "(_", "\"", "else", " ", "if", " ", "(%", "s", ")", " ", "then", "\"_", "%_", "self_", "._", "\\u", "print_", "(_", "c_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lines_", "._", "append_", "(_", "self_", "._", "\\u", "print_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lines_", "._", "append_", "(_", "\"", "end", " ", "if", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "settings_", "[_", "\"", "standard", "\"_", "]_", ">=_", "95_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "support", "ed", " ", "in", " ", "F", "9", "5", " ", "and", " ", "newe", "r", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "piece", "wis", "e", " ", "was", " ", "used", " ", "in", " ", "an", " ", "express", "ion", ",", " ", "need", " ", "to", " ", "do", " ", "inline_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "opera", "tors", ".", " ", "Thi", "s", " ", "has", " ", "the", " ", "downs", "ide", " ", "tha", "t", " ", "inline", " ", "opera", "tors", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "work", " ", "for", " ", "statem", "ents", " ", "tha", "t", " ", "span", " ", "multiple", " ", "lines", " ", "(", "Matrix", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Indexe", "d", " ", "express", "ion", "s", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern_", "=_", "\"", "merge", "({", "T", "},", " ", "{", "F", "},", " ", "{", "COND", "})\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "self_", "._", "\\u", "print_", "(_", "expr_", "._", "args_", "[_", "-_", "1_", "]_", "._", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "terms_", "=_", "list_", "(_", "expr_", "._", "args_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "terms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", ",_", "c_", "=_", "terms_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expr_", "=_", "self_", "._", "\\u", "print_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cond_", "=_", "self_", "._", "\\u", "print_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "pattern_", "._", "format_", "(_", "T_", "=_", "expr_", ",_", "F_", "=_", "code_", ",_", "COND", "_", "=_", "cond_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "`", "merge", "`", " ", "is", " ", "not", " ", "support", "ed", " ", "prior", " ", "to", " ", "F", "95_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "Us", "ing", " ", "Piece", "wis", "e", " ", "as", " ", "an", " ", "express", "ion", " ", "usi", "ng", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "inline", " ", "opera", "tors", " ", "is", " ", "not", " ", "support", "ed", " ", "in", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "standard", "s", " ", "ear", "lie", "r", " ", "than", " ", "Fort", "ran", "95.", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\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", "print", "\\u", "Matrix", "Element_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"{", "0", "}(", "{", "1", "},", " ", "{", "2", "})\"_", "._", "format_", "(_", "expr_", "._", "parent_", ",_", "expr_", "._", "i_", "+_", "1_", ",_", "expr_", "._", "j_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "print", "\\u", "Add_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "purpose", ":", " ", "print", " ", "complex", " ", "numbers", " ", "nice", "ly", " ", "in", " ", "Fort", "ran", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "collect", " ", "the", " ", "pure", "ly", " ", "real", " ", "and", " ", "pure", "ly", " ", "imagin", "ary", " ", "part", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pure", "\\u", "real_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pure", "\\u", "imagin", "ary_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mixed", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "expr_", "._", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "._", "is", "\\u", "number_", "and_", "arg_", "._", "is", "\\u", "real_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pure", "\\u", "real_", "._", "append_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arg_", "._", "is", "\\u", "number_", "and_", "arg_", "._", "is", "\\u", "imagin", "ary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pure", "\\u", "imagin", "ary_", "._", "append_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mixed", "_", "._", "append_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "pure", "\\u", "imagin", "ary_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "mixed", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PRE", "C_", "=_", "preceden", "ce_", "(_", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "term_", "=_", "Add_", "(_", "*_", "mixed", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "self_", "._", "\\u", "print_", "(_", "term_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "t_", "._", "startswith_", "(_", "'-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sign_", "=_", "\"-\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "t_", "[_", "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 ", " ", "_", "sign_", "=_", "\"+\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "preceden", "ce_", "(_", "term_", ")_", "<_", "PRE", "C_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "t_", "=_", "\"(", "%", "s", ")\"_", "%_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"", "cmp", "lx", "(%", "s", ",%", "s", ")", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "print_", "(_", "Add_", "(_", "*_", "pure", "\\u", "real_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "print_", "(_", "-_", "S_", "._", "Imagin", "ary", "Unit_", "*_", "Add_", "(_", "*_", "pure", "\\u", "imagin", "ary_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sign_", ",_", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "cmp", "lx", "(%", "s", ",%", "s", ")\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "print_", "(_", "Add_", "(_", "*_", "pure", "\\u", "real_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "print_", "(_", "-_", "S_", "._", "Imagin", "ary", "Unit_", "*_", "Add_", "(_", "*_", "pure", "\\u", "imagin", "ary_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Code", "Printer_", "._", "\\u", "print", "\\u", "Add_", "(_", "self_", ",_", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\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", "print", "\\u", "Function_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", " ", "constant", " ", "function", " ", "args", " ", "are", " ", "evaluate", "d", " ", "as", " ", "floats_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prec_", "=_", "self_", "._", "\\u", "settings_", "[_", "'", "preci", "sion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "N_", "(_", "a_", ",_", "prec_", ")_", "for_", "a_", "in_", "expr_", "._", "args_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eval", "\\u", "expr_", "=_", "expr_", "._", "func_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "eval", "\\u", "expr_", ",_", "Function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "print_", "(_", "eval", "\\u", "expr_", ")_", "\\u\\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_", "Code", "Printer_", "._", "\\u", "print", "\\u", "Function_", "(_", "self_", ",_", "expr_", "._", "func_", "(_", "*_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\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", "print", "\\u", "Imagin", "ary", "Unit_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "purpose", ":", " ", "print", " ", "complex", " ", "numbers", " ", "nice", "ly", " ", "in", " ", "Fort", "ran", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "cmp", "lx", "(", "0", ",", "1", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "print", "\\u", "int_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "print", "\\u", "Mul", "_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "purpose", ":", " ", "print", " ", "complex", " ", "numbers", " ", "nice", "ly", " ", "in", " ", "Fort", "ran", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "expr_", "._", "is", "\\u", "number_", "and_", "expr_", "._", "is", "\\u", "imagin", "ary_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "cmp", "lx", "(", "0", ",%", "s", ")\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "print_", "(_", "-_", "S_", "._", "Imagin", "ary", "Unit_", "*_", "expr_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Code", "Printer_", "._", "\\u", "print", "\\u", "Mul", "_", "(_", "self_", ",_", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\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", "print", "\\u", "Pow", "_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PRE", "C_", "=_", "preceden", "ce_", "(_", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expr_", "._", "exp_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "1.0", "/", "%", "s", "'_", "%_", "(_", "self_", "._", "parenthes", "ize_", "(_", "expr_", "._", "base_", ",_", "PRE", "C_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "expr_", "._", "exp_", "==_", "0.5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "expr_", "._", "base_", "._", "is", "\\u", "integer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fort", "an", " ", "intrinsic", " ", "sqrt", "()", " ", "doe", "s", " ", "not", " ", "accept", " ", "integ", "er", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "expr_", "._", "base_", "._", "is", "\\u", "Number_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "'", "sqrt", "(%", "s", ".0", "d0", ")'_", "%_", "self_", "._", "\\u", "print_", "(_", "expr_", "._", "base_", ")_", "\\u\\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_", "'", "sqrt", "(", "dbl", "e", "(%", "s", "))'_", "%_", "self_", "._", "\\u", "print_", "(_", "expr_", "._", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "sqrt", "(%", "s", ")'_", "%_", "self_", "._", "\\u", "print_", "(_", "expr_", "._", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Code", "Printer_", "._", "\\u", "print", "\\u", "Pow", "_", "(_", "self_", ",_", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\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", "print", "\\u", "Rational", "_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", ",_", "q_", "=_", "int_", "(_", "expr_", "._", "p_", ")_", ",_", "int_", "(_", "expr_", "._", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "d", ".0", "d0", "/", "%", "d", ".0", "d0", "\"_", "%_", "(_", "p_", ",_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "print", "\\u", "Float_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "printed", "_", "=_", "Code", "Printer_", "._", "\\u", "print", "\\u", "Float_", "(_", "self_", ",_", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "printed", "_", "._", "find_", "(_", "'", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "e_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"%", "sd", "%", "s", "\"_", "%_", "(_", "printed", "_", "[_", ":_", "e_", "]_", ",_", "printed", "_", "[_", "e_", "+_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"%", "sd", "0", "\"_", "%_", "printed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "print", "\\u", "Indexe", "d_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inds_", "=_", "[_", "self_", "._", "\\u", "print_", "(_", "i_", ")_", "for_", "i_", "in_", "expr_", "._", "indices_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", "(%", "s", ")\"_", "%_", "(_", "self_", "._", "\\u", "print_", "(_", "expr_", "._", "base_", "._", "label_", ")_", ",_", "\",", " ", "\"_", "._", "join_", "(_", "inds_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "print", "\\u", "Idx_", "(_", "self_", ",_", "expr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "print_", "(_", "expr_", "._", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "pad", "\\u", "lead", "ing", "\\u", "columns_", "(_", "self_", ",_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "startswith_", "(_", "'!'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "self_", "._", "\\u", "lead", "\\u", "comment_", "+_", "line_", "[_", "1_", ":_", "]_", "._", "lstrip_", "(_", ")_", ")_", "\\u\\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_", "._", "append_", "(_", "self_", "._", "\\u", "lead", "\\u", "code_", "+_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "wrap", "\\u", "fortran", "_", "(_", "self_", ",_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Wra", "p", " ", "long", " ", "Fort", "ran", " ", "lines", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "Arg", "ument", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "lines", " ", " ", "--", " ", " ", "a", " ", "list", " ", "of", " ", "lines", " ", "(", "with", "out", " ", "\\\\\\\\", "n", " ", "character", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "A", " ", "comment", " ", "line", " ", "is", " ", "split", " ", "at", " ", "white", " ", "space", ".", " ", "Code", " ", "lines", " ", "are", " ", "split", " ", "with", " ", "a", " ", "more", "\\", "10", ";", " ", " ", " ", "complex", " ", "rule", " ", "to", " ", "give", " ", "nice", " ", "results", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "routin", "e", " ", "to", " ", "find", " ", "split", " ", "point", " ", "in", " ", "a", " ", "code", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "my", "\\u", "aln", "um_", "=_", "set_", "(_", "\"\\u", "+-", ".\"_", "+_", "string_", "._", "digits_", "+_", "string_", "._", "ascii", "\\u", "letters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "\\u", "white_", "=_", "set_", "(_", "\"", " ", "\\\\", "t", "()\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "split", "\\u", "pos", "\\u", "code_", "(_", "line_", ",_", "endp", "os_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "line_", ")_", "<=_", "endp", "os_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pos_", "=_", "endp", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "split_", "=_", "lambda_", "pos_", ":_", "(_", "line_", "[_", "pos_", "]_", "in_", "my", "\\u", "aln", "um_", "and_", "line_", "[_", "pos_", "-_", "1_", "]_", "not_", "in_", "my", "\\u", "aln", "um_", ")_", "or_", "(_", "line_", "[_", "pos_", "]_", "not_", "in_", "my", "\\u", "aln", "um_", "and_", "line_", "[_", "pos_", "-_", "1_", "]_", "in_", "my", "\\u", "aln", "um_", ")_", "or_", "(_", "line_", "[_", "pos_", "]_", "in_", "my", "\\u", "white_", "and_", "line_", "[_", "pos_", "-_", "1_", "]_", "not_", "in_", "my", "\\u", "white_", ")_", "or_", "(_", "line_", "[_", "pos_", "]_", "not_", "in_", "my", "\\u", "white_", "and_", "line_", "[_", "pos_", "-_", "1_", "]_", "in_", "my", "\\u", "white_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "split_", "(_", "pos_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "endp", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "split", " ", "line", " ", "by", " ", "line", " ", "and", " ", "add", " ", "the", " ", "splitted", " ", "lines", " ", "to", " ", "result_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "settings_", "[_", "'", "source", "\\u", "format", "'_", "]_", "==_", "'", "free", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trail", "ing_", "=_", "'", " ", "&'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trail", "ing_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "._", "startswith_", "(_", "self_", "._", "\\u", "lead", "\\u", "comment_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "comment", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "line_", ")_", ">_", "72_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pos_", "=_", "line_", "._", "rfind_", "(_", "\"", " ", "\"_", ",_", "6_", ",_", "72_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pos_", "=_", "72_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hunk", "_", "=_", "line_", "[_", ":_", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "line_", "[_", "pos_", ":_", "]_", "._", "lstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "hunk", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "line_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pos_", "=_", "line_", "._", "rfind_", "(_", "\"", " ", "\"_", ",_", "0_", ",_", "66_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", "==_", "-_", "1_", "or_", "len_", "(_", "line_", ")_", "<_", "66_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pos_", "=_", "66_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hunk", "_", "=_", "line_", "[_", ":_", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "line_", "[_", "pos_", ":_", "]_", "._", "lstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "self_", "._", "\\u", "lead", "\\u", "comment_", ",_", "hunk", "_", ")_", ")_", "\\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_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "self_", "._", "\\u", "lead", "\\u", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "code", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "=_", "split", "\\u", "pos", "\\u", "code_", "(_", "line_", ",_", "72_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hunk", "_", "=_", "line_", "[_", ":_", "pos_", "]_", "._", "rstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "line_", "[_", "pos_", ":_", "]_", "._", "lstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "hunk", "_", "+=_", "trail", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "append_", "(_", "hunk", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "line_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pos_", "=_", "split", "\\u", "pos", "\\u", "code_", "(_", "line_", ",_", "65_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hunk", "_", "=_", "line_", "[_", ":_", "pos_", "]_", "._", "rstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "line_", "[_", "pos_", ":_", "]_", "._", "lstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "hunk", "_", "+=_", "trail", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "append_", "(_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "self_", "._", "\\u", "lead", "\\u", "cont_", ",_", "hunk", "_", ")_", ")_", "\\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_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "FC", "ode", "Printer_", "(_", "Code", "Printer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "indent", "\\u", "code_", "(_", "self_", ",_", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Accept", "s", " ", "a", " ", "string", " ", "of", " ", "code", " ", "or", " ", "a", " ", "list", " ", "of", " ", "code", " ", "lines", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "code_", ",_", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code", "\\u", "lines_", "=_", "self_", "._", "indent", "\\u", "code_", "(_", "code_", "._", "splitlines_", "(_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "code", "\\u", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "free_", "=_", "self_", "._", "\\u", "settings_", "[_", "'", "source", "\\u", "format", "'_", "]_", "==_", "'", "free", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "[_", "line_", "._", "lstrip_", "(_", "'", " ", "\\\\", "t", "'_", ")_", "for_", "line_", "in_", "code_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inc", "\\u", "keyword_", "=_", "(_", "'", "do", " ", "'_", ",_", "'", "if", "('_", ",_", "'", "if", " ", "'_", ",_", "'", "do", "\\\\", "n", "'_", ",_", "'", "else", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dec", "\\u", "keyword_", "=_", "(_", "'", "end", " ", "do", "'_", ",_", "'", "end", "do", "'_", ",_", "'", "end", " ", "if", "'_", ",_", "'", "endi", "f", "'_", ",_", "'", "else", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "increase", "_", "=_", "[_", "int_", "(_", "any_", "(_", "map_", "(_", "line_", "._", "startswith_", ",_", "inc", "\\u", "keyword_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "code_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "decrease", "_", "=_", "[_", "int_", "(_", "any_", "(_", "map_", "(_", "line_", "._", "startswith_", ",_", "dec", "\\u", "keyword_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "code_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continuation", "_", "=_", "[_", "int_", "(_", "any_", "(_", "map_", "(_", "line_", "._", "endswith_", ",_", "[_", "'&'_", ",_", "'&", "\\\\", "n", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "code_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "level_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cont", "\\u", "padding_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab", "width_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "code_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "code_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "==_", "''_", "or_", "line_", "==_", "'\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "code_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "level_", "-=_", "decrease", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "free_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "padding_", "=_", "\"", " ", "\"_", "*_", "(_", "level_", "*_", "tab", "width_", "+_", "cont", "\\u", "padding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "padding_", "=_", "\"", " ", "\"_", "*_", "level_", "*_", "tab", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line_", "=_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "padding_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "free_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "self_", "._", "\\u", "pad", "\\u", "lead", "ing", "\\u", "columns_", "(_", "[_", "line_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "code_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "continuation", "_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cont", "\\u", "padding_", "=_", "2_", "*_", "tab", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cont", "\\u", "padding_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "level_", "+=_", "increase", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "free_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "wrap", "\\u", "fortran", "_", "(_", "new", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fco", "de_", "(_", "expr_", ",_", "assign", "\\u", "to_", "=_", "None_", ",_", "**_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", "s", " ", "an", " ", "expr", " ", "to", " ", "a", " ", "string", " ", "of", " ", "c", " ", "code", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "=========", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "expr", " ", ":", " ", "Exp", "r", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "symp", "y", " ", "express", "ion", " ", "to", " ", "be", " ", "convert", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "assign", "\\u", "to", " ", ":", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "give", "n", ",", " ", "the", " ", "argu", "ment", " ", "is", " ", "used", " ", "as", " ", "the", " ", "name", " ", "of", " ", "the", " ", "variab", "le", " ", "to", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "express", "ion", " ", "is", " ", "assign", "ed", ".", " ", "Can", " ", "be", " ", "a", " ", "string", ",", " ", "``", "Sym", "bol", "``", ",", "\\", "10", ";", " ", " ", " ", " ", "``", "Matrix", "Sym", "bol", "``", ",", " ", "or", " ", "``", "Indexe", "d", "``", " ", "type", ".", " ", "Thi", "s", " ", "is", " ", "help", "ful", " ", "in", " ", "case", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "line", "-", "wrapp", "ing", ",", " ", "or", " ", "for", " ", "express", "ion", "s", " ", "tha", "t", " ", "generat", "e", " ", "multi", "-", "line", " ", "statem", "ents", ".", "\\", "10", ";", " ", " ", " ", " ", "preci", "sion", " ", ":", " ", "integ", "er", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "preci", "sion", " ", "for", " ", "numbers", " ", "suc", "h", " ", "as", " ", "pi", " ", "[", "default", "=", "15", "].", "\\", "10", ";", " ", " ", " ", " ", "user", "\\u", "function", "s", " ", ":", " ", "dict", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dictionar", "y", " ", "where", " ", "keys", " ", "are", " ", "``", "Function", "Class", "``", " ", "instance", "s", " ", "and", " ", "values", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "thei", "r", " ", "string", " ", "representations", ".", " ", "Alternative", "ly", ",", " ", "the", " ", "dictionar", "y", " ", "value", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", " ", "i", ".", "e", ".", " ", "[(", "argu", "ment", "\\u", "test", ",", " ", "cf", "uncti", "on", "\\u", "string", ")]", ".", " ", "See", " ", "belo", "w", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "example", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "human", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", ",", " ", "the", " ", "result", " ", "is", " ", "a", " ", "single", " ", "string", " ", "tha", "t", " ", "may", " ", "contain", " ", "some", " ", "constant", "\\", "10", ";", " ", " ", " ", " ", "declaration", "s", " ", "for", " ", "the", " ", "number", " ", "symbols", ".", " ", "If", " ", "Fal", "se", ",", " ", "the", " ", "same", " ", "informati", "on", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "return", "ed", " ", "in", " ", "a", " ", "tuple", " ", "of", " ", "(", "symbols", "\\u", "to", "\\u", "declar", "e", ",", " ", "not", "\\u", "support", "ed", "\\u", "function", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "code", "\\u", "text", ").", " ", "[", "default", "=", "Tru", "e", "].", "\\", "10", ";", " ", " ", " ", " ", "contract", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", ",", " ", "``", "Indexe", "d", "``", " ", "instance", "s", " ", "are", " ", "assume", "d", " ", "to", " ", "obe", "y", " ", "tensor", " ", "contract", "ion", "\\", "10", ";", " ", " ", " ", " ", "rule", "s", " ", "and", " ", "the", " ", "correspond", "ing", " ", "nest", "ed", " ", "loop", "s", " ", "over", " ", "indice", "s", " ", "are", " ", "generat", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "Sett", "ing", " ", "contract", "=", "Fal", "se", " ", "will", " ", "not", " ", "generat", "e", " ", "loop", "s", ",", " ", "inst", "ead", " ", "the", " ", "user", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "responsib", "le", " ", "to", " ", "provide", " ", "values", " ", "for", " ", "the", " ", "indice", "s", " ", "in", " ", "the", " ", "code", ".", "\\", "10", ";", " ", " ", " ", " ", "[", "default", "=", "Tru", "e", "].", "\\", "10", ";", " ", " ", " ", " ", "source", "\\u", "format", " ", ":", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "source", " ", "format", " ", "can", " ", "be", " ", "eit", "her", " ", "'", "fixed", "'", " ", "or", " ", "'", "free", "'.", " ", "[", "default", "='", "fixed", "']", "\\", "10", ";", " ", " ", " ", " ", "standard", " ", ":", " ", "integ", "er", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Fort", "ran", " ", "standard", " ", "to", " ", "be", " ", "followe", "d", ".", " ", "Thi", "s", " ", "is", " ", "specified", " ", "as", " ", "an", " ", "integ", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "Accepta", "ble", " ", "standard", "s", " ", "are", " ", "6", "6", ",", " ", "7", "7", ",", " ", "90", ",", " ", "9", "5", ",", " ", "2003", ",", " ", "and", " ", "2008", ".", " ", "Default", " ", "is", " ", "77.", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "currentl", "y", " ", "the", " ", "only", " ", "distinct", "ion", " ", "internal", "ly", " ", "is", " ", "bet", "ween", "\\", "10", ";", " ", " ", " ", " ", "standard", "s", " ", "bef", "ore", " ", "9", "5", ",", " ", "and", " ", "tho", "se", " ", "9", "5", " ", "and", " ", "after", ".", " ", "Thi", "s", " ", "may", " ", "change", " ", "late", "r", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "more", " ", "features", " ", "are", " ", "adde", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "fco", "de", ",", " ", "symbols", ",", " ", "Rational", ",", " ", "sin", ",", " ", "ceil", "ing", ",", " ", "floor", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "x", ",", " ", "tau", " ", "=", " ", "symbols", "(\"", "x", ",", " ", "tau", "\")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fco", "de", "((", "2", "*", "tau", ")**", "Rational", "(", "7", ",", " ", "2", "))\\", "10", ";", " ", " ", " ", " ", "'", " ", " ", "8", "*", "sqrt", "(", "2.0", "d0", ")*", "tau", "**", "(", "7.0", "d0", "/", "2.0", "d0", ")'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fco", "de", "(", "sin", "(", "x", "),", " ", "assign", "\\u", "to", "=\"", "s", "\")", "\\", "10", ";", " ", " ", " ", " ", "'", " ", " ", "s", " ", "=", " ", "sin", "(", "x", ")'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Custom", " ", "printin", "g", " ", "can", " ", "be", " ", "defin", "ed", " ", "for", " ", "cert", "ain", " ", "types", " ", "by", " ", "passi", "ng", " ", "a", " ", "dictionar", "y", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "\"", "type", "\"", " ", ":", " ", "\"", "function", "\"", " ", "to", " ", "the", " ", "``", "user", "\\u", "function", "s", "``", " ", "kwarg", ".", " ", "Alternative", "ly", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "dictionar", "y", " ", "value", " ", "can", " ", "be", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", " ", "i", ".", "e", ".", " ", "[(", "argu", "ment", "\\u", "test", ",", "\\", "10", ";", " ", " ", " ", " ", "cf", "uncti", "on", "\\u", "string", ")]", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "custom", "\\u", "function", "s", " ", "=", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", "\"", "ceil", "ing", "\":", " ", "\"", "CE", "IL", "\",", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", "\"", "floor", "\":", " ", "[(", "lambda", " ", "x", ":", " ", "not", " ", "x", ".", "is", "\\u", "integ", "er", ",", " ", "\"", "FLO", "OR", "1", "\")", ",", "\\", "10", ";", " ", " ", " ", " ", "...", " ", " ", " ", " ", " ", "(", "lambda", " ", "x", ":", " ", "x", ".", "is", "\\u", "integ", "er", ",", " ", "\"", "FLO", "OR", "2", "\")]", "\\", "10", ";", " ", " ", " ", " ", "...", " ", "}", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fco", "de", "(", "floor", "(", "x", ")", " ", "+", " ", "ceil", "ing", "(", "x", "),", " ", "user", "\\u", "function", "s", "=", "custom", "\\u", "function", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "'", " ", " ", "CE", "IL", "(", "x", ")", " ", "+", " ", "FLO", "OR", "1", "(", "x", ")'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "Piece", "wis", "e", "``", " ", "express", "ion", "s", " ", "are", " ", "convert", "ed", " ", "int", "o", " ", "conditional", "s", ".", " ", "If", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "``", "assign", "\\u", "to", "``", " ", "variab", "le", " ", "is", " ", "provided", " ", "an", " ", "if", " ", "statem", "ent", " ", "is", " ", "created", ",", " ", "other", "wis", "e", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "tern", "ary", " ", "opera", "tor", " ", "is", " ", "used", ".", " ", "Not", "e", " ", "tha", "t", " ", "if", " ", "the", " ", "``", "Piece", "wis", "e", "``", " ", "lack", "s", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "default", " ", "term", ",", " ", "represent", "ed", " ", "by", " ", "``", "(", "expr", ",", " ", "Tru", "e", ")`", "`", " ", "then", " ", "an", " ", "error", " ", "will", " ", "be", " ", "throw", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "to", " ", "prevent", " ", "generat", "ing", " ", "an", " ", "express", "ion", " ", "tha", "t", " ", "may", " ", "not", " ", "evaluate", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "anyt", "hing", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Piece", "wis", "e", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "expr", " ", "=", " ", "Piece", "wis", "e", "((", "x", " ", "+", " ", "1", ",", " ", "x", " ", ">", " ", "0", "),", " ", "(", "x", ",", " ", "Tru", "e", "))\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "fco", "de", "(", "expr", ",", " ", "tau", "))\\", "10", ";", " ", " ", "if", " ", "(", "x", " ", ">", " ", "0", ")", " ", "then", "\\", "10", ";", " ", " ", " ", " ", " ", "tau", " ", "=", " ", "x", " ", "+", " ", "1", "\\", "10", ";", " ", " ", "else", "\\", "10", ";", " ", " ", " ", " ", " ", "tau", " ", "=", " ", "x", "\\", "10", ";", " ", " ", "end", " ", "if", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Supp", "ort", " ", "for", " ", "loop", "s", " ", "is", " ", "provided", " ", "through", " ", "``", "Indexe", "d", "``", " ", "types", ".", " ", "With", "\\", "10", ";", " ", " ", " ", " ", "``", "contract", "=", "Tru", "e", "``", " ", "these", " ", "express", "ion", "s", " ", "will", " ", "be", " ", "turn", "ed", " ", "int", "o", " ", "loop", "s", ",", " ", "where", "as", "\\", "10", ";", " ", " ", " ", " ", "``", "contract", "=", "Fal", "se", "``", " ", "will", " ", "just", " ", "print", " ", "the", " ", "assign", "ment", " ", "express", "ion", " ", "tha", "t", " ", "shou", "ld", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "loope", "d", " ", "over", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Eq", ",", " ", "Indexe", "d", "Base", ",", " ", "Id", "x", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "len", "\\u", "y", " ", "=", " ", "5", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "y", " ", "=", " ", "Indexe", "d", "Base", "('", "y", "',", " ", "shape", "=(", "len", "\\u", "y", ",)", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "t", " ", "=", " ", "Indexe", "d", "Base", "('", "t", "',", " ", "shape", "=(", "len", "\\u", "y", ",)", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Dy", " ", "=", " ", "Indexe", "d", "Base", "('", "Dy", "',", " ", "shape", "=(", "len", "\\u", "y", "-1", ",)", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "i", " ", "=", " ", "Id", "x", "('", "i", "',", " ", "len", "\\u", "y", "-1", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "e", "=", "Eq", "(", "Dy", "[", "i", "],", " ", "(", "y", "[", "i", "+", "1", "]-", "y", "[", "i", "])", "/(", "t", "[", "i", "+", "1", "]-", "t", "[", "i", "]))", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "fco", "de", "(", "e", ".", "rhs", ",", " ", "assign", "\\u", "to", "=", "e", ".", "lh", "s", ",", " ", "contract", "=", "Fal", "se", ")", "\\", "10", ";", " ", " ", " ", " ", "'", " ", " ", "Dy", "(", "i", ")", " ", "=", " ", "(", "y", "(", "i", " ", "+", " ", "1", ")", " ", "-", " ", "y", "(", "i", "))/(", "t", "(", "i", " ", "+", " ", "1", ")", " ", "-", " ", "t", "(", "i", "))", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Matr", "ices", " ", "are", " ", "als", "o", " ", "support", "ed", ",", " ", "but", " ", "a", " ", "``", "Matrix", "Sym", "bol", "``", " ", "of", " ", "the", " ", "same", " ", "dimension", "s", "\\", "10", ";", " ", " ", " ", " ", "must", " ", "be", " ", "provided", " ", "to", " ", "``", "assign", "\\u", "to", "``.", " ", "Not", "e", " ", "tha", "t", " ", "any", " ", "express", "ion", " ", "tha", "t", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "generat", "ed", " ", "normal", "ly", " ", "can", " ", "als", "o", " ", "exist", " ", "insi", "de", " ", "a", " ", "Matrix", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", " ", "import", " ", "Matrix", ",", " ", "Matrix", "Sym", "bol", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mat", " ", "=", " ", "Matrix", "([", "x", "**", "2", ",", " ", "Piece", "wis", "e", "((", "x", " ", "+", " ", "1", ",", " ", "x", " ", ">", " ", "0", "),", " ", "(", "x", ",", " ", "Tru", "e", "))", ",", " ", "sin", "(", "x", ")])", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "A", " ", "=", " ", "Matrix", "Sym", "bol", "('", "A", "',", " ", "3", ",", " ", "1", ")", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "print", "(", "fco", "de", "(", "mat", ",", " ", "A", "))\\", "10", ";", " ", " ", "A", "(", "1", ",", " ", "1", ")", " ", "=", " ", "x", "**", "2", "\\", "10", ";", " ", " ", " ", " ", " ", "if", " ", "(", "x", " ", ">", " ", "0", ")", " ", "then", "\\", "10", ";", " ", " ", "A", "(", "2", ",", " ", "1", ")", " ", "=", " ", "x", " ", "+", " ", "1", "\\", "10", ";", " ", " ", " ", " ", " ", "else", "\\", "10", ";", " ", " ", "A", "(", "2", ",", " ", "1", ")", " ", "=", " ", "x", "\\", "10", ";", " ", " ", " ", " ", " ", "end", " ", "if", "\\", "10", ";", " ", " ", "A", "(", "3", ",", " ", "1", ")", " ", "=", " ", "sin", "(", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "FC", "ode", "Printer_", "(_", "settings_", ")_", "._", "dop", "rint_", "(_", "expr_", ",_", "assign", "\\u", "to_", ")_", "\\u\\u\\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_", "print", "\\u", "fco", "de_", "(_", "expr_", ",_", "**_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Print", "s", " ", "the", " ", "Fort", "ran", " ", "represent", "ation", " ", "of", " ", "the", " ", "give", "n", " ", "express", "ion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "See", " ", "fco", "de", " ", "for", " ", "the", " ", "meaning", " ", "of", " ", "the", " ", "option", "al", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
anandology/pyjamas/library/gwt/ui/ToggleButton.py
[ { "content": "# Copyright Pyjamas Team\n# Copyright (C) 2009 Luke Kenneth Casson Leighton <[email protected]>\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy of\n# 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 under\n# the License.\n\nfrom pyjamas.ui.CustomButton import CustomButton\nfrom pyjamas import Factory\n\n \nFactory.registerClass('pyjamas.ui.ToggleButton', 'ToggleButton', ToggleButton)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ToggleButton (CustomButton):\n \"\"\"\n A ToggleButton is a stylish stateful button which allows the\n user to toggle between UP and DOWN states.\n \n CSS: .gwt-ToggleButton-\n up/down/up-hovering/down-hovering/up-disabled/down-disabled\n {.html-face}\n \"\"\"\n STYLENAME_DEFAULT = \"gwt-ToggleButton\"\n \n \n\n ", "metadata": "root.ToggleButton", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __init__(self, upImageText = None, downImageText=None, handler = None,\n **kwargs):\n \"\"\"\n Constructor for ToggleButton.\n \"\"\"\n kwargs['StyleName'] = kwargs.get('StyleName', self.STYLENAME_DEFAULT)\n CustomButton.__init__(self, upImageText, downImageText, handler,\n **kwargs)", "metadata": "root.ToggleButton.__init__", "header": "['class', 'ToggleButton', '(', 'CustomButton', ')', ':', '___EOS___']", "index": 29 }, { "content": " def onClick(self, sender=None):\n self.toggleDown()\n CustomButton.onClick(self)", "metadata": "root.ToggleButton.onClick", "header": "['class', 'ToggleButton', '(', 'CustomButton', ')', ':', '___EOS___']", "index": 39 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "Py", "jam", "as", " ", "Team_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", " ", "Lu", "ke", " ", "Ken", "net", "h", " ", "Cass", "on", " ", "Lei", "ght", "on", " ", "<", "lk", "cl", "@", "lk", "cl", ".", "net", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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", "ation", "s", " ", "under", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "._", "Custom", "Button_", "import_", "Custom", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "import_", "Factory_", "\\u\\u\\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_", "Factory_", "._", "register", "Class_", "(_", "'", "pyj", "ama", "s", ".", "ui", ".", "Toggle", "Butt", "on", "'_", ",_", "'", "Toggle", "Butt", "on", "'_", ",_", "Toggle", "Button_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Toggle", "Button_", "(_", "Custom", "Button_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "Toggle", "Butt", "on", " ", "is", " ", "a", " ", "sty", "lish", " ", "stateful", " ", "button", " ", "whi", "ch", " ", "allow", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "user", " ", "to", " ", "toggle", " ", "bet", "ween", " ", "UP", " ", "and", " ", "DOWN", " ", "state", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "CS", "S", ":", " ", ".", "gw", "t", "-", "Toggle", "Butt", "on", "-", "\\", "10", ";", " ", " ", " ", " ", "up", "/", "down", "/", "up", "-", "hover", "ing", "/", "down", "-", "hover", "ing", "/", "up", "-", "disable", "d", "/", "down", "-", "disable", "d", "\\", "10", ";", " ", " ", " ", " ", "{.", "html", "-", "face", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STYLE", "NAME", "\\u", "DEFAULT_", "=_", "\"", "gw", "t", "-", "Toggle", "Butt", "on", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Toggle", "Button_", "(_", "Custom", "Button_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "up", "Image", "Text_", "=_", "None_", ",_", "down", "Image", "Text_", "=_", "None_", ",_", "handler_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Constructor", " ", "for", " ", "Toggle", "Butt", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "[_", "'", "Style", "Name", "'_", "]_", "=_", "kwargs_", "._", "get_", "(_", "'", "Style", "Name", "'_", ",_", "self_", "._", "STYLE", "NAME", "\\u", "DEFAULT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Custom", "Button_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "up", "Image", "Text_", ",_", "down", "Image", "Text_", ",_", "handler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Toggle", "Button_", "(_", "Custom", "Button_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Click_", "(_", "self_", ",_", "sender_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "toggle", "Down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Custom", "Button_", "._", "on", "Click_", "(_", "self_", ")_", "\\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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
stephrdev/django-formwizard/formwizard/storage/cookie.py
[ { "content": "from django.conf import settings\nfrom django.core.exceptions import SuspiciousOperation\nfrom django.utils import simplejson as json\nfrom django.utils.hashcompat import sha_constructor\n\nimport hmac\n\nfrom formwizard import storage\n\nsha_hmac = sha_constructor\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CookieStorage(storage.BaseStorage):\n encoder = json.JSONEncoder(separators=(',', ':'))\n\n\n\n\n\n", "metadata": "root.CookieStorage", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __init__(self, *args, **kwargs):\n super(CookieStorage, self).__init__(*args, **kwargs)\n self.data = self.load_data()\n if self.data is None:\n self.init_data()", "metadata": "root.CookieStorage.__init__", "header": "['class', 'CookieStorage', '(', 'storage', '.', 'BaseStorage', ')', ':', '___EOS___']", "index": 15 }, { "content": " def unsign_cookie_data(self, data):\n if data is None:\n return None\n\n bits = data.split('$', 1)\n if len(bits) == 2:\n if bits[0] == self.get_cookie_hash(bits[1]):\n return bits[1]\n\n raise SuspiciousOperation('FormWizard cookie manipulated')", "metadata": "root.CookieStorage.unsign_cookie_data", "header": "['class', 'CookieStorage', '(', 'storage', '.', 'BaseStorage', ')', ':', '___EOS___']", "index": 21 }, { "content": " def load_data(self):\n data = self.request.COOKIES.get(self.prefix, None)\n cookie_data = self.unsign_cookie_data(data)\n if cookie_data is None:\n return None\n return json.loads(cookie_data, cls=json.JSONDecoder)", "metadata": "root.CookieStorage.load_data", "header": "['class', 'CookieStorage', '(', 'storage', '.', 'BaseStorage', ')', ':', '___EOS___']", "index": 32 }, { "content": " def update_response(self, response):\n if self.data:\n response.set_cookie(self.prefix, self.create_cookie_data(self.data))\n else:\n response.delete_cookie(self.prefix)\n return response", "metadata": "root.CookieStorage.update_response", "header": "['class', 'CookieStorage', '(', 'storage', '.', 'BaseStorage', ')', ':', '___EOS___']", "index": 39 }, { "content": " def create_cookie_data(self, data):\n encoded_data = self.encoder.encode(self.data)\n cookie_data = '%s$%s' % (self.get_cookie_hash(encoded_data),\n encoded_data)\n return cookie_data", "metadata": "root.CookieStorage.create_cookie_data", "header": "['class', 'CookieStorage', '(', 'storage', '.', 'BaseStorage', ')', ':', '___EOS___']", "index": 46 }, { "content": " def get_cookie_hash(self, data):\n return hmac.new('%s$%s' % (settings.SECRET_KEY, self.prefix),\n data, sha_hmac).hexdigest()", "metadata": "root.CookieStorage.get_cookie_hash", "header": "['class', 'CookieStorage', '(', 'storage', '.', 'BaseStorage', ')', ':', '___EOS___']", "index": 52 } ]
[]
[]
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_", "._", "core_", "._", "exceptions_", "import_", "Sus", "picio", "us", "Operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "hash", "compat_", "import_", "sha", "\\u", "constructor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "hmac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "form", "wizard_", "import_", "storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sha", "\\u", "hmac_", "=_", "sha", "\\u", "constructor_", "\\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_", "Cooki", "e", "Storage_", "(_", "storage_", "._", "Base", "Storage_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoder_", "=_", "json_", "._", "JSO", "NE", "ncode", "r_", "(_", "separators_", "=_", "(_", "','_", ",_", "':'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Cooki", "e", "Storage_", "(_", "storage_", "._", "Base", "Storage_", ")_", ":_", "\\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_", "(_", "Cooki", "e", "Storage_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "self_", "._", "load", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "init", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cooki", "e", "Storage_", "(_", "storage_", "._", "Base", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "uns", "ign", "\\u", "cookie", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bits_", "=_", "data_", "._", "split_", "(_", "'$'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "bits_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bits_", "[_", "0_", "]_", "==_", "self_", "._", "get", "\\u", "cookie", "\\u", "hash_", "(_", "bits_", "[_", "1_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bits_", "[_", "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_", "raise_", "Sus", "picio", "us", "Operation_", "(_", "'", "Form", "Wiz", "ard", " ", "cookie", " ", "manipulate", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cooki", "e", "Storage_", "(_", "storage_", "._", "Base", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "request_", "._", "COOKIE", "S_", "._", "get_", "(_", "self_", "._", "prefix_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cookie", "\\u", "data_", "=_", "self_", "._", "uns", "ign", "\\u", "cookie", "\\u", "data_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cookie", "\\u", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json_", "._", "loads_", "(_", "cookie", "\\u", "data_", ",_", "cls_", "=_", "json_", "._", "JSO", "ND", "ecode", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cooki", "e", "Storage_", "(_", "storage_", "._", "Base", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "response_", "(_", "self_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "set\\u", "cookie_", "(_", "self_", "._", "prefix_", ",_", "self_", "._", "create", "\\u", "cookie", "\\u", "data_", "(_", "self_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "._", "delete", "\\u", "cookie_", "(_", "self_", "._", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cooki", "e", "Storage_", "(_", "storage_", "._", "Base", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "cookie", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encode", "d\\u", "data_", "=_", "self_", "._", "encoder_", "._", "encode_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cookie", "\\u", "data_", "=_", "'%", "s", "$%", "s", "'_", "%_", "(_", "self_", "._", "get", "\\u", "cookie", "\\u", "hash_", "(_", "encode", "d\\u", "data_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encode", "d\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cookie", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cooki", "e", "Storage_", "(_", "storage_", "._", "Base", "Storage_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "cookie", "\\u", "hash_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hmac_", "._", "new_", "(_", "'%", "s", "$%", "s", "'_", "%_", "(_", "settings_", "._", "SEC", "RET", "\\u", "KEY_", ",_", "self_", "._", "prefix_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", ",_", "sha", "\\u", "hmac_", ")_", "._", "hexdigest_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
fredrik-johansson/mpmath/mpmath/tests/test_division.py
[ { "content": "def test_tight_integer_division():\n # Test that integer division at tightest possible precision is exact\n N = 100\n seed(1)\n for i in range(N):\n a = choice([1, -1]) * randint(1, 1<<randint(10, 100))\n b = choice([1, -1]) * randint(1, 1<<randint(10, 100))\n p = a * b\n width = bitcount(abs(b)) - trailing(b)\n a = fi(a); b = fi(b); p = fi(p)\n for mode in all_modes:\n assert mpf_div(p, a, width, mode) == b", "metadata": "root.test_tight_integer_division", "header": "['module', '___EOS___']", "index": 77 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "tig", "ht", "\\u", "integ", "er", "\\u", "division_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "integ", "er", " ", "divisi", "on", " ", "at", " ", "tig", "hte", "st", " ", "possib", "le", " ", "preci", "sion", " ", "is", " ", "exact_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seed_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "N_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "choice_", "(_", "[_", "1_", ",_", "-_", "1_", "]_", ")_", "*_", "randint_", "(_", "1_", ",_", "1_", "<<_", "randint_", "(_", "10_", ",_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "choice_", "(_", "[_", "1_", ",_", "-_", "1_", "]_", ")_", "*_", "randint_", "(_", "1_", ",_", "1_", "<<_", "randint_", "(_", "10_", ",_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "a_", "*_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "bit", "count_", "(_", "abs_", "(_", "b_", ")_", ")_", "-_", "trail", "ing_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "fi_", "(_", "a_", ")_", ";_", "b_", "=_", "fi_", "(_", "b_", ")_", ";_", "p_", "=_", "fi_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mode_", "in_", "all", "\\u", "modes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "mpf", "\\u", "div_", "(_", "p_", ",_", "a_", ",_", "width_", ",_", "mode_", ")_", "==_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
frappe/frappe/frappe/patches/v6_6/fix_file_url.py
[ { "content": "from __future__ import unicode_literals\nimport frappe\nfrom frappe.model.meta import is_single\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def execute():\n\t\"\"\"Fix old style file urls that start with files/\"\"\"\n\tfix_file_urls()\n\tfix_attach_field_urls()", "metadata": "root.execute", "header": "['module', '___EOS___']", "index": 4 }, { "content": "def fix_file_urls():\n\tfor file in frappe.db.sql_list(\"\"\"select name from `tabFile` where file_url like 'files/%'\"\"\"):\n\t\tfile = frappe.get_doc(\"File\", file)\n\t\tfile.db_set(\"file_url\", \"/\" + file.file_url, update_modified=False)\n\t\ttry:\n\t\t\tfile.validate_file()\n\t\t\tfile.db_set(\"file_name\", file.file_name, update_modified=False)\n\t\t\tif not file.content_hash:\n\t\t\t\tfile.generate_content_hash()\n\t\t\t\tfile.db_set(\"content_hash\", file.content_hash, update_modified=False)\n\n\t\texcept IOError:\n\t\t\tpass", "metadata": "root.fix_file_urls", "header": "['module', '___EOS___']", "index": 9 }, { "content": "def fix_attach_field_urls():\n\t# taken from an old patch\n\tattach_fields = (frappe.db.sql(\"\"\"select parent, fieldname from `tabDocField` where fieldtype in ('Attach', 'Attach Image')\"\"\") +\n\t\tfrappe.db.sql(\"\"\"select dt, fieldname from `tabCustom Field` where fieldtype in ('Attach', 'Attach Image')\"\"\"))\n\n\tfor doctype, fieldname in attach_fields:\n\t\tif is_single(doctype):\n\t\t\tfrappe.db.sql(\"\"\"update `tabSingles` set value=concat(\"/\", `value`)\n\t\t\t\twhere doctype=%(doctype)s and field=%(fieldname)s\n\t\t\t\t\tand value like 'files/%%'\"\"\", {\"doctype\": doctype, \"fieldname\": fieldname})\n\t\telse:\n\t\t\tfrappe.db.sql(\"\"\"update `tab{doctype}` set `{fieldname}`=concat(\"/\", `{fieldname}`)\n\t\t\t\twhere `{fieldname}` like 'files/%'\"\"\".format(doctype=doctype, fieldname=fieldname))", "metadata": "root.fix_attach_field_urls", "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_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "frappe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "frappe_", "._", "model_", "._", "meta_", "import_", "is", "\\u", "single_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "execute_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Fix", " ", "old", " ", "style", " ", "file", " ", "urls", " ", "tha", "t", " ", "start", " ", "with", " ", "files", "/\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fix", "\\u", "file", "\\u", "urls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fix", "\\u", "attach", "\\u", "field", "\\u", "urls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fix", "\\u", "file", "\\u", "urls_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "for_", "file_", "in_", "frappe_", "._", "db_", "._", "sql", "\\u", "list_", "(_", "\"\"\"", "select", " ", "name", " ", "from", " ", "`", "tab", "File", "`", " ", "where", " ", "file", "\\u", "url", " ", "like", " ", "'", "files", "/", "%'", "\"\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "file_", "=_", "frappe_", "._", "get", "\\u", "doc_", "(_", "\"", "File", "\"_", ",_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "db", "\\u", "set_", "(_", "\"", "file", "\\u", "url", "\"_", ",_", "\"/\"_", "+_", "file_", "._", "file", "\\u", "url_", ",_", "update", "\\u", "modified_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "file_", "._", "validat", "e\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "db", "\\u", "set_", "(_", "\"", "file", "\\u", "name", "\"_", ",_", "file_", "._", "file", "\\u", "name_", ",_", "update", "\\u", "modified_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "file_", "._", "content", "\\u", "hash_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "file_", "._", "generat", "e\\u", "content", "\\u", "hash_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "db", "\\u", "set_", "(_", "\"", "content", "\\u", "hash", "\"_", ",_", "file_", "._", "content", "\\u", "hash_", ",_", "update", "\\u", "modified_", "=_", "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_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\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_", "def_", "fix", "\\u", "attach", "\\u", "field", "\\u", "urls_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "take", "n", " ", "from", " ", "an", " ", "old", " ", "patch_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "attach", "\\u", "fields_", "=_", "(_", "frappe_", "._", "db_", "._", "sql_", "(_", "\"\"\"", "select", " ", "parent", ",", " ", "field", "name", " ", "from", " ", "`", "tab", "Doc", "Field", "`", " ", "where", " ", "field", "type", " ", "in", " ", "('", "Attach", "',", " ", "'", "Attach", " ", "Image", "')", "\"\"\"_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "frappe_", "._", "db_", "._", "sql_", "(_", "\"\"\"", "select", " ", "dt", ",", " ", "field", "name", " ", "from", " ", "`", "tab", "Custom", " ", "Field", "`", " ", "where", " ", "field", "type", " ", "in", " ", "('", "Attach", "',", " ", "'", "Attach", " ", "Image", "')", "\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "doctype_", ",_", "fieldname_", "in_", "attach", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "is", "\\u", "single_", "(_", "doctype_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "frappe_", "._", "db_", "._", "sql_", "(_", "\"\"\"", "update", " ", "`", "tab", "Sing", "les", "`", " ", "set", " ", "value", "=", "conc", "at", "(\"", "/\"", ",", " ", "`", "value", "`)", "\\", "10", ";", "\t\t\t", "\t", "where", " ", "doct", "ype", "=", "%", "(", "doct", "ype", ")", "s", " ", "and", " ", "field", "=", "%", "(", "field", "name", ")", "s", "\\", "10", ";", "\t\t\t", "\t", "\t", "and", " ", "value", " ", "like", " ", "'", "files", "/", "%%'", "\"\"\"_", ",_", "{_", "\"", "doct", "ype", "\"_", ":_", "doctype_", ",_", "\"", "field", "name", "\"_", ":_", "fieldname_", "}_", ")_", "\\u\\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_", "frappe_", "._", "db_", "._", "sql_", "(_", "\"\"\"", "update", " ", "`", "tab", "{", "doct", "ype", "}`", " ", "set", " ", "`", "{", "field", "name", "}`", "=", "conc", "at", "(\"", "/\"", ",", " ", "`", "{", "field", "name", "}`", ")", "\\", "10", ";", "\t\t\t", "\t", "where", " ", "`", "{", "field", "name", "}`", " ", "like", " ", "'", "files", "/", "%'", "\"\"\"_", "._", "format_", "(_", "doctype_", "=_", "doctype_", ",_", "fieldname_", "=_", "fieldname_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
zorna/zorna/zorna/articles/templatetags/articles_tags.py
[ { "content": "import os\n\nfrom django.core.urlresolvers import reverse\nfrom django.template import TemplateSyntaxError\nfrom django import template\nfrom django.template import Variable\n\n\nfrom zorna.acl.models import get_allowed_objects\nfrom zorna.articles.models import ArticleCategory, ArticleStory\n\nregister = template.Library()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\npages_item_menu = register.inclusion_tag(\n 'extends.html',\n takes_context=True\n)(pages_item_menu)\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class categories_by_permission_node(template.Node):\n\n", "metadata": "root.categories_by_permission_node", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def __init__(self, permission, var_name):\n self.permission = permission\n self.var_name = var_name", "metadata": "root.categories_by_permission_node.__init__", "header": "['class', 'categories_by_permission_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 16 }, { "content": " def render(self, context):\n request = context['request']\n allowed_objects = get_allowed_objects(\n request.user, ArticleCategory, self.permission)\n context[self.var_name] = allowed_objects\n return ''", "metadata": "root.categories_by_permission_node.render", "header": "['class', 'categories_by_permission_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 20 }, { "content": "@register.tag(name=\"get_categories_by_permission\")\ndef get_categories_by_permission(parser, token):\n bits = token.split_contents()\n if 4 != len(bits):\n raise TemplateSyntaxError('%r expects 4 arguments' % bits[0])\n if bits[-2] != 'as':\n raise TemplateSyntaxError(\n '%r expects \"as\" as the second argument' % bits[0])\n permission = bits[1]\n varname = bits[-1]\n return categories_by_permission_node(permission, varname)", "metadata": "root.get_categories_by_permission", "header": "['module', '___EOS___']", "index": 28 }, { "content": "class category_childs_node(template.Node):\n\n", "metadata": "root.category_childs_node", "header": "['module', '___EOS___']", "index": 41 }, { "content": " def __init__(self, permission, object, var_name):\n self.object = Variable(object)\n self.var_name = var_name\n self.permission = permission", "metadata": "root.category_childs_node.__init__", "header": "['class', 'category_childs_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 43 }, { "content": " def render(self, context):\n request = context['request']\n allowed_objects = get_allowed_objects(\n request.user, ArticleCategory, self.permission)\n object = self.object.resolve(context)\n categories = object.get_children().filter(id__in=allowed_objects)\n for cat in categories:\n cat.url = cat.get_url_path()\n context[self.var_name] = categories\n return ''", "metadata": "root.category_childs_node.render", "header": "['class', 'category_childs_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 48 }, { "content": "@register.tag(name=\"category_childs\")\ndef category_childs(parser, token):\n bits = token.split_contents()\n if 5 != len(bits):\n raise TemplateSyntaxError('%r expects 5 arguments' % bits[0])\n if bits[-2] != 'as':\n raise TemplateSyntaxError(\n '%r expects \"as\" as the second argument' % bits[0])\n permission = bits[1]\n category = bits[2]\n varname = bits[-1]\n return category_childs_node(permission, category, varname)", "metadata": "root.category_childs", "header": "['module', '___EOS___']", "index": 60 }, { "content": "class category_ancestors_node(template.Node):\n\n", "metadata": "root.category_ancestors_node", "header": "['module', '___EOS___']", "index": 74 }, { "content": " def __init__(self, object, var_name):\n self.object = Variable(object)\n self.var_name = var_name", "metadata": "root.category_ancestors_node.__init__", "header": "['class', 'category_ancestors_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 76 }, { "content": " def render(self, context):\n object = self.object.resolve(context)\n request = context['request']\n allowed_objects = get_allowed_objects(\n request.user, ArticleCategory, 'reader')\n context[self.var_name] = object.get_ancestors().filter(\n id__in=allowed_objects)\n return ''", "metadata": "root.category_ancestors_node.render", "header": "['class', 'category_ancestors_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 80 }, { "content": "@register.tag(name=\"category_ancestors\")\ndef category_ancestors(parser, token):\n bits = token.split_contents()\n if 4 != len(bits):\n raise TemplateSyntaxError('%r expects 4 arguments' % bits[0])\n if bits[-2] != 'as':\n raise TemplateSyntaxError(\n '%r expects \"as\" as the second argument' % bits[0])\n category = bits[1]\n varname = bits[-1]\n return category_ancestors_node(category, varname)", "metadata": "root.category_ancestors", "header": "['module', '___EOS___']", "index": 90 }, { "content": "class category_roots_node(template.Node):\n\n", "metadata": "root.category_roots_node", "header": "['module', '___EOS___']", "index": 103 }, { "content": " def __init__(self, permission, var_name):\n self.var_name = var_name\n self.permission = permission", "metadata": "root.category_roots_node.__init__", "header": "['class', 'category_roots_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 105 }, { "content": " def render(self, context):\n request = context['request']\n allowed_objects = get_allowed_objects(\n request.user, ArticleCategory, self.permission)\n categories = ArticleCategory.objects.filter(\n parent__isnull=True, id__in=allowed_objects)\n for cat in categories:\n cat.url = cat.get_url_path()\n context[self.var_name] = categories\n return ''", "metadata": "root.category_roots_node.render", "header": "['class', 'category_roots_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 109 }, { "content": "@register.tag(name=\"category_roots\")\ndef category_roots(parser, token):\n bits = token.split_contents()\n if 4 != len(bits):\n raise TemplateSyntaxError('%r expects 4 arguments' % bits[0])\n if bits[-2] != 'as':\n raise TemplateSyntaxError(\n '%r expects \"as\" as the second argument' % bits[0])\n permission = bits[1]\n varname = bits[-1]\n return category_roots_node(permission, varname)", "metadata": "root.category_roots", "header": "['module', '___EOS___']", "index": 121 }, { "content": "class get_recent_stories_node(template.Node):\n\n", "metadata": "root.get_recent_stories_node", "header": "['module', '___EOS___']", "index": 134 }, { "content": " def __init__(self, limit, categories, var_name):\n self.limit = limit\n self.var_name = var_name\n self.categories = categories", "metadata": "root.get_recent_stories_node.__init__", "header": "['class', 'get_recent_stories_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 136 }, { "content": " def render(self, context):\n request = context['request']\n allowed_objects = get_allowed_objects(\n request.user, ArticleCategory, 'reader')\n mao = get_allowed_objects(\n request.user, ArticleCategory, 'manager')\n\n if self.categories is not None:\n categories = map(int, self.categories.split(','))\n allowed_objects = [ c for c in categories if c in allowed_objects]\n stories = ArticleStory.objects.select_related().filter(\n categories__in=allowed_objects).distinct().order_by('-time_updated')[:int(self.limit)]\n for story in stories:\n story.current_categories = story.categories.all()\n story.current_category = story.current_categories[0]\n story.url = reverse('view_story', args=[story.current_category.pk, story.pk, story.slug])\n intersect = set(mao).intersection( set([category.pk for category in story.current_categories]))\n if intersect:\n story.edit__url = reverse('edit_story', args=[story.pk])\n context[self.var_name] = stories\n return ''", "metadata": "root.get_recent_stories_node.render", "header": "['class', 'get_recent_stories_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 141 }, { "content": "@register.tag(name=\"get_recent_stories\")\ndef get_recent_stories(parser, token):\n \"\"\"\n {% get_recent_stories [ids] limit as stories %}\n ids : optional or as 2,3\n limit: how many stories\n \"\"\"\n bits = token.split_contents()\n len_bits = len(bits)\n if len_bits not in [4,5]:\n raise TemplateSyntaxError('%r expects 4 or 5 arguments' % bits[0])\n if bits[-2] != 'as':\n raise TemplateSyntaxError(\n '%r expects \"as\" as the third argument' % bits[0])\n categories = bits[1] if len_bits == 5 else None\n limit = bits[1] if len_bits == 4 else bits[2]\n varname = bits[-1]\n return get_recent_stories_node(limit, categories, varname)", "metadata": "root.get_recent_stories", "header": "['module', '___EOS___']", "index": 164 }, { "content": "class get_story_node(template.Node):\n\n", "metadata": "root.get_story_node", "header": "['module', '___EOS___']", "index": 184 }, { "content": " def __init__(self, story, var_name):\n self.story = Variable(story)\n self.var_name = var_name", "metadata": "root.get_story_node.__init__", "header": "['class', 'get_story_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 186 }, { "content": " def render(self, context):\n request = context['request']\n s = self.story.resolve(context)\n allowed_objects = get_allowed_objects(\n request.user, ArticleCategory, 'reader')\n mao = get_allowed_objects(\n request.user, ArticleCategory, 'manager')\n stories = ArticleStory.objects.select_related().filter(\n categories__in=allowed_objects, pk=int(s))\n\n if stories:\n story = stories[0]\n story.current_categories = story.categories.all()\n story.current_category = story.current_categories[0]\n story.url = reverse('view_story', args=[story.current_category.pk, story.pk, story.slug])\n intersect = set(mao).intersection( set([category.pk for category in story.current_categories]))\n if intersect:\n story.edit__url = reverse('edit_story', args=[story.pk])\n context[self.var_name] = story\n else:\n context[self.var_name] = None\n return ''", "metadata": "root.get_story_node.render", "header": "['class', 'get_story_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 190 }, { "content": "@register.tag(name=\"get_story\")\ndef get_story(parser, token):\n bits = token.split_contents()\n if 4 != len(bits):\n raise TemplateSyntaxError('%r expects 4 arguments' % bits[0])\n if bits[-2] != 'as':\n raise TemplateSyntaxError(\n '%r expects \"as\" as the second argument' % bits[0])\n story = bits[1]\n varname = bits[-1]\n return get_story_node(story, varname)", "metadata": "root.get_story", "header": "['module', '___EOS___']", "index": 214 }, { "content": "class get_story_attachments_node(template.Node):\n\n", "metadata": "root.get_story_attachments_node", "header": "['module', '___EOS___']", "index": 227 }, { "content": " def __init__(self, story, var_name):\n self.story = Variable(story)\n self.var_name = var_name", "metadata": "root.get_story_attachments_node.__init__", "header": "['class', 'get_story_attachments_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 229 }, { "content": " def render(self, context):\n request = context['request']\n s = self.story.resolve(context)\n allowed_objects = get_allowed_objects(\n request.user, ArticleCategory, 'reader')\n stories = ArticleStory.objects.select_related().filter(\n categories__in=allowed_objects, pk=s.pk)\n attachments = s.articleattachments_set.all()\n for f in attachments:\n f.file_name = os.path.basename(f.attached_file.name)\n f.file_url = reverse('get_story_file', args=[f.pk])\n if stories:\n context[self.var_name] = attachments\n else:\n context[self.var_name] = None\n return ''", "metadata": "root.get_story_attachments_node.render", "header": "['class', 'get_story_attachments_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 233 }, { "content": "@register.tag(name=\"get_story_attachments\")\ndef get_story_attachments(parser, token):\n bits = token.split_contents()\n if 4 != len(bits):\n raise TemplateSyntaxError('%r expects 4 arguments' % bits[0])\n if bits[-2] != 'as':\n raise TemplateSyntaxError(\n '%r expects \"as\" as the second argument' % bits[0])\n story = bits[1]\n varname = bits[-1]\n return get_story_attachments_node(story, varname)", "metadata": "root.get_story_attachments", "header": "['module', '___EOS___']", "index": 251 }, { "content": "def pages_item_menu(context, category, permission, template='pages_item_menu.html'):\n request = context['request']\n allowed_objects = get_allowed_objects(\n request.user, ArticleCategory, permission)\n children = category.get_children().filter(id__in=allowed_objects)\n for cat in children:\n cat.url = cat.get_url_path()\n return {'template': template, 'children': children, 'category': category, 'request': request}", "metadata": "root.pages_item_menu", "header": "['module', '___EOS___']", "index": 264 }, { "content": "class get_category_stories_node(template.Node):\n\n", "metadata": "root.get_category_stories_node", "header": "['module', '___EOS___']", "index": 279 }, { "content": " def __init__(self, category, limit, var_name):\n self.category = template.Variable(category)\n self.limit = limit\n self.var_name = var_name", "metadata": "root.get_category_stories_node.__init__", "header": "['class', 'get_category_stories_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 281 }, { "content": " def render(self, context):\n request = context['request']\n category = self.category.resolve(context)\n try:\n categories = map(int, category.split(','))\n except:\n context[self.var_name] = []\n return ''\n\n allowed_objects = get_allowed_objects(\n request.user, ArticleCategory, 'reader')\n categories = [ c for c in categories if c in allowed_objects]\n if categories:\n categories = ArticleCategory.objects.filter(pk__in=categories)\n mao = get_allowed_objects(\n request.user, ArticleCategory, 'reader')\n\n stories = ArticleStory.objects.select_related().filter(\n categories__in=categories).distinct().order_by('-time_updated')[:int(self.limit)]\n for story in stories:\n story.current_categories = story.categories.all()\n story.current_category = story.current_categories[0]\n story.url = reverse('view_story', args=[story.current_category.pk, story.pk, story.slug])\n intersect = set(mao).intersection( set([category.pk for category in story.current_categories]))\n if intersect:\n story.edit__url = reverse('edit_story', args=[story.pk])\n else:\n stories = []\n context[self.var_name] = stories\n return ''", "metadata": "root.get_category_stories_node.render", "header": "['class', 'get_category_stories_node', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 286 }, { "content": "@register.tag(name=\"get_category_stories\")\ndef get_category_stories(parser, token):\n bits = token.split_contents()\n if 5 != len(bits):\n raise TemplateSyntaxError('%r expects 5 arguments' % bits[0])\n if bits[-2] != 'as':\n raise TemplateSyntaxError(\n '%r expects \"as\" as the third argument' % bits[0])\n category = bits[1]\n limit = bits[2]\n varname = bits[-1]\n return get_category_stories_node(category, limit, varname)", "metadata": "root.get_category_stories", "header": "['module', '___EOS___']", "index": 318 } ]
[]
[]
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_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Templa", "te", "Syntax", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zor", "na_", "._", "acl_", "._", "models_", "import_", "get", "\\u", "allow", "ed", "\\u", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zor", "na_", "._", "articles_", "._", "models_", "import_", "Artic", "le", "Category_", ",_", "Artic", "le", "Stor", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "register_", "=_", "template_", "._", "Library_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uN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\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page", "s", "\\u", "item", "\\u", "menu_", "=_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extend", "s", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "take", "s", "\\u", "context_", "=_", "True_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "(_", "page", "s", "\\u", "item", "\\u", "menu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "categor", "ies", "\\u", "by", "\\u", "permissi", "on", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", "categor", "ies", "\\u", "by", "\\u", "permissi", "on", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", ",_", "permission_", ",_", "var", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "permission_", "=_", "permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "var", "\\u", "name_", "=_", "var", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "categor", "ies", "\\u", "by", "\\u", "permissi", "on", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "[_", "'", "request", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "objects_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "self_", "._", "permission_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "self_", "._", "var", "\\u", "name_", "]_", "=_", "allow", "ed", "\\u", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "tag_", "(_", "name_", "=_", "\"", "get", "\\u", "categor", "ies", "\\u", "by", "\\u", "permissi", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "categor", "ies", "\\u", "by", "\\u", "permission_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "token_", "._", "split", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "4_", "!=_", "len_", "(_", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "r", " ", "expect", "s", " ", "4", " ", "argu", "ment", "s", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bits_", "[_", "-_", "2_", "]_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", " ", "expect", "s", " ", "\"", "as", "\"", " ", "as", " ", "the", " ", "second", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "permission_", "=_", "bits_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varname_", "=_", "bits_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "categor", "ies", "\\u", "by", "\\u", "permissi", "on", "\\u", "node_", "(_", "permission_", ",_", "varname_", ")_", "\\u\\u\\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_", "category", "\\u", "child", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", "category", "\\u", "child", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", ",_", "permission_", ",_", "object_", ",_", "var", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "object_", "=_", "Variable_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "var", "\\u", "name_", "=_", "var", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "permission_", "=_", "permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "category", "\\u", "child", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "[_", "'", "request", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "objects_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "self_", "._", "permission_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object_", "=_", "self_", "._", "object_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "categories_", "=_", "object_", "._", "get", "\\u", "children_", "(_", ")_", "._", "filter_", "(_", "id", "\\u\\u", "in_", "=_", "allow", "ed", "\\u", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cat_", "in_", "categories_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cat_", "._", "url_", "=_", "cat_", "._", "get", "\\u", "url", "\\u", "path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "self_", "._", "var", "\\u", "name_", "]_", "=_", "categories_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "tag_", "(_", "name_", "=_", "\"", "category", "\\u", "child", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "category", "\\u", "childs_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "token_", "._", "split", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "5_", "!=_", "len_", "(_", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "r", " ", "expect", "s", " ", "5", " ", "argu", "ment", "s", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bits_", "[_", "-_", "2_", "]_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", " ", "expect", "s", " ", "\"", "as", "\"", " ", "as", " ", "the", " ", "second", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "permission_", "=_", "bits_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "category_", "=_", "bits_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varname_", "=_", "bits_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "category", "\\u", "child", "s", "\\u", "node_", "(_", "permission_", ",_", "category_", ",_", "varname_", ")_", "\\u\\u\\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_", "category", "\\u", "ancestor", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", "category", "\\u", "ancestor", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", ",_", "object_", ",_", "var", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "object_", "=_", "Variable_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "var", "\\u", "name_", "=_", "var", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "category", "\\u", "ancestor", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "self_", "._", "object_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "context_", "[_", "'", "request", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "objects_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "'", "reader", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "self_", "._", "var", "\\u", "name_", "]_", "=_", "object_", "._", "get", "\\u", "ancestors_", "(_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id", "\\u\\u", "in_", "=_", "allow", "ed", "\\u", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "tag_", "(_", "name_", "=_", "\"", "category", "\\u", "ancestor", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "category", "\\u", "ancestors_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "token_", "._", "split", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "4_", "!=_", "len_", "(_", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "r", " ", "expect", "s", " ", "4", " ", "argu", "ment", "s", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bits_", "[_", "-_", "2_", "]_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", " ", "expect", "s", " ", "\"", "as", "\"", " ", "as", " ", "the", " ", "second", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "category_", "=_", "bits_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varname_", "=_", "bits_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "category", "\\u", "ancestor", "s", "\\u", "node_", "(_", "category_", ",_", "varname_", ")_", "\\u\\u\\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_", "category", "\\u", "root", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", "category", "\\u", "root", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", ",_", "permission_", ",_", "var", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "var", "\\u", "name_", "=_", "var", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "permission_", "=_", "permission_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "category", "\\u", "root", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "[_", "'", "request", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "objects_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "self_", "._", "permission_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "categories_", "=_", "Artic", "le", "Category_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "\\u\\u", "isnull_", "=_", "True_", ",_", "id", "\\u\\u", "in_", "=_", "allow", "ed", "\\u", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cat_", "in_", "categories_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cat_", "._", "url_", "=_", "cat_", "._", "get", "\\u", "url", "\\u", "path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "self_", "._", "var", "\\u", "name_", "]_", "=_", "categories_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "tag_", "(_", "name_", "=_", "\"", "category", "\\u", "root", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "category", "\\u", "roots_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "token_", "._", "split", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "4_", "!=_", "len_", "(_", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "r", " ", "expect", "s", " ", "4", " ", "argu", "ment", "s", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bits_", "[_", "-_", "2_", "]_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", " ", "expect", "s", " ", "\"", "as", "\"", " ", "as", " ", "the", " ", "second", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "permission_", "=_", "bits_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varname_", "=_", "bits_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "category", "\\u", "root", "s", "\\u", "node_", "(_", "permission_", ",_", "varname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "get", "\\u", "recent", "\\u", "stories", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "get", "\\u", "recent", "\\u", "stories", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", ",_", "limit_", ",_", "categories_", ",_", "var", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "limit_", "=_", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "var", "\\u", "name_", "=_", "var", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "categories_", "=_", "categories_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "get", "\\u", "recent", "\\u", "stories", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "[_", "'", "request", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "objects_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "'", "reader", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ma", "o_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "'", "manage", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "categories_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "categories_", "=_", "map_", "(_", "int_", ",_", "self_", "._", "categories_", "._", "split_", "(_", "','_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "objects_", "=_", "[_", "c_", "for_", "c_", "in_", "categories_", "if_", "c_", "in_", "allow", "ed", "\\u", "objects_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stories", "_", "=_", "Artic", "le", "Stor", "y_", "._", "objects_", "._", "select", "\\u", "related_", "(_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "categor", "ies", "\\u\\u", "in_", "=_", "allow", "ed", "\\u", "objects_", ")_", "._", "distinct_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "time", "\\u", "update", "d", "'_", ")_", "[_", ":_", "int_", "(_", "self_", "._", "limit_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "story_", "in_", "stories", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "story_", "._", "current", "\\u", "categories_", "=_", "story_", "._", "categories_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "story_", "._", "current", "\\u", "category_", "=_", "story_", "._", "current", "\\u", "categories_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "story_", "._", "url_", "=_", "reverse_", "(_", "'", "view", "\\u", "stor", "y", "'_", ",_", "args_", "=_", "[_", "story_", "._", "current", "\\u", "category_", "._", "pk_", ",_", "story_", "._", "pk_", ",_", "story_", "._", "slug_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intersect_", "=_", "set_", "(_", "ma", "o_", ")_", "._", "intersection_", "(_", "set_", "(_", "[_", "category_", "._", "pk_", "for_", "category_", "in_", "story_", "._", "current", "\\u", "categories_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "intersect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "story_", "._", "edit", "\\u\\u", "url_", "=_", "reverse_", "(_", "'", "edit", "\\u", "stor", "y", "'_", ",_", "args_", "=_", "[_", "story_", "._", "pk_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "self_", "._", "var", "\\u", "name_", "]_", "=_", "stories", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "tag_", "(_", "name_", "=_", "\"", "get", "\\u", "recent", "\\u", "stories", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "recent", "\\u", "stories", "_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "get", "\\u", "recent", "\\u", "stories", " ", "[", "ids", "]", " ", "limit", " ", "as", " ", "stories", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "ids", " ", ":", " ", "option", "al", " ", "or", " ", "as", " ", "2", ",", "3", "\\", "10", ";", " ", " ", " ", " ", "limit", ":", " ", "how", " ", "many", " ", "stories", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bits_", "=_", "token_", "._", "split", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "len", "\\u", "bits_", "=_", "len_", "(_", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len", "\\u", "bits_", "not_", "in_", "[_", "4_", ",_", "5_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "r", " ", "expect", "s", " ", "4", " ", "or", " ", "5", " ", "argu", "ment", "s", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bits_", "[_", "-_", "2_", "]_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", " ", "expect", "s", " ", "\"", "as", "\"", " ", "as", " ", "the", " ", "third", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "categories_", "=_", "bits_", "[_", "1_", "]_", "if_", "len", "\\u", "bits_", "==_", "5_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "bits_", "[_", "1_", "]_", "if_", "len", "\\u", "bits_", "==_", "4_", "else_", "bits_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varname_", "=_", "bits_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "get", "\\u", "recent", "\\u", "stories", "\\u", "node_", "(_", "limit_", ",_", "categories_", ",_", "varname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "get", "\\u", "stor", "y", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "get", "\\u", "stor", "y", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", ",_", "story_", ",_", "var", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "story_", "=_", "Variable_", "(_", "story_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "var", "\\u", "name_", "=_", "var", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "get", "\\u", "stor", "y", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "[_", "'", "request", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "self_", "._", "story_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "objects_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "'", "reader", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ma", "o_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "'", "manage", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stories", "_", "=_", "Artic", "le", "Stor", "y_", "._", "objects_", "._", "select", "\\u", "related_", "(_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "categor", "ies", "\\u\\u", "in_", "=_", "allow", "ed", "\\u", "objects_", ",_", "pk_", "=_", "int_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "stories", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "story_", "=_", "stories", "_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "story_", "._", "current", "\\u", "categories_", "=_", "story_", "._", "categories_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "story_", "._", "current", "\\u", "category_", "=_", "story_", "._", "current", "\\u", "categories_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "story_", "._", "url_", "=_", "reverse_", "(_", "'", "view", "\\u", "stor", "y", "'_", ",_", "args_", "=_", "[_", "story_", "._", "current", "\\u", "category_", "._", "pk_", ",_", "story_", "._", "pk_", ",_", "story_", "._", "slug_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intersect_", "=_", "set_", "(_", "ma", "o_", ")_", "._", "intersection_", "(_", "set_", "(_", "[_", "category_", "._", "pk_", "for_", "category_", "in_", "story_", "._", "current", "\\u", "categories_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "intersect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "story_", "._", "edit", "\\u\\u", "url_", "=_", "reverse_", "(_", "'", "edit", "\\u", "stor", "y", "'_", ",_", "args_", "=_", "[_", "story_", "._", "pk_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "self_", "._", "var", "\\u", "name_", "]_", "=_", "story_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "self_", "._", "var", "\\u", "name_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "tag_", "(_", "name_", "=_", "\"", "get", "\\u", "stor", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "story_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "token_", "._", "split", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "4_", "!=_", "len_", "(_", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "r", " ", "expect", "s", " ", "4", " ", "argu", "ment", "s", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bits_", "[_", "-_", "2_", "]_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", " ", "expect", "s", " ", "\"", "as", "\"", " ", "as", " ", "the", " ", "second", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "story_", "=_", "bits_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varname_", "=_", "bits_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "get", "\\u", "stor", "y", "\\u", "node_", "(_", "story_", ",_", "varname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "get", "\\u", "stor", "y", "\\u", "attach", "ment", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "get", "\\u", "stor", "y", "\\u", "attach", "ment", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", ",_", "story_", ",_", "var", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "story_", "=_", "Variable_", "(_", "story_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "var", "\\u", "name_", "=_", "var", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "get", "\\u", "stor", "y", "\\u", "attach", "ment", "s", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "[_", "'", "request", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "self_", "._", "story_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "objects_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "'", "reader", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stories", "_", "=_", "Artic", "le", "Stor", "y_", "._", "objects_", "._", "select", "\\u", "related_", "(_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "categor", "ies", "\\u\\u", "in_", "=_", "allow", "ed", "\\u", "objects_", ",_", "pk_", "=_", "s_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attachments_", "=_", "s_", "._", "article", "attach", "ment", "s", "\\u", "set_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "attachments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "file", "\\u", "name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "f_", "._", "attache", "d\\u", "file_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "file", "\\u", "url_", "=_", "reverse_", "(_", "'", "get", "\\u", "stor", "y", "\\u", "file", "'_", ",_", "args_", "=_", "[_", "f_", "._", "pk_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stories", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "self_", "._", "var", "\\u", "name_", "]_", "=_", "attachments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "self_", "._", "var", "\\u", "name_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "tag_", "(_", "name_", "=_", "\"", "get", "\\u", "stor", "y", "\\u", "attach", "ment", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "stor", "y", "\\u", "attachments_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "token_", "._", "split", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "4_", "!=_", "len_", "(_", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "r", " ", "expect", "s", " ", "4", " ", "argu", "ment", "s", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bits_", "[_", "-_", "2_", "]_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", " ", "expect", "s", " ", "\"", "as", "\"", " ", "as", " ", "the", " ", "second", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "story_", "=_", "bits_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "varname_", "=_", "bits_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "get", "\\u", "stor", "y", "\\u", "attach", "ment", "s", "\\u", "node_", "(_", "story_", ",_", "varname_", ")_", "\\u\\u\\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_", "page", "s", "\\u", "item", "\\u", "menu_", "(_", "context_", ",_", "category_", ",_", "permission_", ",_", "template_", "=_", "'", "page", "s", "\\u", "item", "\\u", "menu", ".", "html", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "[_", "'", "request", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "objects_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "permission_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "children_", "=_", "category_", "._", "get", "\\u", "children_", "(_", ")_", "._", "filter_", "(_", "id", "\\u\\u", "in_", "=_", "allow", "ed", "\\u", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cat_", "in_", "children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cat_", "._", "url_", "=_", "cat_", "._", "get", "\\u", "url", "\\u", "path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "template", "'_", ":_", "template_", ",_", "'", "child", "ren", "'_", ":_", "children_", ",_", "'", "category", "'_", ":_", "category_", ",_", "'", "request", "'_", ":_", "request_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "get", "\\u", "category", "\\u", "stories", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "get", "\\u", "category", "\\u", "stories", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\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_", ",_", "category_", ",_", "limit_", ",_", "var", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "category_", "=_", "template_", "._", "Variable_", "(_", "category_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "limit_", "=_", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "var", "\\u", "name_", "=_", "var", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "get", "\\u", "category", "\\u", "stories", "\\u", "node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "context_", "[_", "'", "request", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "category_", "=_", "self_", "._", "category_", "._", "resolve_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "categories_", "=_", "map_", "(_", "int_", ",_", "category_", "._", "split_", "(_", "','_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "self_", "._", "var", "\\u", "name_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "allow", "ed", "\\u", "objects_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "'", "reader", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "categories_", "=_", "[_", "c_", "for_", "c_", "in_", "categories_", "if_", "c_", "in_", "allow", "ed", "\\u", "objects_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "categories_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "categories_", "=_", "Artic", "le", "Category_", "._", "objects_", "._", "filter_", "(_", "pk", "\\u\\u", "in_", "=_", "categories_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ma", "o_", "=_", "get", "\\u", "allow", "ed", "\\u", "objects_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "user_", ",_", "Artic", "le", "Category_", ",_", "'", "reader", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stories", "_", "=_", "Artic", "le", "Stor", "y_", "._", "objects_", "._", "select", "\\u", "related_", "(_", ")_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "categor", "ies", "\\u\\u", "in_", "=_", "categories_", ")_", "._", "distinct_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "time", "\\u", "update", "d", "'_", ")_", "[_", ":_", "int_", "(_", "self_", "._", "limit_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "story_", "in_", "stories", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "story_", "._", "current", "\\u", "categories_", "=_", "story_", "._", "categories_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "story_", "._", "current", "\\u", "category_", "=_", "story_", "._", "current", "\\u", "categories_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "story_", "._", "url_", "=_", "reverse_", "(_", "'", "view", "\\u", "stor", "y", "'_", ",_", "args_", "=_", "[_", "story_", "._", "current", "\\u", "category_", "._", "pk_", ",_", "story_", "._", "pk_", ",_", "story_", "._", "slug_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "intersect_", "=_", "set_", "(_", "ma", "o_", ")_", "._", "intersection_", "(_", "set_", "(_", "[_", "category_", "._", "pk_", "for_", "category_", "in_", "story_", "._", "current", "\\u", "categories_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "intersect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "story_", "._", "edit", "\\u\\u", "url_", "=_", "reverse_", "(_", "'", "edit", "\\u", "stor", "y", "'_", ",_", "args_", "=_", "[_", "story_", "._", "pk_", "]_", ")_", "\\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 ", " _", "stories", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "self_", "._", "var", "\\u", "name_", "]_", "=_", "stories", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "register_", "._", "tag_", "(_", "name_", "=_", "\"", "get", "\\u", "category", "\\u", "stories", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "category", "\\u", "stories", "_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bits_", "=_", "token_", "._", "split", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "5_", "!=_", "len_", "(_", "bits_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "'%", "r", " ", "expect", "s", " ", "5", " ", "argu", "ment", "s", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bits_", "[_", "-_", "2_", "]_", "!=_", "'", "as", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Templa", "te", "Syntax", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "r", " ", "expect", "s", " ", "\"", "as", "\"", " ", "as", " ", "the", " ", "third", " ", "argu", "ment", "'_", "%_", "bits_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "category_", "=_", "bits_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "bits_", "[_", "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 ]
Unused local variable
comodit/demos/openshift/helper.py
[ { "content": "def track_changes(host):\n changes = host.changes().list()\n c = changes[-1]\n current_task = -1\n done = False\n while not done:\n for t in c.tasks:\n # Skip already processed tasks\n if t.order_num < current_task:\n continue\n\n # If the current task\n if t.order_num == current_task:\n if t.status == \"OK\":\n print \" [OK]\"\n if current_task == len(c.tasks) -1:\n done = True\n continue\n elif t.status == \"ERROR\":\n print \" [ERROR](%s...)\" % t.error[:80]\n if current_task == len(c.tasks) -1:\n done = True\n continue\n if t.status == \"PENDING\":\n break\n \n # Moved to a new task\n current_task = t.order_num\n sys.stdout.write(\" - %s...\" % t.description)\n sys.stdout.flush()\n break\n\n # Otherwise we wait, refresh, and loop\n time.sleep(1)\n c.refresh()", "metadata": "root.track_changes", "header": "['module', '___EOS___']", "index": 41 } ]
[]
[]
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_", "track", "\\u", "changes_", "(_", "host_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "changes_", "=_", "host_", "._", "changes_", "(_", ")_", "._", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "changes_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "task_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "done_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "done_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "t_", "in_", "c_", "._", "tasks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ski", "p", " ", "alr", "ead", "y", " ", "process", "ed", " ", "tasks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", "._", "order", "\\u", "num_", "<_", "current", "\\u", "task_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "current", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "t_", "._", "order", "\\u", "num_", "==_", "current", "\\u", "task_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "t_", "._", "status_", "==_", "\"", "OK", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "[", "OK", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "task_", "==_", "len_", "(_", "c_", "._", "tasks_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "done_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "t_", "._", "status_", "==_", "\"", "ERROR", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", " ", "[", "ERROR", "](", "%", "s", "...)", "\"_", "%_", "t_", "._", "error_", "[_", ":_", "80_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "task_", "==_", "len_", "(_", "c_", "._", "tasks_", ")_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "done_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "t_", "._", "status_", "==_", "\"", "PEND", "ING", "\"_", ":_", "\\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_", "#", " ", "Move", "d", " ", "to", " ", "a", " ", "new", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "task_", "=_", "t_", "._", "order", "\\u", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "\"", " ", " ", "-", " ", "%", "s", "...\"_", "%_", "t_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", " ", "we", " ", "wait", ",", " ", "refre", "sh", ",", " ", "and", " ", "loop_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "refresh_", "(_", ")_" ]
[ 4, 4, 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"# coding: utf8\n\n\"\"\"\nThis software is licensed under the Apache 2 license, quoted below.\n\nCopyright 2015 Crystalnix Limited\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not\nuse this file except in compliance with the License. You may obtain a copy of\nthe License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\nWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\nLicense for the specific language governing permissions and limitations under\nthe License.\n\"\"\"\n\nimport os\nimport uuid\n\nfrom django.db import models\nfrom django.db.models.signals import pre_delete\nfrom django.dispatch import receiver\nfrom django.utils import timezone\n\nfrom jsonfield import JSONField\n\nfrom omaha.models import BaseModel\nfrom feedback.managers import FeedbackManager\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def upload_to(directory, obj, filename):\n now = timezone.now()\n return os.path.join(*map(str, [directory, now.year, now.month,\n now.day, uuid.uuid4(), filename]))", "metadata": "root.upload_to", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def screenshot_upload_to(obj, filename):\n return upload_to('screenshot', obj, filename)", "metadata": "root.screenshot_upload_to", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def blackbox_upload_to(obj, filename):\n return upload_to('blackbox', obj, filename)", "metadata": "root.blackbox_upload_to", "header": "['module', '___EOS___']", "index": 42 }, { "content": "def logs_upload_to(obj, filename):\n return upload_to('system_logs', obj, filename)", "metadata": "root.logs_upload_to", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def attach_upload_to(obj, filename):\n return upload_to('feedback_attach', obj, filename)", "metadata": "root.attach_upload_to", "header": "['module', '___EOS___']", "index": 50 }, { "content": "class Feedback(BaseModel):\n description = models.TextField()\n email = models.CharField(max_length=500, null=True, blank=True)\n page_url = models.CharField(max_length=500, null=True, blank=True)\n screenshot = models.ImageField(upload_to=screenshot_upload_to, blank=True, null=True)\n screenshot_size = models.PositiveIntegerField(null=True, blank=True)\n blackbox = models.FileField(upload_to=blackbox_upload_to, blank=True, null=True)\n blackbox_size = models.PositiveIntegerField(null=True, blank=True)\n system_logs = models.FileField(upload_to=logs_upload_to, blank=True, null=True)\n system_logs_size = models.PositiveIntegerField(null=True, blank=True)\n attached_file = models.FileField(upload_to=attach_upload_to, blank=True, null=True)\n attached_file_size = models.PositiveIntegerField(null=True, blank=True)\n feedback_data = JSONField(verbose_name='Feedback data', help_text='JSON format', null=True, blank=True)\n ip = models.GenericIPAddressField(blank=True, null=True)\n\n created_at = models.DateTimeField(auto_now_add=True, db_index=True)\n updated_at = models.DateTimeField(auto_now=True)\n\n objects = FeedbackManager()\n", "metadata": "root.Feedback", "header": "['module', '___EOS___']", "index": 54 }, { "content": " @property\n def size(self):\n return self.screenshot_size + self.blackbox_size + self.system_logs_size + self.attached_file_size", "metadata": "root.Feedback.size", "header": "['class', 'Feedback', '(', 'BaseModel', ')', ':', '___EOS___']", "index": 74 }, { "content": "@receiver(pre_delete, sender=Feedback)\ndef pre_feedback_delete(sender, instance, **kwargs):\n file_fields = [instance.screenshot, instance.blackbox, instance.system_logs, instance.attached_file]\n for field in file_fields:\n storage, name = field.storage, field.name\n if name:\n storage.delete(name)", "metadata": "root.pre_feedback_delete", "header": "['module', '___EOS___']", "index": 78 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", ":", " ", "utf8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "software", " ", "is", " ", "license", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "2", " ", "license", ",", " ", "quoted", " ", "belo", "w", ".", "\\", "10", ";", "\\", "10", ";", "Copy", "right", " ", "201", "5", " ", "Cry", "stal", "nix", " ", "Limit", "ed", "\\", "10", ";", "\\", "10", ";", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", " ", "not", "\\", "10", ";", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", "\\", "10", ";", "the", " ", "License", " ", "at", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0", "\\", "10", ";", "\\", "10", ";", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "\\", "10", ";", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT", "\\", "10", ";", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the", "\\", "10", ";", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ation", "s", " ", "under", "\\", "10", ";", "the", " ", "License", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "signals_", "import_", "pre", "\\u", "delete_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "dispatch_", "import_", "receiver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "jsonfi", "eld_", "import_", "JSO", "NF", "ield_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "oma", "ha_", "._", "models_", "import_", "Base", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "feedback_", "._", "managers_", "import_", "Feed", "back", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "upload", "\\u", "to_", "(_", "directory_", ",_", "obj_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "timezone_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "join_", "(_", "*_", "map_", "(_", "str_", ",_", "[_", "directory_", ",_", "now_", "._", "year_", ",_", "now_", "._", "month_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "now_", "._", "day_", ",_", "uuid_", "._", "uuid4_", "(_", ")_", ",_", "filename_", "]_", ")_", ")_", "\\u\\u\\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_", "screenshot", "\\u", "upload", "\\u", "to_", "(_", "obj_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "upload", "\\u", "to_", "(_", "'", "screenshot", "'_", ",_", "obj_", ",_", "filename_", ")_", "\\u\\u\\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_", "blackbo", "x", "\\u", "upload", "\\u", "to_", "(_", "obj_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "upload", "\\u", "to_", "(_", "'", "blackbo", "x", "'_", ",_", "obj_", ",_", "filename_", ")_", "\\u\\u\\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_", "logs", "\\u", "upload", "\\u", "to_", "(_", "obj_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "upload", "\\u", "to_", "(_", "'", "system", "\\u", "logs", "'_", ",_", "obj_", ",_", "filename_", ")_", "\\u\\u\\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_", "attach", "\\u", "upload", "\\u", "to_", "(_", "obj_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "upload", "\\u", "to_", "(_", "'", "feed", "back", "\\u", "attach", "'_", ",_", "obj_", ",_", "filename_", ")_", "\\u\\u\\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_", "Feed", "back_", "(_", "Base", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "description_", "=_", "models_", "._", "Text", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "500_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "url_", "=_", "models_", "._", "Char", "Field_", "(_", "max", "\\u", "length_", "=_", "500_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "screenshot_", "=_", "models_", "._", "Image", "Field_", "(_", "upload", "\\u", "to_", "=_", "screenshot", "\\u", "upload", "\\u", "to_", ",_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "screenshot", "\\u", "size_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blackbo", "x_", "=_", "models_", "._", "File", "Field_", "(_", "upload", "\\u", "to_", "=_", "blackbo", "x", "\\u", "upload", "\\u", "to_", ",_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blackbo", "x", "\\u", "size_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system", "\\u", "logs_", "=_", "models_", "._", "File", "Field_", "(_", "upload", "\\u", "to_", "=_", "logs", "\\u", "upload", "\\u", "to_", ",_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "system", "\\u", "logs", "\\u", "size_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attache", "d\\u", "file_", "=_", "models_", "._", "File", "Field_", "(_", "upload", "\\u", "to_", "=_", "attach", "\\u", "upload", "\\u", "to_", ",_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attache", "d\\u", "file", "\\u", "size_", "=_", "models_", "._", "Posi", "tiv", "e", "Integer", "Field_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "feed", "back", "\\u", "data_", "=_", "JSO", "NF", "ield_", "(_", "verbo", "se", "\\u", "name_", "=_", "'", "Feed", "back", " ", "data", "'_", ",_", "help", "\\u", "text_", "=_", "'", "JSO", "N", " ", "format", "'_", ",_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "=_", "models_", "._", "Gene", "ric", "IPA", "ddress", "Field_", "(_", "blank_", "=_", "True_", ",_", "null_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "created", "\\u", "at_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "auto", "\\u", "now", "\\u", "add_", "=_", "True_", ",_", "db", "\\u", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d\\u", "at_", "=_", "models_", "._", "Date", "Time", "Field_", "(_", "auto", "\\u", "now_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "objects_", "=_", "Feed", "back", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Feed", "back_", "(_", "Base", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "screenshot", "\\u", "size_", "+_", "self_", "._", "blackbo", "x", "\\u", "size_", "+_", "self_", "._", "system", "\\u", "logs", "\\u", "size_", "+_", "self_", "._", "attache", "d\\u", "file", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "receiver_", "(_", "pre", "\\u", "delete_", ",_", "sender_", "=_", "Feed", "back_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "pre", "\\u", "feed", "back", "\\u", "delete_", "(_", "sender_", ",_", "instance_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "fields_", "=_", "[_", "instance_", "._", "screenshot_", ",_", "instance_", "._", "blackbo", "x_", ",_", "instance_", "._", "system", "\\u", "logs_", ",_", "instance_", "._", "attache", "d\\u", "file_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "file", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "storage_", ",_", "name_", "=_", "field_", "._", "storage_", ",_", "field_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "storage_", "._", "delete_", "(_", "name_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Missing call to `__init__` during object initialization
ganeti/ganeti/lib/opcodes_base.py
[ { "content": "class BaseOpCode(outils.ValidatedSlots):\n \"\"\"A simple serializable object.\n\n This object serves as a parent class for OpCode without any custom\n field handling.\n\n \"\"\"\n # pylint: disable=E1101\n # as OP_ID is dynamically defined\n __metaclass__ = _AutoOpParamSlots\n\n\n\n\n", "metadata": "root.BaseOpCode", "header": "['module', '___EOS___']", "index": 162 }, { "content": " def __init__(self, **kwargs):\n outils.ValidatedSlots.__init__(self, **kwargs)\n for key, default, _, _ in self.__class__.GetAllParams():\n if not hasattr(self, key):\n setattr(self, key, default)", "metadata": "root.BaseOpCode.__init__", "header": "['class', 'BaseOpCode', '(', 'outils', '.', 'ValidatedSlots', ')', ':', '___EOS___']", "index": 173 } ]
[]
[]
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Op", "Code_", "(_", "out", "ils_", "._", "Validate", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "simple", " ", "serializable", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "object", " ", "serve", "s", " ", "as", " ", "a", " ", "parent", " ", "class", " ", "for", " ", "Op", "Code", " ", "with", "out", " ", "any", " ", "custom", "\\", "10", ";", " ", " ", "field", " ", "handling", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "E1", "101_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "OP", "\\u", "ID", " ", "is", " ", "dynami", "call", "y", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "metaclass\\u\\u_", "=_", "\\u", "Auto", "Op", "Param", "Slot", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Op", "Code_", "(_", "out", "ils_", "._", "Validate", "d", "Slot", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "ils_", "._", "Validate", "d", "Slot", "s_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "default_", ",_", "\\u_", ",_", "\\u_", "in_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "Get", "All", "Params_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", ",_", "key_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
michaeljoseph/changes/changes/probe.py
[ { "content": "import logging\n\nfrom os.path import exists\n\nfrom plumbum import local\nfrom plumbum.cmd import git\nfrom plumbum.commands import CommandNotFound\n\nfrom changes import attributes, exceptions\n\nlog = logging.getLogger(__name__)\n\n\nTOOLS = ['git', 'diff', 'python']\n\nTEST_RUNNERS = ['pytest', 'nose', 'tox']\n\nREADME_EXTENSIONS = [\n '.md', '.rst',\n '.txt', ''\n '.wiki', '.rdoc',\n '.org', '.pod',\n '.creole', '.textile'\n]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def report_and_raise(probe_name, probe_result, failure_msg):\n \"\"\"Logs the probe result and raises on failure\"\"\"\n log.info('%s? %s' % (probe_name, probe_result))\n if not probe_result:\n raise exceptions.ProbeException(failure_msg)\n else:\n return True", "metadata": "root.report_and_raise", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def has_setup():\n \"\"\"`setup.py`\"\"\"\n return report_and_raise(\n 'Has a setup.py',\n exists('setup.py'),\n 'Your project needs a setup.py'\n )", "metadata": "root.has_setup", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def has_binary(command):\n try:\n local.which(command)\n return True\n except CommandNotFound:\n log.info('%s does not exist' % command)\n return False", "metadata": "root.has_binary", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def has_tools():\n return any([has_binary(tool) for tool in TOOLS])", "metadata": "root.has_tools", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def has_test_runner():\n return any([has_binary(runner) for runner in TEST_RUNNERS])", "metadata": "root.has_test_runner", "header": "['module', '___EOS___']", "index": 57 }, { "content": "def has_changelog():\n \"\"\"CHANGELOG.md\"\"\"\n return report_and_raise(\n 'CHANGELOG.md',\n exists('CHANGELOG.md'),\n 'Create a CHANGELOG.md file'\n )", "metadata": "root.has_changelog", "header": "['module', '___EOS___']", "index": 61 }, { "content": "def has_readme():\n \"\"\"README\"\"\"\n return report_and_raise(\n 'README',\n any([exists('README{0}'.format(ext)) for ext in README_EXTENSIONS]),\n 'Create a (valid) README'\n )", "metadata": "root.has_readme", "header": "['module', '___EOS___']", "index": 70 }, { "content": "def has_metadata(context):\n \"\"\"`<module_name>/__init__.py` with `__version__` and `__url__`\"\"\"\n init_path = '%s/__init__.py' % context.module_name\n has_metadata = (\n exists(init_path) and\n attributes.has_attribute(context.module_name, '__version__') and\n attributes.has_attribute(context.module_name, '__url__')\n )\n return report_and_raise(\n 'Has module metadata',\n has_metadata,\n 'Your %s/__init__.py must contain __version__ and __url__ attributes'\n )", "metadata": "root.has_metadata", "header": "['module', '___EOS___']", "index": 79 }, { "content": "def has_signing_key(context):\n return 'signingkey' in git('config', '-l')", "metadata": "root.has_signing_key", "header": "['module', '___EOS___']", "index": 94 }, { "content": "def probe_project(context):\n \"\"\"\n Check if the project meets `changes` requirements.\n Complain and exit otherwise.\n \"\"\"\n log.info('Checking project for changes requirements.')\n return (\n has_tools() and has_setup() and has_metadata(context) and\n has_test_runner() and has_readme() and has_changelog()\n )", "metadata": "root.probe_project", "header": "['module', '___EOS___']", "index": 98 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "exists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "plum", "bu", "m_", "import_", "local_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "plum", "bu", "m_", "._", "cmd_", "import_", "git_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "plum", "bu", "m_", "._", "commands_", "import_", "Command", "Not", "Found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "changes_", "import_", "attributes_", ",_", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TOOLS", "_", "=_", "[_", "'", "git", "'_", ",_", "'", "diff", "'_", ",_", "'", "python", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "RUNN", "ERS_", "=_", "[_", "'", "pytest", "'_", ",_", "'", "nose", "'_", ",_", "'", "tox", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "READ", "ME", "\\u", "EXTENSIONS_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "md", "'_", ",_", "'.", "rst", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "txt", "'_", ",_", "''_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "wiki", "'_", ",_", "'.", "rdo", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "org", "'_", ",_", "'.", "pod", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'.", "cre", "ole", "'_", ",_", "'.", "texti", "le", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "report", "\\u", "and", "\\u", "raise_", "(_", "prob", "e\\u", "name_", ",_", "prob", "e\\u", "result_", ",_", "fail", "ure", "\\u", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Log", "s", " ", "the", " ", "prob", "e", " ", "result", " ", "and", " ", "raise", "s", " ", "on", " ", "fail", "ure", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "'%", "s", "?", " ", "%", "s", "'_", "%_", "(_", "prob", "e\\u", "name_", ",_", "prob", "e\\u", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "prob", "e\\u", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exceptions_", "._", "Probe", "Exception_", "(_", "fail", "ure", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "setup_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "`", "setup", ".", "py", "`\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "report", "\\u", "and", "\\u", "raise_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Has", " ", "a", " ", "setup", ".", "py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exists_", "(_", "'", "setup", ".", "py", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", "r", " ", "project", " ", "need", "s", " ", "a", " ", "setup", ".", "py", "'_", "\\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_", "has", "\\u", "binary_", "(_", "command_", ")_", ":_", "\\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 ", " _", "local_", "._", "which_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Command", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "'%", "s", " ", "doe", "s", " ", "not", " ", "exist", "'_", "%_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "tools_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "any_", "(_", "[_", "has", "\\u", "binary_", "(_", "tool_", ")_", "for_", "tool_", "in_", "TOOLS", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "test\\u", "runner_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "any_", "(_", "[_", "has", "\\u", "binary_", "(_", "runner_", ")_", "for_", "runner_", "in_", "TEST", "\\u", "RUNN", "ERS_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "changelog_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "CHANGE", "LOG", ".", "md", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "report", "\\u", "and", "\\u", "raise_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CHANGE", "LOG", ".", "md", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exists_", "(_", "'", "CHANGE", "LOG", ".", "md", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Creat", "e", " ", "a", " ", "CHANGE", "LOG", ".", "md", " ", "file", "'_", "\\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_", "has", "\\u", "readme_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "READ", "ME", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "report", "\\u", "and", "\\u", "raise_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "READ", "ME", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "any_", "(_", "[_", "exists_", "(_", "'", "READ", "ME", "{", "0", "}'_", "._", "format_", "(_", "ext_", ")_", ")_", "for_", "ext_", "in_", "READ", "ME", "\\u", "EXTENSIONS_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Creat", "e", " ", "a", " ", "(", "valid", ")", " ", "READ", "ME", "'_", "\\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_", "has", "\\u", "metadata_", "(_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "`", "<", "module", "\\u", "name", ">/", "\\u\\u", "init", "\\u\\u", ".", "py", "`", " ", "with", " ", "`\\u", "\\u", "version", "\\u\\u", "`", " ", "and", " ", "`\\u", "\\u", "url", "\\u\\u", "`\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "init", "\\u", "path_", "=_", "'%", "s", "/\\u", "\\u", "init", "\\u\\u", ".", "py", "'_", "%_", "context_", "._", "module", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "metadata_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "exists_", "(_", "init", "\\u", "path_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "attributes_", "._", "has", "\\u", "attribute_", "(_", "context_", "._", "module", "\\u", "name_", ",_", "'\\u", "\\u", "version", "\\u\\u'_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "attributes_", "._", "has", "\\u", "attribute_", "(_", "context_", "._", "module", "\\u", "name_", ",_", "'\\u", "\\u", "url", "\\u\\u'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "report", "\\u", "and", "\\u", "raise_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Has", " ", "module", " ", "metadata", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "metadata_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", "r", " ", "%", "s", "/\\u", "\\u", "init", "\\u\\u", ".", "py", " ", "must", " ", "contain", " ", "\\u\\u", "version", "\\u\\u", " ", "and", " ", "\\u\\u", "url", "\\u\\u", " ", "attribute", "s", "'_", "\\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_", "has", "\\u", "signin", "g", "\\u", "key_", "(_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "signin", "gk", "ey", "'_", "in_", "git_", "(_", "'", "config", "'_", ",_", "'-", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "prob", "e\\u", "project_", "(_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "if", " ", "the", " ", "project", " ", "meet", "s", " ", "`", "change", "s", "`", " ", "require", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Comp", "lain", " ", "and", " ", "exit", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "'", "Check", "ing", " ", "project", " ", "for", " ", "change", "s", " ", "require", "ment", "s", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "tools_", "(_", ")_", "and_", "has", "\\u", "setup_", "(_", ")_", "and_", "has", "\\u", "metadata_", "(_", "context_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "has", "\\u", "test\\u", "runner_", "(_", ")_", "and_", "has", "\\u", "readme_", "(_", ")_", "and_", "has", "\\u", "changelog_", "(_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
pantsbuild/pants/src/python/pants/base/cmd_line_spec_parser.py
[ { "content": "# coding=utf-8\n# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom __future__ import (absolute_import, division, generators, nested_scopes, print_function,\n unicode_literals, with_statement)\n\nimport os\n\nfrom pants.base.specs import DescendantAddresses, SiblingAddresses, SingleAddress\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CmdLineSpecParser(object):\n \"\"\"Parses address selectors as passed from the command line.\n\n See the `specs` package for more information on the types of objects returned.\n This class supports some flexibility in the path portion of the spec to allow for more natural\n command line use cases like tab completion leaving a trailing / for directories and relative\n paths, ie both of these::\n\n ./src/::\n /absolute/path/to/project/src/::\n\n Are valid command line specs even though they are not a valid BUILD file specs. They're both\n normalized to::\n\n src::\n\n The above expression would choose every target under src.\n \"\"\"\n\n class BadSpecError(Exception):\n \"\"\"Indicates an unparseable command line address selector.\"\"\"\n\n\n", "metadata": "root.CmdLineSpecParser", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __init__(self, root_dir):\n self._root_dir = os.path.realpath(root_dir)", "metadata": "root.CmdLineSpecParser.__init__", "header": "['class', 'CmdLineSpecParser', '(', 'object', ')', ':', '___EOS___']", "index": 34 }, { "content": " def _normalize_spec_path(self, path):\n is_abs = not path.startswith('//') and os.path.isabs(path)\n if is_abs:\n path = os.path.realpath(path)\n if os.path.commonprefix([self._root_dir, path]) != self._root_dir:\n raise self.BadSpecError('Absolute address path {0} does not share build root {1}'\n .format(path, self._root_dir))\n else:\n if path.startswith('//'):\n path = path[2:]\n path = os.path.join(self._root_dir, path)\n\n normalized = os.path.relpath(path, self._root_dir)\n if normalized == '.':\n normalized = ''\n return normalized", "metadata": "root.CmdLineSpecParser._normalize_spec_path", "header": "['class', 'CmdLineSpecParser', '(', 'object', ')', ':', '___EOS___']", "index": 37 }, { "content": " def parse_spec(self, spec):\n \"\"\"Parse the given spec into a `specs.Spec` object.\n\n :param spec: a single spec string.\n :return: a single specs.Specs object.\n :raises: CmdLineSpecParser.BadSpecError if the address selector could not be parsed.\n \"\"\"\n\n if spec.endswith('::'):\n spec_path = spec[:-len('::')]\n return DescendantAddresses(self._normalize_spec_path(spec_path))\n elif spec.endswith(':'):\n spec_path = spec[:-len(':')]\n return SiblingAddresses(self._normalize_spec_path(spec_path))\n else:\n spec_parts = spec.rsplit(':', 1)\n return SingleAddress(self._normalize_spec_path(spec_parts[0]),\n spec_parts[1] if len(spec_parts) > 1 else None)", "metadata": "root.CmdLineSpecParser.parse_spec", "header": "['class', 'CmdLineSpecParser', '(', 'object', ')', ':', '___EOS___']", "index": 54 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", "=", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Pant", "s", " ", "project", " ", "contributor", "s", " ", "(", "see", " ", "CONTRIB", "UTO", "RS", ".", "md", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "see", " ", "LICENSE", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "(_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "generators_", ",_", "nest", "ed", "\\u", "scopes_", ",_", "print", "\\u", "function_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unicode", "\\u", "literals_", ",_", "with", "\\u", "statement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pants_", "._", "base_", "._", "specs_", "import_", "Descen", "dant", "Address", "es_", ",_", "Sibling", "Address", "es_", ",_", "Sing", "le", "Address_", "\\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_", "Cmd", "Line", "Spec", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "es", " ", "address", " ", "select", "ors", " ", "as", " ", "pass", "ed", " ", "from", " ", "the", " ", "command", " ", "line", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "See", " ", "the", " ", "`", "spec", "s", "`", " ", "package", " ", "for", " ", "more", " ", "informati", "on", " ", "on", " ", "the", " ", "types", " ", "of", " ", "object", "s", " ", "return", "ed", ".", "\\", "10", ";", " ", " ", "Thi", "s", " ", "class", " ", "support", "s", " ", "some", " ", "flexib", "ilit", "y", " ", "in", " ", "the", " ", "path", " ", "porti", "on", " ", "of", " ", "the", " ", "spec", " ", "to", " ", "allow", " ", "for", " ", "more", " ", "natur", "al", "\\", "10", ";", " ", " ", "command", " ", "line", " ", "use", " ", "case", "s", " ", "like", " ", "tab", " ", "completion", " ", "leaving", " ", "a", " ", "trail", "ing", " ", "/", " ", "for", " ", "director", "ies", " ", "and", " ", "relative", "\\", "10", ";", " ", " ", "path", "s", ",", " ", "ie", " ", "bot", "h", " ", "of", " ", "these", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "./", "src", "/", "::", "\\", "10", ";", " ", " ", " ", " ", "/", "abs", "olute", "/", "path", "/", "to", "/", "project", "/", "src", "/", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "Are", " ", "valid", " ", "command", " ", "line", " ", "spec", "s", " ", "even", " ", "tho", "ugh", " ", "the", "y", " ", "are", " ", "not", " ", "a", " ", "valid", " ", "BUILD", " ", "file", " ", "spec", "s", ".", " ", " ", "The", "y", "'", "re", " ", "bot", "h", "\\", "10", ";", " ", " ", "normali", "zed", " ", "to", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "src", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "above", " ", "express", "ion", " ", "wou", "ld", " ", "choose", " ", "every", " ", "target", " ", "under", " ", "src", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ba", "d", "Spec", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Indicat", "es", " ", "an", " ", "unparse", "able", " ", "command", " ", "line", " ", "address", " ", "select", "or", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Cmd", "Line", "Spec", "Parser_", "(_", "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_", ",_", "root", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "root", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "realpath_", "(_", "root", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd", "Line", "Spec", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "normali", "ze", "\\u", "spec", "\\u", "path_", "(_", "self_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "abs_", "=_", "not_", "path_", "._", "startswith_", "(_", "'//'_", ")_", "and_", "os_", "._", "path_", "._", "isabs_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "abs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "realpath_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "common", "prefix_", "(_", "[_", "self_", "._", "\\u", "root", "\\u", "dir_", ",_", "path_", "]_", ")_", "!=_", "self_", "._", "\\u", "root", "\\u", "dir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "self_", "._", "Ba", "d", "Spec", "Error_", "(_", "'", "Abs", "olute", " ", "address", " ", "path", " ", "{", "0", "}", " ", "doe", "s", " ", "not", " ", "share", " ", "build", " ", "root", " ", "{", "1", "}'_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "path_", ",_", "self_", "._", "\\u", "root", "\\u", "dir_", ")_", ")_", "\\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_", "path_", "._", "startswith_", "(_", "'//'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "path_", "[_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "\\u", "root", "\\u", "dir_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "normalized_", "=_", "os_", "._", "path_", "._", "relpath_", "(_", "path_", ",_", "self_", "._", "\\u", "root", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "normalized_", "==_", "'.'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "normalized_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "normalized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cmd", "Line", "Spec", "Parser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "spec_", "(_", "self_", ",_", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "the", " ", "give", "n", " ", "spec", " ", "int", "o", " ", "a", " ", "`", "spec", "s", ".", "Spec", "`", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "spec", ":", " ", "a", " ", "single", " ", "spec", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "a", " ", "single", " ", "spec", "s", ".", "Spec", "s", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", "Cmd", "Line", "Spec", "Parser", ".", "Ba", "d", "Spec", "Error", " ", "if", " ", "the", " ", "address", " ", "select", "or", " ", "coul", "d", " ", "not", " ", "be", " ", "parsed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "spec_", "._", "endswith_", "(_", "'::'", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec", "\\u", "path_", "=_", "spec_", "[_", ":_", "-_", "len_", "(_", "'::'", "_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Descen", "dant", "Address", "es_", "(_", "self_", "._", "\\u", "normali", "ze", "\\u", "spec", "\\u", "path_", "(_", "spec", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "spec_", "._", "endswith_", "(_", "':'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec", "\\u", "path_", "=_", "spec_", "[_", ":_", "-_", "len_", "(_", "':'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Sibling", "Address", "es_", "(_", "self_", "._", "\\u", "normali", "ze", "\\u", "spec", "\\u", "path_", "(_", "spec", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec", "\\u", "parts_", "=_", "spec_", "._", "rsplit_", "(_", "':'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Sing", "le", "Address_", "(_", "self_", "._", "\\u", "normali", "ze", "\\u", "spec", "\\u", "path_", "(_", "spec", "\\u", "parts_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec", "\\u", "parts_", "[_", "1_", "]_", "if_", "len_", "(_", "spec", "\\u", "parts_", ")_", ">_", "1_", "else_", "None_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
jut-io/jut-python-tools/jut/api/deployments.py
[ { "content": "\"\"\"\ndeployments API\n\n\"\"\"\n\nimport json\nimport requests\n\nfrom jut import defaults\n\nfrom jut.api import accounts, environment\nfrom jut.exceptions import JutException\n\n## deployments\n\n\n\n\n\n\n\n\n\n\n\n# spaces\n\n\n\n\n\n\n\n\n\n\n\n# users\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def create_deployment(deployment_name,\n token_manager=None,\n app_url=defaults.APP_URL):\n \"\"\"\n create a deployment with the specified name\n\n \"\"\"\n headers = token_manager.get_access_token_headers()\n\n payload = {\n 'name': deployment_name,\n 'isAdmin': True\n }\n\n deployment_url = environment.get_deployment_url(app_url=app_url)\n response = requests.post('%s/api/v1/deployments' % deployment_url,\n data=json.dumps(payload),\n headers=headers)\n\n if response.status_code == 201:\n return response.json()\n\n else:\n raise JutException('Error %s: %s' % (response.status_code, response.text))", "metadata": "root.create_deployment", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def get_deployments(token_manager=None,\n app_url=defaults.APP_URL):\n \"\"\"\n return the list of deployments that the current access_token gives you\n access to\n\n \"\"\"\n headers = token_manager.get_access_token_headers()\n deployment_url = environment.get_deployment_url(app_url=app_url)\n response = requests.get('%s/api/v1/deployments' % deployment_url,\n headers=headers)\n\n if response.status_code == 200:\n return response.json()\n else:\n raise JutException('Error %s: %s' % (response.status_code, response.text))", "metadata": "root.get_deployments", "header": "['module', '___EOS___']", "index": 41 }, { "content": "def get_deployment_id(deployment_name,\n token_manager=None,\n app_url=defaults.APP_URL):\n \"\"\"\n return the deployment id for the deployment with the specified name\n\n \"\"\"\n\n headers = token_manager.get_access_token_headers()\n deployment_url = environment.get_deployment_url(app_url=app_url)\n response = requests.get('%s/api/v1/deployments' % deployment_url,\n headers=headers)\n\n if response.status_code == 200:\n deployments = response.json()\n\n for deployment in deployments:\n if deployment['name'] == deployment_name:\n return deployment['deployment_id']\n\n raise JutException('Unable to find deployment with name %s' % deployment_name)\n else:\n raise JutException('Error %s: %s' % (response.status_code, response.text))", "metadata": "root.get_deployment_id", "header": "['module', '___EOS___']", "index": 59 }, { "content": "def get_deployment_details(deployment_name,\n token_manager=None,\n app_url=defaults.APP_URL):\n \"\"\"\n return the deployment details for the deployment with the specific name\n\n \"\"\"\n\n deployment_id = get_deployment_id(deployment_name,\n token_manager=token_manager,\n app_url=app_url)\n\n headers = token_manager.get_access_token_headers()\n deployment_url = environment.get_deployment_url(app_url=app_url)\n response = requests.get('%s/api/v1/deployments/%s' %\n (deployment_url, deployment_id),\n headers=headers)\n\n if response.status_code == 200:\n return response.json()\n else:\n raise JutException('Error %s: %s' % (response.status_code, response.text))", "metadata": "root.get_deployment_details", "header": "['module', '___EOS___']", "index": 84 }, { "content": "def get_apikey(deployment_name,\n token_manager=None,\n app_url=defaults.APP_URL):\n deployment_id = get_deployment_id(deployment_name,\n token_manager=token_manager,\n app_url=app_url)\n\n headers = token_manager.get_access_token_headers()\n deployment_url = environment.get_deployment_url(app_url=app_url)\n response = requests.get('%s/api/v1/deployments/%s/apikey' %\n (deployment_url, deployment_id),\n headers=headers)\n\n if response.status_code == 200:\n return response.json()['apikey']\n else:\n raise JutException('Error %s: %s' % (response.status_code, response.text))", "metadata": "root.get_apikey", "header": "['module', '___EOS___']", "index": 108 }, { "content": "def get_spaces(deployment_name,\n token_manager=None,\n app_url=defaults.APP_URL):\n \"\"\"\n get the list of spaces currently in the deployment specified\n\n \"\"\"\n deployment_id = get_deployment_id(deployment_name,\n token_manager=token_manager,\n app_url=app_url)\n\n headers = token_manager.get_access_token_headers()\n deployment_url = environment.get_deployment_url(app_url=app_url)\n response = requests.get('%s/api/v1/deployments/%s/spaces' %\n (deployment_url, deployment_id),\n headers=headers)\n\n if response.status_code == 200:\n return response.json()\n else:\n raise JutException('Error %s: %s' % (response.status_code, response.text))", "metadata": "root.get_spaces", "header": "['module', '___EOS___']", "index": 129 }, { "content": "def get_space_id(deployment_name,\n space_name,\n token_manager=None,\n app_url=defaults.APP_URL):\n \"\"\"\n get the space id that relates to the space name provided\n\n \"\"\"\n spaces = get_spaces(deployment_name,\n token_manager=token_manager,\n app_url=app_url)\n\n for space in spaces:\n if space['name'] == space_name:\n return space['id']\n\n raise JutException('Unable to find space \"%s\" within deployment \"%s\"' %\n (space_name, deployment_name))", "metadata": "root.get_space_id", "header": "['module', '___EOS___']", "index": 152 }, { "content": "def create_space(deployment_name,\n space_name,\n security_policy='public',\n events_retention_days=0,\n metrics_retention_days=0,\n token_manager=None,\n app_url=defaults.APP_URL):\n \"\"\"\n create a space within the deployment specified and with the various\n rentention values set\n\n \"\"\"\n deployment_id = get_deployment_id(deployment_name,\n token_manager=token_manager,\n app_url=app_url)\n\n payload = {\n 'name': space_name,\n 'security_policy': security_policy,\n 'events_retention_days': events_retention_days,\n 'metrics_retention_days': metrics_retention_days,\n }\n\n headers = token_manager.get_access_token_headers()\n deployment_url = environment.get_deployment_url(app_url=app_url)\n response = requests.post('%s/api/v1/deployments/%s/spaces' %\n (deployment_url, deployment_id),\n data=json.dumps(payload),\n headers=headers)\n\n if response.status_code == 201:\n return response.json()\n else:\n raise JutException('Error %s: %s' % (response.status_code, response.text))", "metadata": "root.create_space", "header": "['module', '___EOS___']", "index": 172 }, { "content": "def delete_space(deployment_name,\n space_name,\n token_manager=None,\n app_url=defaults.APP_URL):\n\n deployment_id = get_deployment_id(deployment_name,\n token_manager=token_manager,\n app_url=app_url)\n\n space_id = get_space_id(deployment_name,\n space_name,\n token_manager=token_manager,\n app_url=app_url)\n\n headers = token_manager.get_access_token_headers()\n deployment_url = environment.get_deployment_url(app_url=app_url)\n response = requests.delete('%s/api/v1/deployments/%s/spaces/%s' %\n (deployment_url, deployment_id, space_id),\n headers=headers)\n\n if response.status_code == 204:\n return response.text\n else:\n raise JutException('Error %s: %s' % (response.status_code, response.text))", "metadata": "root.delete_space", "header": "['module', '___EOS___']", "index": 208 }, { "content": "def space_exists(deployment_name,\n space_name,\n token_manager=None,\n app_url=defaults.APP_URL):\n\n spaces = get_spaces(deployment_name,\n token_manager=token_manager,\n app_url=app_url)\n\n for space in spaces:\n if space['name'] == space_name:\n return True\n\n return False", "metadata": "root.space_exists", "header": "['module', '___EOS___']", "index": 234 }, { "content": "def get_users(deployment_name,\n token_manager=None,\n app_url=defaults.APP_URL):\n \"\"\"\n get all users in the deployment specified\n\n \"\"\"\n deployment_id = get_deployment_id(deployment_name,\n token_manager=token_manager,\n app_url=app_url)\n\n headers = token_manager.get_access_token_headers()\n deployment_url = environment.get_deployment_url(app_url=app_url)\n response = requests.get('%s/api/v1/deployments/%s/accounts' %\n (deployment_url, deployment_id),\n headers=headers)\n\n if response.status_code == 200:\n return response.json()\n else:\n raise JutException('Error %s: %s' % (response.status_code, response.text))", "metadata": "root.get_users", "header": "['module', '___EOS___']", "index": 252 }, { "content": "def add_user(username,\n deployment_name,\n token_manager=None,\n app_url=defaults.APP_URL):\n \"\"\"\n add user to deployment\n\n \"\"\"\n deployment_id = get_deployment_id(deployment_name,\n token_manager=token_manager,\n app_url=app_url)\n\n account_id = accounts.get_account_id(username,\n token_manager=token_manager,\n app_url=app_url)\n\n headers = token_manager.get_access_token_headers()\n deployment_url = environment.get_deployment_url(app_url=app_url)\n response = requests.put('%s/api/v1/deployments/%s/accounts/%s' %\n (deployment_url, deployment_id, account_id),\n headers=headers)\n\n if response.status_code == 204:\n return response.text\n else:\n raise JutException('Error %s: %s' % (response.status_code, response.text))", "metadata": "root.add_user", "header": "['module', '___EOS___']", "index": 275 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "deployments", " ", "API", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ju", "t_", "import_", "defaults_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ju", "t_", "._", "api_", "import_", "accounts_", ",_", "environment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ju", "t_", "._", "exceptions_", "import_", "Ju", "t", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "deployments", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "spaces_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "users_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "create", "\\u", "deployment_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "create", " ", "a", " ", "deploy", "ment", " ", "with", " ", "the", " ", "specified", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "token", "\\u", "manager_", "._", "get", "\\u", "access", "\\u", "token", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "payload_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "Admi", "n", "'_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "deploy", "ment", "\\u", "url_", "=_", "environment_", "._", "get", "\\u", "deploy", "ment", "\\u", "url_", "(_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "post_", "(_", "'%", "s", "/", "api", "/", "v1", "/", "deployments", "'_", "%_", "deploy", "ment", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "json_", "._", "dumps_", "(_", "payload_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "201_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ju", "t", "Exception_", "(_", "'", "Error", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "response_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "deployments", "_", "(_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "the", " ", "list", " ", "of", " ", "deployments", " ", "tha", "t", " ", "the", " ", "current", " ", "access", "\\u", "token", " ", "give", "s", " ", "you", "\\", "10", ";", " ", " ", " ", " ", "access", " ", "to", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "token", "\\u", "manager_", "._", "get", "\\u", "access", "\\u", "token", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "url_", "=_", "environment_", "._", "get", "\\u", "deploy", "ment", "\\u", "url_", "(_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "get_", "(_", "'%", "s", "/", "api", "/", "v1", "/", "deployments", "'_", "%_", "deploy", "ment", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ju", "t", "Exception_", "(_", "'", "Error", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "response_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "deploy", "ment", "\\u", "id_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "the", " ", "deploy", "ment", " ", "id", " ", "for", " ", "the", " ", "deploy", "ment", " ", "with", " ", "the", " ", "specified", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "token", "\\u", "manager_", "._", "get", "\\u", "access", "\\u", "token", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "url_", "=_", "environment_", "._", "get", "\\u", "deploy", "ment", "\\u", "url_", "(_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "get_", "(_", "'%", "s", "/", "api", "/", "v1", "/", "deployments", "'_", "%_", "deploy", "ment", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deployments", "_", "=_", "response_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "deployment_", "in_", "deployments", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "deployment_", "[_", "'", "name", "'_", "]_", "==_", "deploy", "ment", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "deployment_", "[_", "'", "deploy", "ment", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Ju", "t", "Exception_", "(_", "'", "Una", "ble", " ", "to", " ", "find", " ", "deploy", "ment", " ", "with", " ", "name", " ", "%", "s", "'_", "%_", "deploy", "ment", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ju", "t", "Exception_", "(_", "'", "Error", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "response_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "deploy", "ment", "\\u", "details_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "the", " ", "deploy", "ment", " ", "deta", "il", "s", " ", "for", " ", "the", " ", "deploy", "ment", " ", "with", " ", "the", " ", "specific", " ", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "deploy", "ment", "\\u", "id_", "=_", "get", "\\u", "deploy", "ment", "\\u", "id_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "token", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "token", "\\u", "manager_", "._", "get", "\\u", "access", "\\u", "token", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "url_", "=_", "environment_", "._", "get", "\\u", "deploy", "ment", "\\u", "url_", "(_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "get_", "(_", "'%", "s", "/", "api", "/", "v1", "/", "deployments", "/", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "deploy", "ment", "\\u", "url_", ",_", "deploy", "ment", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ju", "t", "Exception_", "(_", "'", "Error", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "response_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "apikey_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "id_", "=_", "get", "\\u", "deploy", "ment", "\\u", "id_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "token", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "token", "\\u", "manager_", "._", "get", "\\u", "access", "\\u", "token", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "url_", "=_", "environment_", "._", "get", "\\u", "deploy", "ment", "\\u", "url_", "(_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "get_", "(_", "'%", "s", "/", "api", "/", "v1", "/", "deployments", "/", "%", "s", "/", "api", "key", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "deploy", "ment", "\\u", "url_", ",_", "deploy", "ment", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "._", "json_", "(_", ")_", "[_", "'", "api", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ju", "t", "Exception_", "(_", "'", "Error", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "response_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "spaces_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "the", " ", "list", " ", "of", " ", "space", "s", " ", "currentl", "y", " ", "in", " ", "the", " ", "deploy", "ment", " ", "specified", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "id_", "=_", "get", "\\u", "deploy", "ment", "\\u", "id_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "token", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "token", "\\u", "manager_", "._", "get", "\\u", "access", "\\u", "token", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "url_", "=_", "environment_", "._", "get", "\\u", "deploy", "ment", "\\u", "url_", "(_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "get_", "(_", "'%", "s", "/", "api", "/", "v1", "/", "deployments", "/", "%", "s", "/", "space", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "deploy", "ment", "\\u", "url_", ",_", "deploy", "ment", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ju", "t", "Exception_", "(_", "'", "Error", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "response_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "space", "\\u", "id_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "space", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "the", " ", "space", " ", "id", " ", "tha", "t", " ", "relate", "s", " ", "to", " ", "the", " ", "space", " ", "name", " ", "provided", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spaces_", "=_", "get", "\\u", "spaces_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "token", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "space_", "in_", "spaces_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "space_", "[_", "'", "name", "'_", "]_", "==_", "space", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "space_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Ju", "t", "Exception_", "(_", "'", "Una", "ble", " ", "to", " ", "find", " ", "space", " ", "\"%", "s", "\"", " ", "within", " ", "deploy", "ment", " ", "\"%", "s", "\"'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "space", "\\u", "name_", ",_", "deploy", "ment", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "space_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "space", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "security", "\\u", "policy_", "=_", "'", "public", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "events", "\\u", "retention", "\\u", "days_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metric", "s", "\\u", "retention", "\\u", "days_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "create", " ", "a", " ", "space", " ", "within", " ", "the", " ", "deploy", "ment", " ", "specified", " ", "and", " ", "with", " ", "the", " ", "vari", "ous", "\\", "10", ";", " ", " ", " ", " ", "rent", "enti", "on", " ", "values", " ", "set", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "id_", "=_", "get", "\\u", "deploy", "ment", "\\u", "id_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "token", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "payload_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "space", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "security", "\\u", "policy", "'_", ":_", "security", "\\u", "policy_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "events", "\\u", "retention", "\\u", "day", "s", "'_", ":_", "events", "\\u", "retention", "\\u", "days_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "metric", "s", "\\u", "retention", "\\u", "day", "s", "'_", ":_", "metric", "s", "\\u", "retention", "\\u", "days_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "token", "\\u", "manager_", "._", "get", "\\u", "access", "\\u", "token", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "url_", "=_", "environment_", "._", "get", "\\u", "deploy", "ment", "\\u", "url_", "(_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "post_", "(_", "'%", "s", "/", "api", "/", "v1", "/", "deployments", "/", "%", "s", "/", "space", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "deploy", "ment", "\\u", "url_", ",_", "deploy", "ment", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "json_", "._", "dumps_", "(_", "payload_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "201_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ju", "t", "Exception_", "(_", "'", "Error", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "response_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "space_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "space", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deploy", "ment", "\\u", "id_", "=_", "get", "\\u", "deploy", "ment", "\\u", "id_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "token", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "space", "\\u", "id_", "=_", "get", "\\u", "space", "\\u", "id_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "space", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "token", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "token", "\\u", "manager_", "._", "get", "\\u", "access", "\\u", "token", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "url_", "=_", "environment_", "._", "get", "\\u", "deploy", "ment", "\\u", "url_", "(_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "delete_", "(_", "'%", "s", "/", "api", "/", "v1", "/", "deployments", "/", "%", "s", "/", "space", "s", "/", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "deploy", "ment", "\\u", "url_", ",_", "deploy", "ment", "\\u", "id_", ",_", "space", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "204_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ju", "t", "Exception_", "(_", "'", "Error", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "response_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "space", "\\u", "exists_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "space", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spaces_", "=_", "get", "\\u", "spaces_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "token", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "space_", "in_", "spaces_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "space_", "[_", "'", "name", "'_", "]_", "==_", "space", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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_", "get", "\\u", "users_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "all", " ", "users", " ", "in", " ", "the", " ", "deploy", "ment", " ", "specified", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "id_", "=_", "get", "\\u", "deploy", "ment", "\\u", "id_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "token", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "token", "\\u", "manager_", "._", "get", "\\u", "access", "\\u", "token", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "url_", "=_", "environment_", "._", "get", "\\u", "deploy", "ment", "\\u", "url_", "(_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "get_", "(_", "'%", "s", "/", "api", "/", "v1", "/", "deployments", "/", "%", "s", "/", "account", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "deploy", "ment", "\\u", "url_", ",_", "deploy", "ment", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ju", "t", "Exception_", "(_", "'", "Error", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "response_", "._", "text_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "user_", "(_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "defaults_", "._", "APP", "\\u", "URL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "add", " ", "user", " ", "to", " ", "deploy", "ment", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "id_", "=_", "get", "\\u", "deploy", "ment", "\\u", "id_", "(_", "deploy", "ment", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "token", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "account", "\\u", "id_", "=_", "accounts_", "._", "get", "\\u", "account", "\\u", "id_", "(_", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "manager_", "=_", "token", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "token", "\\u", "manager_", "._", "get", "\\u", "access", "\\u", "token", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy", "ment", "\\u", "url_", "=_", "environment_", "._", "get", "\\u", "deploy", "ment", "\\u", "url_", "(_", "app", "\\u", "url_", "=_", "app", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "requests_", "._", "put_", "(_", "'%", "s", "/", "api", "/", "v1", "/", "deployments", "/", "%", "s", "/", "account", "s", "/", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "deploy", "ment", "\\u", "url_", ",_", "deploy", "ment", "\\u", "id_", ",_", "account", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "204_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ju", "t", "Exception_", "(_", "'", "Error", " ", "%", "s", ":", " ", "%", "s", "'_", "%_", "(_", "response_", "._", "status", "\\u", "code_", ",_", "response_", "._", "text_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
rwl/muntjac/muntjac/addon/invient/invient_charts_config.py
[ { "content": " def __str__(self):\n return ('MinorGrid [lineColor=' + str(self._lineColor)\n + ', lineDashStyle=' + str(self._lineDashStyle)\n + ', lineWidth=' + str(self._lineWidth)\n + ']')", "metadata": "root.MinorGrid.__str__", "header": "['class', 'MinorGrid', '(', 'object', ')', ':', '___EOS___']", "index": 3512 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Min", "or", "Grid_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "'", "Min", "or", "Grid", " ", "[", "line", "Color", "='_", "+_", "str_", "(_", "self_", "._", "\\u", "line", "Color_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "',", " ", "line", "Dash", "Style", "='_", "+_", "str_", "(_", "self_", "._", "\\u", "line", "Dash", "Style_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "',", " ", "line", "Wid", "th", "='_", "+_", "str_", "(_", "self_", "._", "\\u", "line", "Width_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "']'_", ")_", "\\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 ]
Unused import
BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/functional/api_sample_tests/test_pci.py
[ { "content": "# Copyright 2013 Intel.\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 collections\n\nimport mock\nfrom oslo_serialization import jsonutils\nimport testtools\n\nfrom nova import objects\nfrom nova.objects import fields\nfrom nova.objects import pci_device_pool\nfrom nova.tests.functional.api_sample_tests import api_sample_base\nfrom nova.tests.functional.api_sample_tests import test_servers\n\nskip_msg = \"Bug 1426241\"\n\nfake_db_dev_1 = {\n 'created_at': None,\n 'updated_at': None,\n 'deleted_at': None,\n 'deleted': None,\n 'id': 1,\n 'compute_node_id': 1,\n 'address': '0000:04:10.0',\n 'vendor_id': '8086',\n 'numa_node': 0,\n 'product_id': '1520',\n 'dev_type': fields.PciDeviceType.SRIOV_VF,\n 'status': 'available',\n 'dev_id': 'pci_0000_04_10_0',\n 'label': 'label_8086_1520',\n 'instance_uuid': '69ba1044-0766-4ec0-b60d-09595de034a1',\n 'request_id': None,\n 'extra_info': '{\"key1\": \"value1\", \"key2\": \"value2\"}'\n }\n\nfake_db_dev_2 = {\n 'created_at': None,\n 'updated_at': None,\n 'deleted_at': None,\n 'deleted': None,\n 'id': 2,\n 'compute_node_id': 1,\n 'address': '0000:04:10.1',\n 'vendor_id': '8086',\n 'numa_node': 1,\n 'product_id': '1520',\n 'dev_type': fields.PciDeviceType.SRIOV_VF,\n 'status': 'available',\n 'dev_id': 'pci_0000_04_10_1',\n 'label': 'label_8086_1520',\n 'instance_uuid': 'd5b446a6-a1b4-4d01-b4f0-eac37b3a62fc',\n 'request_id': None,\n 'extra_info': '{\"key3\": \"value3\", \"key4\": \"value4\"}'\n }\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ExtendedServerPciSampleJsonTest(test_servers.ServersSampleBase):\n extension_name = \"os-pci\"\n\n\n", "metadata": "root.ExtendedServerPciSampleJsonTest", "header": "['module', '___EOS___']", "index": 69 }, { "content": " def setUp(self):\n raise testtools.TestCase.skipException(skip_msg)", "metadata": "root.ExtendedServerPciSampleJsonTest.setUp", "header": "['class', 'ExtendedServerPciSampleJsonTest', '(', 'test_servers', '.', 'ServersSampleBase', ')', ':', '___EOS___']", "index": 72 }, { "content": " def test_show(self):\n uuid = self._post_server()\n response = self._do_get('servers/%s' % uuid)\n subs = {'hostid': '[a-f0-9]+'}\n self._verify_response('server-get-resp', subs, response, 200)", "metadata": "root.ExtendedServerPciSampleJsonTest.test_show", "header": "['class', 'ExtendedServerPciSampleJsonTest', '(', 'test_servers', '.', 'ServersSampleBase', ')', ':', '___EOS___']", "index": 75 }, { "content": " def test_detail(self):\n self._post_server()\n response = self._do_get('servers/detail')\n subs = {'hostid': '[a-f0-9]+'}\n self._verify_response('servers-detail-resp', subs, response, 200)", "metadata": "root.ExtendedServerPciSampleJsonTest.test_detail", "header": "['class', 'ExtendedServerPciSampleJsonTest', '(', 'test_servers', '.', 'ServersSampleBase', ')', ':', '___EOS___']", "index": 81 }, { "content": "class ExtendedHyervisorPciSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):\n ADMIN_API = True\n extra_extensions_to_load = ['os-hypervisors']\n extension_name = 'os-pci'\n\n\n", "metadata": "root.ExtendedHyervisorPciSampleJsonTest", "header": "['module', '___EOS___']", "index": 88 }, { "content": " def setUp(self):\n raise testtools.TestCase.skipException(skip_msg)\n super(ExtendedHyervisorPciSampleJsonTest, self).setUp()\n cpu_info = collections.OrderedDict([\n ('arch', 'x86_64'),\n ('model', 'Nehalem'),\n ('vendor', 'Intel'),\n ('features', ['pge', 'clflush']),\n ('topology', {\n 'cores': 1,\n 'threads': 1,\n 'sockets': 4,\n }),\n ])\n self.fake_compute_node = objects.ComputeNode(\n cpu_info=jsonutils.dumps(cpu_info),\n current_workload=0,\n disk_available_least=0,\n host_ip=\"1.1.1.1\",\n state=\"up\",\n status=\"enabled\",\n free_disk_gb=1028,\n free_ram_mb=7680,\n hypervisor_hostname=\"fake-mini\",\n hypervisor_type=\"fake\",\n hypervisor_version=1000,\n id=1,\n local_gb=1028,\n local_gb_used=0,\n memory_mb=8192,\n memory_mb_used=512,\n running_vms=0,\n vcpus=1,\n vcpus_used=0,\n service_id=2,\n host='043b3cacf6f34c90a7245151fc8ebcda',\n pci_device_pools=pci_device_pool.from_pci_stats(\n {\"count\": 5,\n \"vendor_id\": \"8086\",\n \"product_id\": \"1520\",\n \"keya\": \"valuea\",\n \"key1\": \"value1\",\n \"numa_node\": 1}),)\n self.fake_service = objects.Service(\n id=2,\n host='043b3cacf6f34c90a7245151fc8ebcda',\n disabled=False,\n disabled_reason=None)", "metadata": "root.ExtendedHyervisorPciSampleJsonTest.setUp", "header": "['class', 'ExtendedHyervisorPciSampleJsonTest', '(', 'api_sample_base', '.', 'ApiSampleTestBaseV21', ')', ':', '___EOS___']", "index": 93 }, { "content": " @mock.patch(\"nova.servicegroup.API.service_is_up\", return_value=True)\n @mock.patch(\"nova.objects.Service.get_by_compute_host\")\n @mock.patch(\"nova.objects.ComputeNode.get_by_id\")\n def test_pci_show(self, mock_obj, mock_svc_get, mock_service):\n mock_obj.return_value = self.fake_compute_node\n mock_svc_get.return_value = self.fake_service\n hypervisor_id = 1\n response = self._do_get('os-hypervisors/%s' % hypervisor_id)\n subs = {\n 'hypervisor_id': hypervisor_id,\n }\n self._verify_response('hypervisors-pci-show-resp',\n subs, response, 200)", "metadata": "root.ExtendedHyervisorPciSampleJsonTest.test_pci_show", "header": "['class', 'ExtendedHyervisorPciSampleJsonTest', '(', 'api_sample_base', '.', 'ApiSampleTestBaseV21', ')', ':', '___EOS___']", "index": 142 }, { "content": " @mock.patch(\"nova.servicegroup.API.service_is_up\", return_value=True)\n @mock.patch(\"nova.objects.Service.get_by_compute_host\")\n @mock.patch(\"nova.objects.ComputeNodeList.get_all\")\n def test_pci_detail(self, mock_obj, mock_svc_get, mock_service):\n mock_obj.return_value = [self.fake_compute_node]\n mock_svc_get.return_value = self.fake_service\n hypervisor_id = 1\n subs = {\n 'hypervisor_id': hypervisor_id\n }\n response = self._do_get('os-hypervisors/detail')\n\n self._verify_response('hypervisors-pci-detail-resp',\n subs, response, 200)", "metadata": "root.ExtendedHyervisorPciSampleJsonTest.test_pci_detail", "header": "['class', 'ExtendedHyervisorPciSampleJsonTest', '(', 'api_sample_base', '.', 'ApiSampleTestBaseV21', ')', ':', '___EOS___']", "index": 156 }, { "content": "class PciSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):\n ADMIN_API = True\n extension_name = \"os-pci\"\n\n\n\n\n\n", "metadata": "root.PciSampleJsonTest", "header": "['module', '___EOS___']", "index": 172 }, { "content": " def setUp(self):\n raise testtools.TestCase.skipException(skip_msg)", "metadata": "root.PciSampleJsonTest.setUp", "header": "['class', 'PciSampleJsonTest', '(', 'api_sample_base', '.', 'ApiSampleTestBaseV21', ')', ':', '___EOS___']", "index": 176 }, { "content": " def _fake_pci_device_get_by_id(self, context, id):\n return fake_db_dev_1", "metadata": "root.PciSampleJsonTest._fake_pci_device_get_by_id", "header": "['class', 'PciSampleJsonTest', '(', 'api_sample_base', '.', 'ApiSampleTestBaseV21', ')', ':', '___EOS___']", "index": 179 }, { "content": " def _fake_pci_device_get_all_by_node(self, context, id):\n return [fake_db_dev_1, fake_db_dev_2]", "metadata": "root.PciSampleJsonTest._fake_pci_device_get_all_by_node", "header": "['class', 'PciSampleJsonTest', '(', 'api_sample_base', '.', 'ApiSampleTestBaseV21', ')', ':', '___EOS___']", "index": 182 }, { "content": " def test_pci_show(self):\n self.stub_out('nova.db.pci_device_get_by_id',\n self._fake_pci_device_get_by_id)\n response = self._do_get('os-pci/1')\n self._verify_response('pci-show-resp', {}, response, 200)", "metadata": "root.PciSampleJsonTest.test_pci_show", "header": "['class', 'PciSampleJsonTest', '(', 'api_sample_base', '.', 'ApiSampleTestBaseV21', ')', ':', '___EOS___']", "index": 185 }, { "content": " def test_pci_index(self):\n self.stub_out('nova.db.pci_device_get_all_by_node',\n self._fake_pci_device_get_all_by_node)\n response = self._do_get('os-pci')\n self._verify_response('pci-index-resp', {}, response, 200)", "metadata": "root.PciSampleJsonTest.test_pci_index", "header": "['class', 'PciSampleJsonTest', '(', 'api_sample_base', '.', 'ApiSampleTestBaseV21', ')', ':', '___EOS___']", "index": 191 }, { "content": " def test_pci_detail(self):\n self.stub_out('nova.db.pci_device_get_all_by_node',\n self._fake_pci_device_get_all_by_node)\n response = self._do_get('os-pci/detail')\n self._verify_response('pci-detail-resp', {}, response, 200)", "metadata": "root.PciSampleJsonTest.test_pci_detail", "header": "['class', 'PciSampleJsonTest', '(', 'api_sample_base', '.', 'ApiSampleTestBaseV21', ')', ':', '___EOS___']", "index": 197 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "Intel", "._", "\\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_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "serialization_", "import_", "jsonutils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "testtools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nova_", "import_", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "objects_", "import_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "objects_", "import_", "pci", "\\u", "device", "\\u", "pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "tests_", "._", "functional_", "._", "api", "\\u", "sample", "\\u", "tests_", "import_", "api", "\\u", "sample", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "tests_", "._", "functional_", "._", "api", "\\u", "sample", "\\u", "tests_", "import_", "test\\u", "servers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "skip", "\\u", "msg_", "=_", "\"", "Bug", " ", "142", "624", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "db", "\\u", "dev", "\\u", "1_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d\\u", "at", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "d\\u", "at", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "d", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compute", "\\u", "node", "\\u", "id", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", ":_", "'", "0000", ":", "04", ":", "10.", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vendor", "\\u", "id", "'_", ":_", "'", "808", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "numa", "\\u", "node", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "product", "\\u", "id", "'_", ":_", "'", "152", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dev", "\\u", "type", "'_", ":_", "fields_", "._", "Pci", "Dev", "ice", "Type_", "._", "SR", "IO", "V", "\\u", "VF", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "avail", "able", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dev", "\\u", "id", "'_", ":_", "'", "pci", "\\u", "0000", "\\u", "04", "\\u", "10", "\\u", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "'", "label", "\\u", "808", "6", "\\u", "152", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "uuid", "'_", ":_", "'", "6", "9", "ba", "104", "4", "-0", "766", "-", "4e", "c0", "-", "b6", "0d", "-0", "959", "5d", "e0", "3", "4a", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "\\u", "id", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "\\u", "info", "'_", ":_", "'{", "\"", "key", "1", "\":", " ", "\"", "value", "1", "\",", " ", "\"", "key", "2", "\":", " ", "\"", "value", "2", "\"}'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fake", "\\u", "db", "\\u", "dev", "\\u", "2_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "at", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d\\u", "at", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "d\\u", "at", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "d", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compute", "\\u", "node", "\\u", "id", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", ":_", "'", "0000", ":", "04", ":", "10.1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vendor", "\\u", "id", "'_", ":_", "'", "808", "6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "numa", "\\u", "node", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "product", "\\u", "id", "'_", ":_", "'", "152", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dev", "\\u", "type", "'_", ":_", "fields_", "._", "Pci", "Dev", "ice", "Type_", "._", "SR", "IO", "V", "\\u", "VF", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "avail", "able", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dev", "\\u", "id", "'_", ":_", "'", "pci", "\\u", "0000", "\\u", "04", "\\u", "10", "\\u", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "label", "'_", ":_", "'", "label", "\\u", "808", "6", "\\u", "152", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "uuid", "'_", ":_", "'", "d5", "b4", "4", "6a", "6", "-", "a1", "b4", "-", "4d", "01", "-", "b4", "f0", "-", "eac", "3", "7b", "3a", "6", "2f", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "\\u", "id", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "\\u", "info", "'_", ":_", "'{", "\"", "key", "3", "\":", " ", "\"", "value", "3", "\",", " ", "\"", "key", "4", "\":", " ", "\"", "value", "4", "\"}'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Extend", "ed", "Server", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "test\\u", "servers_", "._", "Server", "s", "Sampl", "e", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extensi", "on", "\\u", "name_", "=_", "\"", "os", "-", "pci", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Extend", "ed", "Server", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "test\\u", "servers_", "._", "Server", "s", "Sampl", "e", "Base_", ")_", ":_", "\\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 ", " _", "raise_", "testtools_", "._", "Test", "Case_", "._", "skip", "Exception_", "(_", "skip", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Extend", "ed", "Server", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "test\\u", "servers_", "._", "Server", "s", "Sampl", "e", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "show_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uuid_", "=_", "self_", "._", "\\u", "post", "\\u", "server_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "do", "\\u", "get_", "(_", "'", "server", "s", "/", "%", "s", "'_", "%_", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subs_", "=_", "{_", "'", "hosti", "d", "'_", ":_", "'[", "a", "-", "f0", "-", "9", "]+'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "verify", "\\u", "response_", "(_", "'", "server", "-", "get", "-", "resp", "'_", ",_", "subs_", ",_", "response_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Extend", "ed", "Server", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "test\\u", "servers_", "._", "Server", "s", "Sampl", "e", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "detail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "post", "\\u", "server_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "do", "\\u", "get_", "(_", "'", "server", "s", "/", "deta", "il", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subs_", "=_", "{_", "'", "hosti", "d", "'_", ":_", "'[", "a", "-", "f0", "-", "9", "]+'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "verify", "\\u", "response_", "(_", "'", "server", "s", "-", "deta", "il", "-", "resp", "'_", ",_", "subs_", ",_", "response_", ",_", "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_", "Extend", "ed", "Hy", "ervi", "sor", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ADM", "IN", "\\u", "API_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "extensions\\u", "to", "\\u", "load_", "=_", "[_", "'", "os", "-", "hypervisor", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extensi", "on", "\\u", "name_", "=_", "'", "os", "-", "pci", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Extend", "ed", "Hy", "ervi", "sor", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\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 ", " _", "raise_", "testtools_", "._", "Test", "Case_", "._", "skip", "Exception_", "(_", "skip", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Extend", "ed", "Hy", "ervi", "sor", "Pci", "Sampl", "e", "Js", "on", "Test_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpu", "\\u", "info_", "=_", "collections_", "._", "Order", "ed", "Dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "arch", "'_", ",_", "'", "x8", "6", "\\u", "64", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "model", "'_", ",_", "'", "Ne", "hal", "em", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "vendor", "'_", ",_", "'", "Intel", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "features", "'_", ",_", "[_", "'", "pge", "'_", ",_", "'", "clf", "lus", "h", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "topo", "log", "y", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cores", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "thread", "s", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "socket", "s", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fake", "\\u", "compute", "\\u", "node_", "=_", "objects_", "._", "Compute", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cpu", "\\u", "info_", "=_", "jsonutils_", "._", "dumps_", "(_", "cpu", "\\u", "info_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "workload_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "avail", "able", "\\u", "leas", "t_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "ip_", "=_", "\"", "1.1", ".1", ".1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "=_", "\"", "up", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "\"", "enable", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "free", "\\u", "disk", "\\u", "gb_", "=_", "102", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "free", "\\u", "ram", "\\u", "mb_", "=_", "768", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hypervisor", "\\u", "hostname_", "=_", "\"", "fake", "-", "mini", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hypervisor", "\\u", "type_", "=_", "\"", "fake", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hypervisor", "\\u", "version_", "=_", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "gb_", "=_", "102", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "gb", "\\u", "used_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory", "\\u", "mb_", "=_", "8192_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory", "\\u", "mb", "\\u", "used_", "=_", "512_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "runn", "ing", "\\u", "vms_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vcpu", "s_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vcpu", "s", "\\u", "used_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "id_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "'", "043", "b3", "cac", "f6", "f3", "4c", "90", "a7", "245", "151", "fc", "8e", "bcd", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pci", "\\u", "device", "\\u", "pools_", "=_", "pci", "\\u", "device", "\\u", "pool_", "._", "from", "\\u", "pci", "\\u", "stats_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "count", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vendor", "\\u", "id", "\"_", ":_", "\"", "808", "6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "product", "\\u", "id", "\"_", ":_", "\"", "152", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", "a", "\"_", ":_", "\"", "value", "a", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", "1", "\"_", ":_", "\"", "value", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "numa", "\\u", "node", "\"_", ":_", "1_", "}_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fake", "\\u", "service_", "=_", "objects_", "._", "Service_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "'", "043", "b3", "cac", "f6", "f3", "4c", "90", "a7", "245", "151", "fc", "8e", "bcd", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disabled_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disable", "d\\u", "reason_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Extend", "ed", "Hy", "ervi", "sor", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "nova", ".", "service", "group", ".", "API", ".", "service", "\\u", "is", "\\u", "up", "\"_", ",_", "return", "\\u", "value_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "nova", ".", "object", "s", ".", "Service", ".", "get", "\\u", "by", "\\u", "compute", "\\u", "host", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "nova", ".", "object", "s", ".", "Compute", "Node", ".", "get", "\\u", "by", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "pci", "\\u", "show_", "(_", "self_", ",_", "mock", "\\u", "obj_", ",_", "mock", "\\u", "svc", "\\u", "get_", ",_", "mock", "\\u", "service_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "obj_", "._", "return", "\\u", "value_", "=_", "self_", "._", "fake", "\\u", "compute", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "svc", "\\u", "get_", "._", "return", "\\u", "value_", "=_", "self_", "._", "fake", "\\u", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hypervisor", "\\u", "id_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "do", "\\u", "get_", "(_", "'", "os", "-", "hypervisor", "s", "/", "%", "s", "'_", "%_", "hypervisor", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hypervisor", "\\u", "id", "'_", ":_", "hypervisor", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "verify", "\\u", "response_", "(_", "'", "hypervisor", "s", "-", "pci", "-", "show", "-", "resp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subs_", ",_", "response_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Extend", "ed", "Hy", "ervi", "sor", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "nova", ".", "service", "group", ".", "API", ".", "service", "\\u", "is", "\\u", "up", "\"_", ",_", "return", "\\u", "value_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "nova", ".", "object", "s", ".", "Service", ".", "get", "\\u", "by", "\\u", "compute", "\\u", "host", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "\"", "nova", ".", "object", "s", ".", "Compute", "Node", "List", ".", "get", "\\u", "all", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "pci", "\\u", "detail_", "(_", "self_", ",_", "mock", "\\u", "obj_", ",_", "mock", "\\u", "svc", "\\u", "get_", ",_", "mock", "\\u", "service_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "obj_", "._", "return", "\\u", "value_", "=_", "[_", "self_", "._", "fake", "\\u", "compute", "\\u", "node_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "svc", "\\u", "get_", "._", "return", "\\u", "value_", "=_", "self_", "._", "fake", "\\u", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hypervisor", "\\u", "id_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hypervisor", "\\u", "id", "'_", ":_", "hypervisor", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "do", "\\u", "get_", "(_", "'", "os", "-", "hypervisor", "s", "/", "deta", "il", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "verify", "\\u", "response_", "(_", "'", "hypervisor", "s", "-", "pci", "-", "deta", "il", "-", "resp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subs_", ",_", "response_", ",_", "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_", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ADM", "IN", "\\u", "API_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extensi", "on", "\\u", "name_", "=_", "\"", "os", "-", "pci", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\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 ", " _", "raise_", "testtools_", "._", "Test", "Case_", "._", "skip", "Exception_", "(_", "skip", "\\u", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "fake", "\\u", "pci", "\\u", "device", "\\u", "get", "\\u", "by", "\\u", "id_", "(_", "self_", ",_", "context_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "fake", "\\u", "db", "\\u", "dev", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "fake", "\\u", "pci", "\\u", "device", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "node_", "(_", "self_", ",_", "context_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "fake", "\\u", "db", "\\u", "dev", "\\u", "1_", ",_", "fake", "\\u", "db", "\\u", "dev", "\\u", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pci", "\\u", "show_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stub", "\\u", "out_", "(_", "'", "nova", ".", "db", ".", "pci", "\\u", "device", "\\u", "get", "\\u", "by", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "fake", "\\u", "pci", "\\u", "device", "\\u", "get", "\\u", "by", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "do", "\\u", "get_", "(_", "'", "os", "-", "pci", "/", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "verify", "\\u", "response_", "(_", "'", "pci", "-", "show", "-", "resp", "'_", ",_", "{_", "}_", ",_", "response_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pci", "\\u", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stub", "\\u", "out_", "(_", "'", "nova", ".", "db", ".", "pci", "\\u", "device", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "node", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "fake", "\\u", "pci", "\\u", "device", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "do", "\\u", "get_", "(_", "'", "os", "-", "pci", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "verify", "\\u", "response_", "(_", "'", "pci", "-", "index", "-", "resp", "'_", ",_", "{_", "}_", ",_", "response_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pci", "Sampl", "e", "Js", "on", "Test_", "(_", "api", "\\u", "sample", "\\u", "base_", "._", "Ap", "i", "Sampl", "e", "Test", "Base", "V2", "1_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "pci", "\\u", "detail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stub", "\\u", "out_", "(_", "'", "nova", ".", "db", ".", "pci", "\\u", "device", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "node", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "fake", "\\u", "pci", "\\u", "device", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "\\u", "do", "\\u", "get_", "(_", "'", "os", "-", "pci", "/", "deta", "il", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "verify", "\\u", "response_", "(_", "'", "pci", "-", "deta", "il", "-", "resp", "'_", ",_", "{_", "}_", ",_", "response_", ",_", "200_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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smtpd, asyncore, socket, logging, signal, time, sys\n\nfrom .smtp_channel import SMTPChannel\nfrom asyncore import ExitNow\nfrom .process_pool import ProcessPool\nfrom ssl import SSLError\ntry:\n from Queue import Empty\nexcept ImportError:\n # We're on python3\n from queue import Empty\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_", "secure", "\\u", "smt", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ssl_", ",_", "smt", "pd_", ",_", "async", "ore_", ",_", "socket_", ",_", "logging_", ",_", "signal_", ",_", "time_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "smt", "p", "\\u", "channel_", "import_", "SMT", "PC", "hannel", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "async", "ore_", "import_", "Exi", "t", "Now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "process", "\\u", "pool_", "import_", "Process", "Pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ssl_", "import_", "SS", "LE", "rror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Queue_", "import_", "Empty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "on", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "queue_", "import_", "Empty_", "\\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_" ]
[ 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 ]
Imprecise assert
django/django/tests/model_options/test_tablespaces.py
[ { "content": " @skipIfDBFeature('supports_tablespaces')\n def test_tablespace_ignored_for_indexed_field(self):\n # No tablespace-related SQL\n self.assertEqual(sql_for_table(Article),\n sql_for_table(ArticleRef))", "metadata": "root.TablespacesTests.test_tablespace_ignored_for_indexed_field", "header": "['class', 'TablespacesTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 80 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Table", "space", "s", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "skip", "If", "DB", "Feature_", "(_", "'", "support", "s", "\\u", "tables", "paces", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "tables", "pace\\u", "ignore", "d\\u", "for", "\\u", "indexe", "d\\u", "field_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "tables", "pace", "-", "relate", "d", " ", "SQL_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "sql", "\\u", "for", "\\u", "table_", "(_", "Article_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sql", "\\u", "for", "\\u", "table_", "(_", "Artic", "le", "Ref_", ")_", ")_", "\\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 local variable
cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/contrib/messages/tests/test_fallback.py
[ { "content": " def test_get_fallback_only(self):\n request = self.get_request()\n storage = self.storage_class(request)\n cookie_storage = self.get_cookie_storage(storage)\n session_storage = self.get_session_storage(storage)\n\n # Set initial cookie and session data.\n example_messages = [str(i) for i in range(5)]\n set_cookie_data(cookie_storage, [CookieStorage.not_finished],\n encode_empty=True)\n set_session_data(session_storage, example_messages)\n\n # Test that the message actually contains what we expect.\n self.assertEqual(list(storage), example_messages)", "metadata": "root.FallbackTest.test_get_fallback_only", "header": "['class', 'FallbackTest', '(', 'BaseTests', ',', 'TestCase', ')', ':', '___EOS___']", "index": 83 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Fallback", "Test_", "(_", "Base", "Tests_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "fall", "back", "\\u", "only_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "self_", "._", "get", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "storage_", "=_", "self_", "._", "storage", "\\u", "class_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cookie", "\\u", "storage_", "=_", "self_", "._", "get", "\\u", "cookie", "\\u", "storage_", "(_", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session", "\\u", "storage_", "=_", "self_", "._", "get", "\\u", "session", "\\u", "storage_", "(_", "storage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "initial", " ", "cookie", " ", "and", " ", "session", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "example", "\\u", "messages_", "=_", "[_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "range_", "(_", "5_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "cookie", "\\u", "data_", "(_", "cookie", "\\u", "storage_", ",_", "[_", "Cooki", "e", "Storage_", "._", "not", "\\u", "finished_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encode", "\\u", "empty_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "session", "\\u", "data_", "(_", "session", "\\u", "storage_", ",_", "example", "\\u", "messages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "the", " ", "message", " ", "actual", "ly", " ", "contain", "s", " ", "what", " ", "we", " ", "expect", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "storage_", ")_", ",_", "example", "\\u", "messages_", ")_", "\\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 ]
Unused local variable
niwinz/django-greenqueue/greenqueue/backends/zeromq.py
[ { "content": " def start(self):\n self.manager = shortcuts.load_worker_class().instance()\n if self.manager.greenlet:\n zmq = import_module(\"gevent_zeromq\").zmq\n else:\n zmq = import_module('zmq')\n\n self.manager.start()\n\n ctx = zmq.Context.instance()\n socket = ctx.socket(zmq.PULL)\n socket.bind(settings.GREENQUEUE_BIND_ADDRESS)\n\n log.info(u\"greenqueue: now connected to {address}. (pid {pid})\".format(\n address = settings.GREENQUEUE_BIND_ADDRESS,\n pid = os.getpid()\n ))\n\n while True:\n message = socket.recv_pyobj()\n ok, name = self.validate_message(message)\n if not ok:\n log.error(\"greenqueue: ignoring invalid message\")\n continue\n\n self.manager.handle_message(name, message)", "metadata": "root.ZMQService.start", "header": "['class', 'ZMQService', '(', 'BaseService', ')', ':', '___EOS___']", "index": 19 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "ZM", "QS", "ervice", "_", "(_", "Base", "Service_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "manager_", "=_", "shortcuts_", "._", "load", "\\u", "worker", "\\u", "class_", "(_", ")_", "._", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "manager_", "._", "greenlet", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zmq_", "=_", "import", "\\u", "module_", "(_", "\"", "gev", "ent", "\\u", "zero", "mq", "\"_", ")_", "._", "zmq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zmq_", "=_", "import", "\\u", "module_", "(_", "'", "zmq", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "manager_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "=_", "zmq_", "._", "Context_", "._", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "socket_", "=_", "ctx_", "._", "socket_", "(_", "zmq_", "._", "PUL", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "socket_", "._", "bind_", "(_", "settings_", "._", "GREEN", "QUEUE", "\\u", "BIND", "\\u", "ADDRESS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "u", "\"", "green", "queue", ":", " ", "now", " ", "connect", "ed", " ", "to", " ", "{", "address", "}.", " ", "(", "pid", " ", "{", "pid", "})\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "address_", "=_", "settings_", "._", "GREEN", "QUEUE", "\\u", "BIND", "\\u", "ADDRESS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pid_", "=_", "os_", "._", "getpid_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\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 ", " _", "message_", "=_", "socket_", "._", "recv", "\\u", "pyobj", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok_", ",_", "name_", "=_", "self_", "._", "validat", "e\\u", "message_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "error_", "(_", "\"", "green", "queue", ":", " ", "ign", "orin", "g", " ", "invalid", " ", "message", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "manager_", "._", "handle", "\\u", "message_", "(_", "name_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
fp7-ofelia/ocf/expedient/src/python/plugins/openflow/plugin/gapi/rpc.py
[ { "content": "@require_creds(True)\n@rpcmethod(signature=[SUCCESS_TYPE, URN_TYPE, CREDENTIALS_TYPE, TIME_TYPE],\n url_name=\"openflow_gapi\")\ndef RenewSliver(slice_urn, credentials, expiration_time, **kwargs):\n logger.debug(\"Called RenewSliver\")\n try:\n return gapi.RenewSliver(slice_urn, expiration_time)\n except Slice.DoesNotExist:\n no_such_slice(slice_urn)", "metadata": "root.RenewSliver", "header": "['module', '___EOS___']", "index": 125 } ]
[]
[]
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_", "@_", "require", "\\u", "creds_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "rpc", "method_", "(_", "signature_", "=_", "[_", "SUCCESS", "\\u", "TYPE_", ",_", "URN", "\\u", "TYPE_", ",_", "CREDENTIALS", "\\u", "TYPE_", ",_", "TIME", "\\u", "TYPE_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "\\u", "name_", "=_", "\"", "openf", "low", "\\u", "gap", "i", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Ren", "ew", "Sli", "ver_", "(_", "slice", "\\u", "urn_", ",_", "credentials_", ",_", "expir", "ation", "\\u", "time_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\"", "Call", "ed", " ", "Ren", "ew", "Sli", "ver", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "gap", "i_", "._", "Ren", "ew", "Sli", "ver_", "(_", "slice", "\\u", "urn_", ",_", "expir", "ation", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Slice_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "no", "\\u", "suc", "h", "\\u", "slice_", "(_", "slice", "\\u", "urn_", ")_", "\\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 ]
Unused import
masci/django-appengine-toolkit/tests/test_commands.py
[ { "content": "from django.test import TestCase\nfrom django.core.management import call_command, CommandError\n\nimport os\n\nimport mock\n\nfrom appengine_toolkit.settings import appengine_toolkit_settings\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestCommands(TestCase):", "metadata": "root.TestCommands", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def tearDown(self):\n appengine_config = os.path.join(os.path.dirname(appengine_toolkit_settings.APP_YAML), 'appengine_config.py')\n if os.path.exists(appengine_config):\n os.remove(appengine_config)", "metadata": "root.TestCommands.tearDown", "header": "['class', 'TestCommands', '(', 'TestCase', ')', ':', '___EOS___']", "index": 11 }, { "content": "class TestCollectDeps(TestCommands):\n\n\n\n", "metadata": "root.TestCollectDeps", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def test_call_wrong(self):\n self.assertRaises(CommandError, call_command, 'collectdeps', interactive=False)", "metadata": "root.TestCollectDeps.test_call_wrong", "header": "['class', 'TestCollectDeps', '(', 'TestCommands', ')', ':', '___EOS___']", "index": 18 }, { "content": " def test_call_package(self):\n with mock.patch('appengine_toolkit.management.commands.collectdeps.collect_dependency_paths') as mock_collect:\n mock_collect.return_value = []\n call_command('collectdeps', 'foo', interactive=False)\n self.assertEqual(mock_collect.call_args[0], ('foo',))", "metadata": "root.TestCollectDeps.test_call_package", "header": "['class', 'TestCollectDeps', '(', 'TestCommands', ')', ':', '___EOS___']", "index": 21 }, { "content": " def test_call_req_file(self):\n with mock.patch('__builtin__.open'), \\\n mock.patch('appengine_toolkit.management.commands.collectdeps.parse_requirements_file') as mock_parse, \\\n mock.patch('appengine_toolkit.management.commands.collectdeps.collect_dependency_paths') as mock_collect:\n mock_parse.return_value = ['foo']\n mock_collect.return_value = []\n call_command('collectdeps', requirements_file='foofile', interactive=False)", "metadata": "root.TestCollectDeps.test_call_req_file", "header": "['class', 'TestCollectDeps', '(', 'TestCommands', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_call_req_file_fail(self):\n with mock.patch('__builtin__.open'), \\\n mock.patch('appengine_toolkit.management.commands.collectdeps.parse_requirements_file') as mock_parse:#, \\\n mock_parse.return_value = ['foo']\n self.assertRaises(CommandError, call_command, 'collectdeps', requirements_file='foofile', interactive=False)", "metadata": "root.TestCollectDeps.test_call_req_file_fail", "header": "['class', 'TestCollectDeps', '(', 'TestCommands', ')', ':', '___EOS___']", "index": 35 }, { "content": " def test_call_create_deps_dir(self):\n with mock.patch('appengine_toolkit.management.commands.collectdeps.os.path.exists') as mock_exists,\\\n mock.patch('appengine_toolkit.management.commands.collectdeps.os.mkdir') as mock_mkdir,\\\n mock.patch('appengine_toolkit.management.commands.collectdeps.collect_dependency_paths'):\n mock_exists.return_value = False\n call_command('collectdeps', 'foo', interactive=False)\n self.assertTrue('/libs' in mock_mkdir.call_args[0][0])", "metadata": "root.TestCollectDeps.test_call_create_deps_dir", "header": "['class', 'TestCollectDeps', '(', 'TestCommands', ')', ':', '___EOS___']", "index": 41 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "import_", "call", "\\u", "command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "appengine", "\\u", "toolkit_", "._", "settings_", "import_", "appengine", "\\u", "tool", "kit", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Commands_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Commands_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "appengine", "\\u", "config_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "appengine", "\\u", "tool", "kit", "\\u", "settings_", "._", "APP", "\\u", "YAM", "L_", ")_", ",_", "'", "appengine", "\\u", "config", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "appengine", "\\u", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "appengine", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Collect", "Deps", "_", "(_", "Test", "Commands_", ")_", ":_", "\\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_", "Test", "Collect", "Deps", "_", "(_", "Test", "Commands_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "call", "\\u", "wrong", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Command", "Error_", ",_", "call", "\\u", "command_", ",_", "'", "collectd", "eps", "'_", ",_", "interactive_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Collect", "Deps", "_", "(_", "Test", "Commands_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "call", "\\u", "package_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "mock_", "._", "patch_", "(_", "'", "appengine", "\\u", "tool", "kit", ".", "manage", "ment", ".", "command", "s", ".", "collectd", "eps", ".", "collect", "\\u", "dependen", "cy", "\\u", "path", "s", "'_", ")_", "as_", "mock", "\\u", "collect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "collect_", "._", "return", "\\u", "value_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "command_", "(_", "'", "collectd", "eps", "'_", ",_", "'", "foo", "'_", ",_", "interactive_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "mock", "\\u", "collect_", "._", "call", "\\u", "args_", "[_", "0_", "]_", ",_", "(_", "'", "foo", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Collect", "Deps", "_", "(_", "Test", "Commands_", ")_", ":_", "\\u\\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", "call", "\\u", "req", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "mock_", "._", "patch_", "(_", "'\\u", "\\u", "bui", "lti", "n", "\\u\\u", ".", "open", "'_", ")_", ",_", "mock_", "._", "patch_", "(_", "'", "appengine", "\\u", "tool", "kit", ".", "manage", "ment", ".", "command", "s", ".", "collectd", "eps", ".", "parse", "\\u", "require", "ment", "s", "\\u", "file", "'_", ")_", "as_", "mock", "\\u", "parse_", ",_", "mock_", "._", "patch_", "(_", "'", "appengine", "\\u", "tool", "kit", ".", "manage", "ment", ".", "command", "s", ".", "collectd", "eps", ".", "collect", "\\u", "dependen", "cy", "\\u", "path", "s", "'_", ")_", "as_", "mock", "\\u", "collect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "parse_", "._", "return", "\\u", "value_", "=_", "[_", "'", "foo", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "collect_", "._", "return", "\\u", "value_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "command_", "(_", "'", "collectd", "eps", "'_", ",_", "require", "ment", "s", "\\u", "file_", "=_", "'", "foo", "file", "'_", ",_", "interactive_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Collect", "Deps", "_", "(_", "Test", "Commands_", ")_", ":_", "\\u\\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", "call", "\\u", "req", "\\u", "file", "\\u", "fail_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "mock_", "._", "patch_", "(_", "'\\u", "\\u", "bui", "lti", "n", "\\u\\u", ".", "open", "'_", ")_", ",_", "mock_", "._", "patch_", "(_", "'", "appengine", "\\u", "tool", "kit", ".", "manage", "ment", ".", "command", "s", ".", "collectd", "eps", ".", "parse", "\\u", "require", "ment", "s", "\\u", "file", "'_", ")_", "as_", "mock", "\\u", "parse_", ":_", "#", ",", " ", "\\\\_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "parse_", "._", "return", "\\u", "value_", "=_", "[_", "'", "foo", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Command", "Error_", ",_", "call", "\\u", "command_", ",_", "'", "collectd", "eps", "'_", ",_", "require", "ment", "s", "\\u", "file_", "=_", "'", "foo", "file", "'_", ",_", "interactive_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Collect", "Deps", "_", "(_", "Test", "Commands_", ")_", ":_", "\\u\\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", "call", "\\u", "create", "\\u", "dep", "s", "\\u", "dir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "mock_", "._", "patch_", "(_", "'", "appengine", "\\u", "tool", "kit", ".", "manage", "ment", ".", "command", "s", ".", "collectd", "eps", ".", "os", ".", "path", ".", "exist", "s", "'_", ")_", "as_", "mock", "\\u", "exists_", ",_", "mock_", "._", "patch_", "(_", "'", "appengine", "\\u", "tool", "kit", ".", "manage", "ment", ".", "command", "s", ".", "collectd", "eps", ".", "os", ".", "mkd", "ir", "'_", ")_", "as_", "mock", "\\u", "mkdir_", ",_", "mock_", "._", "patch_", "(_", "'", "appengine", "\\u", "tool", "kit", ".", "manage", "ment", ".", "command", "s", ".", "collectd", "eps", ".", "collect", "\\u", "dependen", "cy", "\\u", "path", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "exists_", "._", "return", "\\u", "value_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "command_", "(_", "'", "collectd", "eps", "'_", ",_", "'", "foo", "'_", ",_", "interactive_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'/", "libs",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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 ]
Unused local variable
facebook/augmented-traffic-control/atc/atcd/atcd/AtcdVService.py
[ { "content": " def _syslog_address(self):\n address = None\n if sys.platform == 'linux2':\n address = '/dev/log'\n elif sys.platform == 'darwin':\n address = '/var/run/syslog'\n\n if address is None or not os.path.exists(address):\n address = ('localhost', 514)\n return address", "metadata": "root.AtcdVService._syslog_address", "header": "['class', 'AtcdVService', '(', 'VService', ')', ':', '___EOS___']", "index": 26 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "At", "cd", "VS", "ervice", "_", "(_", "VS", "ervice", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "syslo", "g", "\\u", "address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "'", "linux", "2", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address_", "=_", "'/", "dev", "/", "log", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "platform_", "==_", "'", "dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address_", "=_", "'/", "var", "/", "run", "/", "syslo", "g", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "address_", "is_", "None_", "or_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address_", "=_", "(_", "'", "local", "host", "'_", ",_", "514", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "address_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
treeio/treeio/treeio/core/api/auth/utils.py
[ { "content": "def verify_oauth_request(request, oauth_request, consumer, token=None):\n \"\"\" Helper function to verify requests. \"\"\"\n from treeio.core.api.auth.store import store\n\n # Check nonce\n if not store.check_nonce(request, oauth_request, oauth_request['oauth_nonce']):\n return False\n\n # Verify request\n try:\n oauth_server = oauth.Server()\n oauth_server.add_signature_method(oauth.SignatureMethod_HMAC_SHA1())\n oauth_server.add_signature_method(oauth.SignatureMethod_PLAINTEXT())\n\n # Ensure the passed keys and secrets are ascii, or HMAC will complain.\n consumer = oauth.Consumer(consumer.key.encode(\n 'ascii', 'ignore'), consumer.secret.encode('ascii', 'ignore'))\n if token is not None:\n token = oauth.Token(\n token.key.encode('ascii', 'ignore'), token.secret.encode('ascii', 'ignore'))\n\n oauth_server.verify_request(oauth_request, consumer, token)\n except oauth.Error:\n return False\n\n return True", "metadata": "root.verify_oauth_request", "header": "['module', '___EOS___']", "index": 18 } ]
[]
[]
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_", "verify", "\\u", "oauth", "\\u", "request_", "(_", "request_", ",_", "oauth", "\\u", "request_", ",_", "consumer_", ",_", "token_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Help", "er", " ", "function", " ", "to", " ", "verify", " ", "request", "s", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "treei", "o_", "._", "core_", "._", "api_", "._", "auth_", "._", "store_", "import_", "store_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "nonce_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "store_", "._", "check", "\\u", "nonce_", "(_", "request_", ",_", "oauth", "\\u", "request_", ",_", "oauth", "\\u", "request_", "[_", "'", "oauth", "\\u", "nonc", "e", "'_", "]_", ")_", ":_", "\\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_", "#", " ", "Verify", " ", "request_", "\\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 ", " _", "oauth", "\\u", "server_", "=_", "oauth_", "._", "Server_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oauth", "\\u", "server_", "._", "add", "\\u", "signa", "ture", "\\u", "method_", "(_", "oauth_", "._", "Sign", "ature", "Meth", "od", "\\u", "HMAC", "\\u", "SHA", "1_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "oauth", "\\u", "server_", "._", "add", "\\u", "signa", "ture", "\\u", "method_", "(_", "oauth_", "._", "Sign", "ature", "Meth", "od", "\\u", "PLAIN", "TEXT_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "the", " ", "pass", "ed", " ", "keys", " ", "and", " ", "secret", "s", " ", "are", " ", "ascii", ",", " ", "or", " ", "HMAC", " ", "will", " ", "compl", "ain", "._", "\\u\\u\\uNL\\u\\u\\u_", "consumer_", "=_", "oauth_", "._", "Consumer_", "(_", "consumer_", "._", "key_", "._", "encode_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", ",_", "consumer_", "._", "secret_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "token_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token_", "=_", "oauth_", "._", "Token_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "token_", "._", "key_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", ",_", "token_", "._", "secret_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oauth", "\\u", "server_", "._", "verify", "\\u", "request_", "(_", "oauth", "\\u", "request_", ",_", "consumer_", ",_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "oauth_", "._", "Error_", ":_", "\\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_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
shellderp/sublime-robot-plugin/lib/robot/running/model.py
[ { "content": "# Copyright 2008-2012 Nokia Siemens Networks Oyj\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 robot import utils\nfrom robot.common import BaseTestSuite, BaseTestCase\nfrom robot.parsing import TestData\nfrom robot.errors import ExecutionFailed, DataError\nfrom robot.variables import GLOBAL_VARIABLES\nfrom robot.output import LOGGER\n\nfrom .fixture import (Setup, Teardown, SuiteSetupListener, SuiteTearDownListener,\n TestSetupListener, TestTeardownListener)\nfrom .keywords import Keywords\nfrom .namespace import Namespace\nfrom .runerrors import SuiteRunErrors, TestRunErrors\nfrom .userkeyword import UserLibrary\nfrom .context import EXECUTION_CONTEXTS\nfrom .defaultvalues import DefaultValues\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def TestSuite(datasources, settings):\n \"\"\"Creates a runnable test suite from given data sources and settings.\n\n This is a factory method that returns either :class:`RunnableTestSuite`\n or :class:`RunnableMultiTestSuite` depending are one or more data sources\n given. This method, and especially the returned suite, is likely to change\n heavily in version 2.8.\n\n :param datasources: List of paths to read data from. Starting from 2.7.2,\n a single datasource can also be given as a string.\n :param settings: Execution configuration.\n :type settings: :class:`~robot.conf.settings.RobotSettings`\n :returns: :class:`RunnableTestSuite`\n \"\"\"\n if isinstance(datasources, basestring):\n datasources = [datasources]\n datasources = [utils.abspath(path) for path in datasources]\n suite = _get_suite(datasources, settings['SuiteNames'], settings['WarnOnSkipped'])\n suite.set_options(settings)\n _check_suite_contains_tests(suite, settings['RunEmptySuite'])\n return suite", "metadata": "root.TestSuite", "header": "['module', '___EOS___']", "index": 31 }, { "content": "def _get_suite(datasources, include_suites, warn_on_skipped):\n if not datasources:\n raise DataError(\"No data sources given.\")\n if len(datasources) > 1:\n return _get_multisource_suite(datasources, include_suites, warn_on_skipped)\n return RunnableTestSuite(_parse_suite(datasources[0], include_suites, warn_on_skipped))", "metadata": "root._get_suite", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def _parse_suite(path, include_suites, warn_on_skipped):\n try:\n return TestData(source=path, include_suites=include_suites, warn_on_skipped=warn_on_skipped)\n except DataError, err:\n raise DataError(\"Parsing '%s' failed: %s\" % (path, unicode(err)))", "metadata": "root._parse_suite", "header": "['module', '___EOS___']", "index": 60 }, { "content": "def _get_multisource_suite(datasources, include_suites, warn_on_skipped):\n suitedatas = []\n for datasource in datasources:\n try:\n suitedatas.append(_parse_suite(datasource, include_suites, warn_on_skipped))\n except DataError, err:\n LOGGER.warn(err)\n suite = RunnableMultiTestSuite(suitedatas)\n if suite.get_test_count() == 0:\n raise DataError(\"Data sources %s contain no test cases.\"\n % utils.seq2str(datasources))\n return suite", "metadata": "root._get_multisource_suite", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def _check_suite_contains_tests(suite, run_empty_suites=False):\n suite.filter_empty_suites()\n if not suite.get_test_count() and not run_empty_suites:\n raise DataError(\"Test suite '%s' contains no test cases.\" % (suite.source))", "metadata": "root._check_suite_contains_tests", "header": "['module', '___EOS___']", "index": 79 }, { "content": "class RunnableTestSuite(BaseTestSuite):\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.RunnableTestSuite", "header": "['module', '___EOS___']", "index": 85 }, { "content": " def __init__(self, data, parent=None, defaults=None):\n BaseTestSuite.__init__(self, data.name, data.source, parent)\n self.variables = GLOBAL_VARIABLES.copy()\n self.variables.set_from_variable_table(data.variable_table)\n self.source = data.source\n self.doc = data.setting_table.doc.value\n self.metadata = self._get_metadata(data.setting_table.metadata)\n self.imports = data.imports\n self.user_keywords = UserLibrary(data.keywords)\n self.setup = Setup(data.setting_table.suite_setup.name,\n data.setting_table.suite_setup.args)\n self.teardown = Teardown(data.setting_table.suite_teardown.name,\n data.setting_table.suite_teardown.args)\n defaults = DefaultValues(data.setting_table, defaults)\n for suite in data.children:\n RunnableTestSuite(suite, parent=self, defaults=defaults)\n for test in data.testcase_table:\n RunnableTestCase(test, parent=self, defaults=defaults)\n self._run_mode_exit_on_failure = False\n self._run_mode_dry_run = False\n self._run_mode_skip_teardowns_on_exit = False", "metadata": "root.RunnableTestSuite.__init__", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 87 }, { "content": " def filter_empty_suites(self):\n for suite in self.suites[:]:\n suite.filter_empty_suites()\n if suite.get_test_count() == 0:\n self.suites.remove(suite)\n LOGGER.info(\"Running test suite '%s' failed: Test suite\"\n \" contains no test cases.\" % (suite.source))", "metadata": "root.RunnableTestSuite.filter_empty_suites", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 109 }, { "content": " def _get_metadata(self, metadata):\n meta = utils.NormalizedDict()\n for item in metadata:\n meta[item.name] = item.value\n return meta", "metadata": "root.RunnableTestSuite._get_metadata", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 117 }, { "content": " def run(self, output, parent=None, errors=None):\n context = self._start_run(output, parent, errors)\n self._run_setup(context)\n self._run_sub_suites(context)\n self._run_tests(context)\n self._report_status(context)\n self._run_teardown(context)\n self._end_run(context)", "metadata": "root.RunnableTestSuite.run", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 123 }, { "content": " def _start_run(self, output, parent, errors):\n if not errors:\n errors = SuiteRunErrors(self._run_mode_exit_on_failure, self._run_mode_skip_teardowns_on_exit)\n self.run_errors = errors\n self.run_errors.start_suite()\n self.status = 'RUNNING'\n self.starttime = utils.get_timestamp()\n parent_vars = parent.context.get_current_vars() if parent else None\n ns = Namespace(self, parent_vars)\n self.context = EXECUTION_CONTEXTS.start_suite(ns, output, self._run_mode_dry_run)\n if not errors.exit:\n ns.handle_imports()\n self._set_variable_dependent_metadata(self.context)\n output.start_suite(self)\n return self.context", "metadata": "root.RunnableTestSuite._start_run", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 132 }, { "content": " def _set_variable_dependent_metadata(self, context):\n errors = []\n self.doc = context.replace_vars_from_setting('Documentation', self.doc,\n errors)\n self.setup.replace_variables(context.get_current_vars(), errors)\n self.teardown.replace_variables(context.get_current_vars(), errors)\n for name, value in self.metadata.items():\n self.metadata[name] = context.replace_vars_from_setting(name, value,\n errors)\n if errors:\n self.run_errors.suite_init_err('Suite initialization failed:\\n%s'\n % '\\n'.join(errors))", "metadata": "root.RunnableTestSuite._set_variable_dependent_metadata", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 148 }, { "content": " def _run_setup(self, context):\n if self.run_errors.is_suite_setup_allowed():\n self.setup.run(context, SuiteSetupListener(self))\n self.run_errors.setup_executed()", "metadata": "root.RunnableTestSuite._run_setup", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 161 }, { "content": " def _run_teardown(self, context):\n if self.run_errors.is_suite_teardown_allowed():\n self.teardown.run(context, SuiteTearDownListener(self))", "metadata": "root.RunnableTestSuite._run_teardown", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 166 }, { "content": " def _run_sub_suites(self, context):\n for suite in self.suites:\n suite.run(context.output, self, self.run_errors)", "metadata": "root.RunnableTestSuite._run_sub_suites", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 170 }, { "content": " def _run_tests(self, context):\n executed_tests = []\n for test in self.tests:\n normname = utils.normalize(test.name)\n if normname in executed_tests:\n LOGGER.warn(\"Multiple test cases with name '%s' executed in \"\n \"test suite '%s'\"% (test.name, self.longname))\n executed_tests.append(normname)\n test.run(context, self.run_errors)\n context.set_prev_test_variables(test)", "metadata": "root.RunnableTestSuite._run_tests", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 174 }, { "content": " def _report_status(self, context):\n self.set_status()\n self.message = self.run_errors.suite_error()\n context.report_suite_status(self.status, self.get_full_message())", "metadata": "root.RunnableTestSuite._report_status", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 185 }, { "content": " def _end_run(self, context):\n self.endtime = utils.get_timestamp()\n self.elapsedtime = utils.get_elapsed_time(self.starttime, self.endtime)\n context.copy_prev_test_vars_to_global()\n context.end_suite(self)\n self.run_errors.end_suite()", "metadata": "root.RunnableTestSuite._end_run", "header": "['class', 'RunnableTestSuite', '(', 'BaseTestSuite', ')', ':', '___EOS___']", "index": 190 }, { "content": "class RunnableMultiTestSuite(RunnableTestSuite):\n", "metadata": "root.RunnableMultiTestSuite", "header": "['module', '___EOS___']", "index": 198 }, { "content": " def __init__(self, suitedatas):\n BaseTestSuite.__init__(self, name='')\n self.variables = GLOBAL_VARIABLES.copy()\n self.doc = ''\n self.imports = []\n self.setup = Setup(None, None)\n self.teardown = Teardown(None, None)\n for suite in suitedatas:\n RunnableTestSuite(suite, parent=self)\n self._run_mode_exit_on_failure = False\n self._run_mode_dry_run = False\n self._run_mode_skip_teardowns_on_exit = False", "metadata": "root.RunnableMultiTestSuite.__init__", "header": "['class', 'RunnableMultiTestSuite', '(', 'RunnableTestSuite', ')', ':', '___EOS___']", "index": 200 }, { "content": "class RunnableTestCase(BaseTestCase):\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.RunnableTestCase", "header": "['module', '___EOS___']", "index": 214 }, { "content": " def __init__(self, tc_data, parent, defaults):\n BaseTestCase.__init__(self, tc_data.name, parent)\n self.doc = tc_data.doc.value\n self.setup = defaults.get_setup(tc_data.setup)\n self.teardown = defaults.get_teardown(tc_data.teardown)\n self.tags = defaults.get_tags(tc_data.tags)\n self.timeout = defaults.get_timeout(tc_data.timeout)\n self.template = defaults.get_template(tc_data.template)\n self.keywords = Keywords(tc_data.steps, self.template)", "metadata": "root.RunnableTestCase.__init__", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 216 }, { "content": " def run(self, context, suite_errors):\n self._suite_errors = suite_errors\n self._start_run(context)\n if self.run_errors.is_allowed_to_run():\n self._run(context)\n else:\n self._not_allowed_to_run()\n self._end_run(context)", "metadata": "root.RunnableTestCase.run", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 226 }, { "content": " def _start_run(self, context):\n self.run_errors = TestRunErrors(self._suite_errors)\n self.status = 'RUNNING'\n self.starttime = utils.get_timestamp()\n self.run_errors.init_err(self._init_test(context))\n context.start_test(self)", "metadata": "root.RunnableTestCase._start_run", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 235 }, { "content": " def _init_test(self, context):\n errors = []\n self.doc = context.replace_vars_from_setting('Documentation', self.doc,\n errors)\n self.setup.replace_variables(context.get_current_vars(), errors)\n self.teardown.replace_variables(context.get_current_vars(), errors)\n tags = context.replace_vars_from_setting('Tags', self.tags, errors)\n self.tags = utils.normalize_tags(tags)\n self.timeout.replace_variables(context.get_current_vars())\n if errors:\n return 'Test case initialization failed:\\n%s' % '\\n'.join(errors)\n if not self.name:\n return 'Test case name is required.'\n if not self.keywords:\n return 'Test case contains no keywords'\n return None", "metadata": "root.RunnableTestCase._init_test", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 242 }, { "content": " def _run(self, context):\n self.timeout.start()\n self._run_setup(context)\n if not self.run_errors.setup_failed():\n try:\n self.keywords.run(context)\n except ExecutionFailed, err:\n self.run_errors.kw_err(unicode(err))\n self.keyword_failed(err)\n context.set_test_status_before_teardown(*self._report_status())\n self._run_teardown(context)\n self._report_status_after_teardown()", "metadata": "root.RunnableTestCase._run", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 259 }, { "content": " def keyword_failed(self, err):\n self.timeout.set_keyword_timeout(err.timeout)\n self._suite_errors.test_failed(exit=err.exit, critical=self.critical)", "metadata": "root.RunnableTestCase.keyword_failed", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 272 }, { "content": " def _run_setup(self, context):\n self.setup.run(context, TestSetupListener(self))", "metadata": "root.RunnableTestCase._run_setup", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 276 }, { "content": " def _report_status(self):\n message = self.run_errors.get_message()\n if message:\n self.status = 'FAIL'\n self.message = message\n else:\n self.status = 'PASS'\n return self.message, self.status", "metadata": "root.RunnableTestCase._report_status", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 279 }, { "content": " def _run_teardown(self, context):\n if self._suite_errors.is_test_teardown_allowed():\n self.teardown.run(context, TestTeardownListener(self))", "metadata": "root.RunnableTestCase._run_teardown", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 288 }, { "content": " def _report_status_after_teardown(self):\n if self.run_errors.teardown_failed():\n self.status = 'FAIL'\n self.message = self.run_errors.get_teardown_message(self.message)\n if self.status == 'PASS' and self.timeout.timed_out():\n self.status = 'FAIL'\n self.message = self.timeout.get_message()\n if self.status == 'FAIL':\n self._suite_errors.test_failed(critical=self.critical)", "metadata": "root.RunnableTestCase._report_status_after_teardown", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 292 }, { "content": " def _not_allowed_to_run(self):\n self.status = 'FAIL'\n self.message = self.run_errors.parent_or_init_error()", "metadata": "root.RunnableTestCase._not_allowed_to_run", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 302 }, { "content": " def _end_run(self, context):\n self.endtime = utils.get_timestamp()\n self.elapsedtime = utils.get_elapsed_time(self.starttime, self.endtime)\n context.end_test(self)", "metadata": "root.RunnableTestCase._end_run", "header": "['class', 'RunnableTestCase', '(', 'BaseTestCase', ')', ':', '___EOS___']", "index": 306 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "2008", "-", "2012", " ", "No", "kia", " ", "Sie", "mens", " ", "Network", "s", " ", "O", "yj", "_", "\\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_", "robot_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robot_", "._", "common_", "import_", "Base", "Test", "Suite_", ",_", "Base", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robot_", "._", "parsing_", "import_", "Test", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robot_", "._", "errors_", "import_", "Execut", "ion", "Failed_", ",_", "Data", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robot_", "._", "variables_", "import_", "GLOB", "AL", "\\u", "VARIABLES", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robot_", "._", "output_", "import_", "LOGGER_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "fixture_", "import_", "(_", "Setup_", ",_", "Tea", "rdo", "wn_", ",_", "Suit", "e", "Set", "up", "Listener_", ",_", "Suit", "e", "Tea", "r", "Down", "Listener_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Test", "Set", "up", "Listener_", ",_", "Test", "Tea", "rdo", "wn", "Listener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "keywords_", "import_", "Keywords_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "namespace_", "import_", "Namespace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "rune", "rror", "s_", "import_", "Suit", "e", "Run", "Errors_", ",_", "Test", "Run", "Errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "user", "keyword_", "import_", "User", "Library_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "context_", "import_", "EXECUT", "ION", "\\u", "CONTE", "XT", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "default", "values_", "import_", "Default", "Values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Test", "Suite_", "(_", "datasources", "_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "runnable", " ", "test", " ", "suit", "e", " ", "from", " ", "give", "n", " ", "data", " ", "source", "s", " ", "and", " ", "settings", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "factor", "y", " ", "method", " ", "tha", "t", " ", "return", "s", " ", "eit", "her", " ", ":", "class", ":`", "Run", "nable", "Test", "Suit", "e", "`", "\\", "10", ";", " ", " ", " ", " ", "or", " ", ":", "class", ":`", "Run", "nable", "Multi", "Test", "Suit", "e", "`", " ", "depend", "ing", " ", "are", " ", "one", " ", "or", " ", "more", " ", "data", " ", "source", "s", "\\", "10", ";", " ", " ", " ", " ", "give", "n", ".", " ", "Thi", "s", " ", "method", ",", " ", "and", " ", "especial", "ly", " ", "the", " ", "return", "ed", " ", "suit", "e", ",", " ", "is", " ", "like", "ly", " ", "to", " ", "change", "\\", "10", ";", " ", " ", " ", " ", "heav", "il", "y", " ", "in", " ", "version", " ", "2.8", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "datasources", ":", " ", "List", " ", "of", " ", "path", "s", " ", "to", " ", "read", " ", "data", " ", "from", ".", " ", "Start", "ing", " ", "from", " ", "2.7", ".2", ",", "\\", "10", ";", " ", " ", "a", " ", "single", " ", "datas", "ource", " ", "can", " ", "als", "o", " ", "be", " ", "give", "n", " ", "as", " ", "a", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "settings", ":", " ", "Execut", "ion", " ", "configura", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "settings", ":", " ", ":", "class", ":`", "~", "robot", ".", "conf", ".", "settings", ".", "Robot", "Sett", "ings", "`", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", ":", "class", ":`", "Run", "nable", "Test", "Suit", "e", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "datasources", "_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datasources", "_", "=_", "[_", "datasources", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "datasources", "_", "=_", "[_", "utils_", "._", "abspath_", "(_", "path_", ")_", "for_", "path_", "in_", "datasources", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "=_", "\\u", "get", "\\u", "suite_", "(_", "datasources", "_", ",_", "settings_", "[_", "'", "Suit", "e", "Names", "'_", "]_", ",_", "settings_", "[_", "'", "Warn", "On", "Skipped", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "._", "set\\u", "options_", "(_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "check", "\\u", "suit", "e\\u", "contain", "s", "\\u", "tests_", "(_", "suite_", ",_", "settings_", "[_", "'", "Run", "Emp", "ty", "Suit", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "\\u", "get", "\\u", "suite_", "(_", "datasources", "_", ",_", "include", "\\u", "suites_", ",_", "warn", "\\u", "on", "\\u", "skipped_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "datasources", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Data", "Error_", "(_", "\"", "No", " ", "data", " ", "source", "s", " ", "give", "n", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "datasources", "_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "get", "\\u", "multis", "ource", "\\u", "suite_", "(_", "datasources", "_", ",_", "include", "\\u", "suites_", ",_", "warn", "\\u", "on", "\\u", "skipped_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Run", "nable", "Test", "Suite_", "(_", "\\u", "parse", "\\u", "suite_", "(_", "datasources", "_", "[_", "0_", "]_", ",_", "include", "\\u", "suites_", ",_", "warn", "\\u", "on", "\\u", "skipped_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "suite_", "(_", "path_", ",_", "include", "\\u", "suites_", ",_", "warn", "\\u", "on", "\\u", "skipped_", ")_", ":_", "\\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_", "Test", "Data_", "(_", "source_", "=_", "path_", ",_", "include", "\\u", "suites_", "=_", "include", "\\u", "suites_", ",_", "warn", "\\u", "on", "\\u", "skipped_", "=_", "warn", "\\u", "on", "\\u", "skipped_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Data", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Data", "Error_", "(_", "\"", "Pars", "ing", " ", "'%", "s", "'", " ", "fail", "ed", ":", " ", "%", "s", "\"_", "%_", "(_", "path_", ",_", "unicode_", "(_", "err_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "get", "\\u", "multis", "ource", "\\u", "suite_", "(_", "datasources", "_", ",_", "include", "\\u", "suites_", ",_", "warn", "\\u", "on", "\\u", "skipped_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suit", "edat", "as_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "datasource_", "in_", "datasources", "_", ":_", "\\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 ", " _", "suit", "edat", "as_", "._", "append_", "(_", "\\u", "parse", "\\u", "suite_", "(_", "datasource_", ",_", "include", "\\u", "suites_", ",_", "warn", "\\u", "on", "\\u", "skipped_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Data", "Error_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "warn_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "suite_", "=_", "Run", "nable", "Multi", "Test", "Suite_", "(_", "suit", "edat", "as_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "suite_", "._", "get", "\\u", "test\\u", "count_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Data", "Error_", "(_", "\"", "Data", " ", "source", "s", " ", "%", "s", " ", "contain", " ", "no", " ", "test", " ", "case", "s", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "utils_", "._", "seq", "2str_", "(_", "datasources", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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_", "\\u", "check", "\\u", "suit", "e\\u", "contain", "s", "\\u", "tests_", "(_", "suite_", ",_", "run", "\\u", "empty", "\\u", "suites_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "._", "filter", "\\u", "empty", "\\u", "suites_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "suite_", "._", "get", "\\u", "test\\u", "count_", "(_", ")_", "and_", "not_", "run", "\\u", "empty", "\\u", "suites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Data", "Error_", "(_", "\"", "Test", " ", "suit", "e", " ", "'%", "s", "'", " ", "contain", "s", " ", "no", " ", "test", " ", "case", "s", ".\"_", "%_", "(_", "suite_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\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_", ",_", "data_", ",_", "parent_", "=_", "None_", ",_", "defaults_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "Test", "Suite_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "data_", "._", "name_", ",_", "data_", "._", "source_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "variables_", "=_", "GLOB", "AL", "\\u", "VARIABLES", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "variables_", "._", "set\\u", "from", "\\u", "variab", "le", "\\u", "table_", "(_", "data_", "._", "variab", "le", "\\u", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "data_", "._", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "doc_", "=_", "data_", "._", "setti", "ng", "\\u", "table_", "._", "doc_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metadata_", "=_", "self_", "._", "\\u", "get", "\\u", "metadata_", "(_", "data_", "._", "setti", "ng", "\\u", "table_", "._", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "imports_", "=_", "data_", "._", "imports_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user", "\\u", "keywords_", "=_", "User", "Library_", "(_", "data_", "._", "keywords_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup_", "=_", "Setup_", "(_", "data_", "._", "setti", "ng", "\\u", "table_", "._", "suit", "e\\u", "setup_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "._", "setti", "ng", "\\u", "table_", "._", "suit", "e\\u", "setup_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "teardown_", "=_", "Tea", "rdo", "wn_", "(_", "data_", "._", "setti", "ng", "\\u", "table_", "._", "suit", "e\\u", "teardown_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "._", "setti", "ng", "\\u", "table_", "._", "suit", "e\\u", "teardown_", "._", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defaults_", "=_", "Default", "Values_", "(_", "data_", "._", "setti", "ng", "\\u", "table_", ",_", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "suite_", "in_", "data_", "._", "children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Run", "nable", "Test", "Suite_", "(_", "suite_", ",_", "parent_", "=_", "self_", ",_", "defaults_", "=_", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "test_", "in_", "data_", "._", "testc", "ase", "\\u", "table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Run", "nable", "Test", "Case_", "(_", "test_", ",_", "parent_", "=_", "self_", ",_", "defaults_", "=_", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "mode", "\\u", "exit", "\\u", "on", "\\u", "failure_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "mode", "\\u", "dry", "\\u", "run_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "mode", "\\u", "skip", "\\u", "tear", "downs", "\\u", "on", "\\u", "exit_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "filter", "\\u", "empty", "\\u", "suites_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "suite_", "in_", "self_", "._", "suites_", "[_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "._", "filter", "\\u", "empty", "\\u", "suites_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "suite_", "._", "get", "\\u", "test\\u", "count_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "suites_", "._", "remove_", "(_", "suite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOGGER_", "._", "info_", "(_", "\"", "Run", "ning", " ", "test", " ", "suit", "e", " ", "'%", "s", "'", " ", "fail", "ed", ":", " ", "Test", " ", "suit", "e", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "contain", "s", " ", "no", " ", "test", " ", "case", "s", ".\"_", "%_", "(_", "suite_", "._", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "metadata_", "(_", "self_", ",_", "metadata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "=_", "utils_", "._", "Normalize", "d", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "[_", "item_", "._", "name_", "]_", "=_", "item_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "output_", ",_", "parent_", "=_", "None_", ",_", "errors_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "self_", "._", "\\u", "start", "\\u", "run_", "(_", "output_", ",_", "parent_", ",_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "setup_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "sub\\u", "suites_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "tests_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "report", "\\u", "status_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "teardown_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "end", "\\u", "run_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "start", "\\u", "run_", "(_", "self_", ",_", "output_", ",_", "parent_", ",_", "errors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "Suit", "e", "Run", "Errors_", "(_", "self_", "._", "\\u", "run", "\\u", "mode", "\\u", "exit", "\\u", "on", "\\u", "failure_", ",_", "self_", "._", "\\u", "run", "\\u", "mode", "\\u", "skip", "\\u", "tear", "downs", "\\u", "on", "\\u", "exit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "run", "\\u", "errors_", "=_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "errors_", "._", "start", "\\u", "suite_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "=_", "'", "RUNN", "ING", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "starttime_", "=_", "utils_", "._", "get", "\\u", "timestamp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "vars_", "=_", "parent_", "._", "context_", "._", "get", "\\u", "current", "\\u", "vars_", "(_", ")_", "if_", "parent_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "=_", "Namespace_", "(_", "self_", ",_", "parent", "\\u", "vars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context_", "=_", "EXECUT", "ION", "\\u", "CONTE", "XT", "S_", "._", "start", "\\u", "suite_", "(_", "ns_", ",_", "output_", ",_", "self_", "._", "\\u", "run", "\\u", "mode", "\\u", "dry", "\\u", "run_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "errors_", "._", "exit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ns_", "._", "handle", "\\u", "imports_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "set\\u", "variab", "le", "\\u", "dependent", "\\u", "metadata_", "(_", "self_", "._", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "._", "start", "\\u", "suite_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "variab", "le", "\\u", "dependent", "\\u", "metadata_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "doc_", "=_", "context_", "._", "replace", "\\u", "vars", "\\u", "from", "\\u", "setting_", "(_", "'", "Document", "ation", "'_", ",_", "self_", "._", "doc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup_", "._", "replace", "\\u", "variables_", "(_", "context_", "._", "get", "\\u", "current", "\\u", "vars_", "(_", ")_", ",_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "teardown_", "._", "replace", "\\u", "variables_", "(_", "context_", "._", "get", "\\u", "current", "\\u", "vars_", "(_", ")_", ",_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "value_", "in_", "self_", "._", "metadata_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "metadata_", "[_", "name_", "]_", "=_", "context_", "._", "replace", "\\u", "vars", "\\u", "from", "\\u", "setting_", "(_", "name_", ",_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "errors_", "._", "suit", "e\\u", "init", "\\u", "err_", "(_", "'", "Suit", "e", " ", "initialization", " ", "fail", "ed", ":\\\\", "n", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "'\\\\", "n", "'_", "._", "join_", "(_", "errors_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "setup_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "run", "\\u", "errors_", "._", "is", "\\u", "suit", "e\\u", "setup", "\\u", "allowed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "setup_", "._", "run_", "(_", "context_", ",_", "Suit", "e", "Set", "up", "Listener_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "errors_", "._", "setup", "\\u", "executed", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "teardown_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "run", "\\u", "errors_", "._", "is", "\\u", "suit", "e\\u", "tear", "down", "\\u", "allowed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "teardown_", "._", "run_", "(_", "context_", ",_", "Suit", "e", "Tea", "r", "Down", "Listener_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "sub\\u", "suites_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "suite_", "in_", "self_", "._", "suites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "._", "run_", "(_", "context_", "._", "output_", ",_", "self_", ",_", "self_", "._", "run", "\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "tests_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "executed", "\\u", "tests_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "test_", "in_", "self_", "._", "tests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "norm", "name_", "=_", "utils_", "._", "normalize_", "(_", "test_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "norm", "name_", "in_", "executed", "\\u", "tests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "warn_", "(_", "\"", "Multipl", "e", " ", "test", " ", "case", "s", " ", "with", " ", "name", " ", "'%", "s", "'", " ", "executed", " ", "in", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "test", " ", "suit", "e", " ", "'%", "s", "'\"_", "%_", "(_", "test_", "._", "name_", ",_", "self_", "._", "long", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "executed", "\\u", "tests_", "._", "append_", "(_", "norm", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test_", "._", "run_", "(_", "context_", ",_", "self_", "._", "run", "\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "set\\u", "prev", "\\u", "test\\u", "variables_", "(_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "report", "\\u", "status_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "=_", "self_", "._", "run", "\\u", "errors_", "._", "suit", "e\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "report", "\\u", "suit", "e\\u", "status_", "(_", "self_", "._", "status_", ",_", "self_", "._", "get", "\\u", "full", "\\u", "message_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Suite_", "(_", "Base", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "end", "\\u", "run_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "endtime_", "=_", "utils_", "._", "get", "\\u", "timestamp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ela", "pse", "dtime", "_", "=_", "utils_", "._", "get", "\\u", "ela", "pse", "d\\u", "time_", "(_", "self_", "._", "starttime_", ",_", "self_", "._", "endtime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "copy", "\\u", "prev", "\\u", "test\\u", "vars", "\\u", "to", "\\u", "global_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "end", "\\u", "suite_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "errors_", "._", "end", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Run", "nable", "Multi", "Test", "Suite_", "(_", "Run", "nable", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Multi", "Test", "Suite_", "(_", "Run", "nable", "Test", "Suite_", ")_", ":_", "\\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_", ",_", "suit", "edat", "as_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "Test", "Suite_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "variables_", "=_", "GLOB", "AL", "\\u", "VARIABLES", "_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "doc_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "imports_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup_", "=_", "Setup_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "teardown_", "=_", "Tea", "rdo", "wn_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "suite_", "in_", "suit", "edat", "as_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Run", "nable", "Test", "Suite_", "(_", "suite_", ",_", "parent_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "mode", "\\u", "exit", "\\u", "on", "\\u", "failure_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "mode", "\\u", "dry", "\\u", "run_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "mode", "\\u", "skip", "\\u", "tear", "downs", "\\u", "on", "\\u", "exit_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\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_", ",_", "tc", "\\u", "data_", ",_", "parent_", ",_", "defaults_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "Test", "Case_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "tc", "\\u", "data_", "._", "name_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "doc_", "=_", "tc", "\\u", "data_", "._", "doc_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup_", "=_", "defaults_", "._", "get", "\\u", "setup_", "(_", "tc", "\\u", "data_", "._", "setup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "teardown_", "=_", "defaults_", "._", "get", "\\u", "teardown_", "(_", "tc", "\\u", "data_", "._", "teardown_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tags_", "=_", "defaults_", "._", "get", "\\u", "tags_", "(_", "tc", "\\u", "data_", "._", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timeout_", "=_", "defaults_", "._", "get", "\\u", "timeout_", "(_", "tc", "\\u", "data_", "._", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "template_", "=_", "defaults_", "._", "get", "\\u", "template_", "(_", "tc", "\\u", "data_", "._", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "keywords_", "=_", "Keywords_", "(_", "tc", "\\u", "data_", "._", "steps_", ",_", "self_", "._", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "context_", ",_", "suit", "e\\u", "errors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "suit", "e\\u", "errors_", "=_", "suit", "e\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "start", "\\u", "run_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "run", "\\u", "errors_", "._", "is", "\\u", "allow", "ed", "\\u", "to", "\\u", "run_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run_", "(_", "context_", ")_", "\\u\\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", "not", "\\u", "allow", "ed", "\\u", "to", "\\u", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "end", "\\u", "run_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "start", "\\u", "run_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "errors_", "=_", "Test", "Run", "Errors_", "(_", "self_", "._", "\\u", "suit", "e\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "=_", "'", "RUNN", "ING", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "starttime_", "=_", "utils_", "._", "get", "\\u", "timestamp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "errors_", "._", "init", "\\u", "err_", "(_", "self_", "._", "\\u", "init", "\\u", "test_", "(_", "context_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "start", "\\u", "test_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "init", "\\u", "test_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "doc_", "=_", "context_", "._", "replace", "\\u", "vars", "\\u", "from", "\\u", "setting_", "(_", "'", "Document", "ation", "'_", ",_", "self_", "._", "doc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup_", "._", "replace", "\\u", "variables_", "(_", "context_", "._", "get", "\\u", "current", "\\u", "vars_", "(_", ")_", ",_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "teardown_", "._", "replace", "\\u", "variables_", "(_", "context_", "._", "get", "\\u", "current", "\\u", "vars_", "(_", ")_", ",_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "context_", "._", "replace", "\\u", "vars", "\\u", "from", "\\u", "setting_", "(_", "'", "Ta", "gs", "'_", ",_", "self_", "._", "tags_", ",_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tags_", "=_", "utils_", "._", "normali", "ze", "\\u", "tags_", "(_", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timeout_", "._", "replace", "\\u", "variables_", "(_", "context_", "._", "get", "\\u", "current", "\\u", "vars_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Test", " ", "case", " ", "initialization", " ", "fail", "ed", ":\\\\", "n", "%", "s", "'_", "%_", "'\\\\", "n", "'_", "._", "join_", "(_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Test", " ", "case", " ", "name", " ", "is", " ", "require", "d", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "keywords_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Test", " ", "case", " ", "contain", "s", " ", "no", " ", "keywords", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "timeout_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "setup_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "run", "\\u", "errors_", "._", "setup", "\\u", "failed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "keywords_", "._", "run_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Execut", "ion", "Failed_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "errors_", "._", "kw", "\\u", "err_", "(_", "unicode_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "keyw", "ord", "\\u", "failed_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "._", "set\\u", "test\\u", "status", "\\u", "bef", "ore", "\\u", "teardown_", "(_", "*_", "self_", "._", "\\u", "report", "\\u", "status_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "teardown_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "report", "\\u", "status", "\\u", "after", "\\u", "teardown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "keyw", "ord", "\\u", "failed_", "(_", "self_", ",_", "err_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "timeout_", "._", "set\\u", "keyw", "ord", "\\u", "timeout_", "(_", "err_", "._", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "suit", "e\\u", "errors_", "._", "test\\u", "failed_", "(_", "exit_", "=_", "err_", "._", "exit_", ",_", "critical_", "=_", "self_", "._", "critical_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "setup_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "setup_", "._", "run_", "(_", "context_", ",_", "Test", "Set", "up", "Listener_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "report", "\\u", "status_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "self_", "._", "run", "\\u", "errors_", "._", "get", "\\u", "message_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status_", "=_", "'", "FAIL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "=_", "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 ", " _", "self_", "._", "status_", "=_", "'", "PASS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "message_", ",_", "self_", "._", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "teardown_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "suit", "e\\u", "errors_", "._", "is", "\\u", "test\\u", "tear", "down", "\\u", "allowed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "teardown_", "._", "run_", "(_", "context_", ",_", "Test", "Tea", "rdo", "wn", "Listener_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "report", "\\u", "status", "\\u", "after", "\\u", "teardown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "run", "\\u", "errors_", "._", "tear", "down", "\\u", "failed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status_", "=_", "'", "FAIL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "=_", "self_", "._", "run", "\\u", "errors_", "._", "get", "\\u", "tear", "down", "\\u", "message_", "(_", "self_", "._", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "status_", "==_", "'", "PASS", "'_", "and_", "self_", "._", "timeout_", "._", "timed", "\\u", "out_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status_", "=_", "'", "FAIL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "=_", "self_", "._", "timeout_", "._", "get", "\\u", "message_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "status_", "==_", "'", "FAIL", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "suit", "e\\u", "errors_", "._", "test\\u", "failed_", "(_", "critical_", "=_", "self_", "._", "critical_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "not", "\\u", "allow", "ed", "\\u", "to", "\\u", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status_", "=_", "'", "FAIL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "=_", "self_", "._", "run", "\\u", "errors_", "._", "parent", "\\u", "or", "\\u", "init", "\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "nable", "Test", "Case_", "(_", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "end", "\\u", "run_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "endtime_", "=_", "utils_", "._", "get", "\\u", "timestamp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ela", "pse", "dtime", "_", "=_", "utils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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
agiliq/merchant/billing/tests/test_braintree_payments.py
[ { "content": "import braintree\n\nfrom django.conf import settings\nfrom django.test import TestCase\nfrom django.utils.unittest import skipIf\n\nfrom billing import get_gateway, CreditCard\nfrom billing.signals import *\nfrom billing.gateway import CardNotSupported, InvalidData\nfrom billing.utils.credit_card import Visa\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@skipIf(not settings.MERCHANT_SETTINGS.get(\"braintree_payments\", None), \"gateway not configured\")\nclass BraintreePaymentsGatewayTestCase(TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n # Need a way to test this. Requires delaying the status to either\n # \"settled\" or \"settling\"\n # def testAuthorizeAndRefund(self):\n # resp = self.merchant.purchase(100, self.credit_card)\n # self.assertEquals(resp[\"status\"], \"SUCCESS\")\n # response = self.merchant.credit(50, resp[\"response\"].transaction.id)\n # self.assertEquals(response[\"status\"], \"SUCCESS\")\n\n\n\n\n\n\n # The below tests require 'test_plan' to be created in the sandbox\n # console panel. This cannot be created by API at the moment\n\n", "metadata": "root.BraintreePaymentsGatewayTestCase", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def setUp(self):\n self.merchant = get_gateway(\"braintree_payments\")\n self.merchant.test_mode = True\n self.credit_card = CreditCard(first_name=\"Test\", last_name=\"User\",\n month=10, year=2020,\n number=\"4111111111111111\",\n verification_value=\"100\")", "metadata": "root.BraintreePaymentsGatewayTestCase.setUp", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 14 }, { "content": " def assertBraintreeResponseSuccess(self, resp, msg=None):\n if resp['status'] == \"FAILURE\":\n standardMsg = resp['response'].message\n self.fail(self._formatMessage(msg, standardMsg))\n else:\n self.assertEquals(resp['status'], \"SUCCESS\")", "metadata": "root.BraintreePaymentsGatewayTestCase.assertBraintreeResponseSuccess", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 22 }, { "content": " def assertBraintreeResponseFailure(self, resp, msg=None):\n self.assertEquals(resp['status'], \"FAILURE\")", "metadata": "root.BraintreePaymentsGatewayTestCase.assertBraintreeResponseFailure", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def testCardSupported(self):\n self.credit_card.number = \"5019222222222222\"\n self.assertRaises(CardNotSupported,\n lambda: self.merchant.purchase(1000, self.credit_card))", "metadata": "root.BraintreePaymentsGatewayTestCase.testCardSupported", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 32 }, { "content": " def testCardType(self):\n self.merchant.validate_card(self.credit_card)\n self.assertEquals(self.credit_card.card_type, Visa)", "metadata": "root.BraintreePaymentsGatewayTestCase.testCardType", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": " def testPurchase(self):\n resp = self.merchant.purchase(5, self.credit_card)\n self.assertBraintreeResponseSuccess(resp)", "metadata": "root.BraintreePaymentsGatewayTestCase.testPurchase", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": " def testFailedPurchase(self):\n resp = self.merchant.purchase(2001, self.credit_card)\n self.assertBraintreeResponseFailure(resp)", "metadata": "root.BraintreePaymentsGatewayTestCase.testFailedPurchase", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def testDeclinedPurchase(self):\n resp = self.merchant.purchase(2900, self.credit_card)\n self.assertBraintreeResponseFailure(resp)", "metadata": "root.BraintreePaymentsGatewayTestCase.testDeclinedPurchase", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def testPaymentSuccessfulSignal(self):\n received_signals = []\n\n def receive(sender, **kwargs):\n received_signals.append(kwargs.get(\"signal\"))\n\n transaction_was_successful.connect(receive)\n\n resp = self.merchant.purchase(1, self.credit_card)\n self.assertEquals(received_signals, [transaction_was_successful])", "metadata": "root.BraintreePaymentsGatewayTestCase.testPaymentSuccessfulSignal", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 53 }, { "content": " def testPaymentUnSuccessfulSignal(self):\n received_signals = []\n\n def receive(sender, **kwargs):\n received_signals.append(kwargs.get(\"signal\"))\n\n transaction_was_unsuccessful.connect(receive)\n\n resp = self.merchant.purchase(2000, self.credit_card)\n self.assertEquals(received_signals, [transaction_was_unsuccessful])", "metadata": "root.BraintreePaymentsGatewayTestCase.testPaymentUnSuccessfulSignal", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def testCreditCardExpired(self):\n credit_card = CreditCard(first_name=\"Test\", last_name=\"User\",\n month=10, year=2011,\n number=\"4000111111111115\",\n verification_value=\"100\")\n resp = self.merchant.purchase(2004, credit_card)\n self.assertNotEquals(resp[\"status\"], \"SUCCESS\")", "metadata": "root.BraintreePaymentsGatewayTestCase.testCreditCardExpired", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 75 }, { "content": " def testAuthorizeAndCapture(self):\n resp = self.merchant.authorize(100, self.credit_card)\n self.assertBraintreeResponseSuccess(resp)\n resp = self.merchant.capture(50, resp[\"response\"].transaction.id)\n self.assertBraintreeResponseSuccess(resp)", "metadata": "root.BraintreePaymentsGatewayTestCase.testAuthorizeAndCapture", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 83 }, { "content": " def testAuthorizeAndVoid(self):\n resp = self.merchant.authorize(105, self.credit_card)\n self.assertBraintreeResponseSuccess(resp)\n resp = self.merchant.void(resp[\"response\"].transaction.id)\n self.assertBraintreeResponseSuccess(resp)", "metadata": "root.BraintreePaymentsGatewayTestCase.testAuthorizeAndVoid", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 97 }, { "content": " def testStoreMissingCustomer(self):\n self.assertRaises(InvalidData,\n lambda: self.merchant.store(self.credit_card, {}))", "metadata": "root.BraintreePaymentsGatewayTestCase.testStoreMissingCustomer", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 103 }, { "content": " def testStoreWithoutBillingAddress(self):\n options = {\n \"customer\": {\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n },\n }\n resp = self.merchant.store(self.credit_card, options=options)\n self.assertBraintreeResponseSuccess(resp)\n self.assertEquals(resp[\"response\"].customer.credit_cards[0].expiration_date,\n \"%s/%s\" % (self.credit_card.month,\n self.credit_card.year))\n self.assertTrue(getattr(resp[\"response\"].customer.credit_cards[0], \"customer_id\"))\n self.assertTrue(getattr(resp[\"response\"].customer.credit_cards[0], \"token\"))", "metadata": "root.BraintreePaymentsGatewayTestCase.testStoreWithoutBillingAddress", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 107 }, { "content": " def testStoreWithBillingAddress(self):\n options = {\n \"customer\": {\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n },\n \"billing_address\": {\n \"name\": \"Johnny Doe\",\n \"company\": \"\",\n \"email\": \"[email protected]\",\n \"address1\": \"Street #1\",\n \"address2\": \"House #2\",\n \"city\": \"Timbuktu\",\n \"country\": \"United States of America\",\n \"zip\": \"110011\"\n }\n }\n resp = self.merchant.store(self.credit_card, options=options)\n self.assertBraintreeResponseSuccess(resp)\n self.assertTrue(getattr(resp[\"response\"].customer.credit_cards[0], \"billing_address\"))\n billing_address = resp[\"response\"].customer.credit_cards[0].billing_address\n self.assertEquals(billing_address.country_code_alpha2, \"US\")\n self.assertEquals(billing_address.postal_code, \"110011\")\n self.assertEquals(billing_address.street_address, \"Street #1\")\n self.assertEquals(billing_address.extended_address, \"House #2\")\n self.assertEquals(billing_address.locality, \"Timbuktu\")", "metadata": "root.BraintreePaymentsGatewayTestCase.testStoreWithBillingAddress", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 122 }, { "content": " def testUnstore(self):\n options = {\n \"customer\": {\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n },\n }\n resp = self.merchant.store(self.credit_card, options=options)\n self.assertBraintreeResponseSuccess(resp)\n resp = self.merchant.unstore(resp[\"response\"].customer.credit_cards[0].token)\n self.assertBraintreeResponseSuccess(resp)", "metadata": "root.BraintreePaymentsGatewayTestCase.testUnstore", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 149 }, { "content": " def testRecurring1(self):\n options = {\n \"customer\": {\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n },\n \"recurring\": {\n \"plan_id\": \"test_plan\"\n },\n }\n resp = self.merchant.recurring(10, self.credit_card, options=options)\n self.assertBraintreeResponseSuccess(resp)\n subscription = resp[\"response\"].subscription\n self.assertEquals(subscription.status,\n braintree.Subscription.Status.Active)", "metadata": "root.BraintreePaymentsGatewayTestCase.testRecurring1", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 163 }, { "content": " def testRecurring2(self):\n options = {\n \"customer\": {\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n },\n \"recurring\": {\n \"plan_id\": \"test_plan\",\n \"price\": 15\n },\n }\n resp = self.merchant.recurring(15, self.credit_card, options=options)\n self.assertBraintreeResponseSuccess(resp)\n subscription = resp[\"response\"].subscription\n self.assertEquals(subscription.price, 15)", "metadata": "root.BraintreePaymentsGatewayTestCase.testRecurring2", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 179 }, { "content": " def testRecurring3(self):\n options = {\n \"customer\": {\n \"name\": \"John Doe\",\n \"email\": \"[email protected]\",\n },\n \"recurring\": {\n \"plan_id\": \"test_plan\",\n \"trial_duration\": 2,\n \"trial_duration_unit\": \"month\",\n \"number_of_billing_cycles\": 12,\n },\n }\n resp = self.merchant.recurring(20, self.credit_card, options=options)\n self.assertBraintreeResponseSuccess(resp)\n subscription = resp[\"response\"].subscription\n self.assertEquals(subscription.number_of_billing_cycles, 12)", "metadata": "root.BraintreePaymentsGatewayTestCase.testRecurring3", "header": "['class', 'BraintreePaymentsGatewayTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 195 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "brain", "tree_", "\\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_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "unittest_", "import_", "skip", "If_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bill", "ing_", "import_", "get", "\\u", "gateway_", ",_", "Credit", "Card_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bill", "ing_", "._", "signals_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bill", "ing_", "._", "gateway_", "import_", "Card", "Not", "Supported_", ",_", "Inva", "lid", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bill", "ing_", "._", "utils_", "._", "credit", "\\u", "card_", "import_", "Vis", "a_", "\\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_", "@_", "skip", "If_", "(_", "not_", "settings_", "._", "MER", "CHAN", "T", "\\u", "SETTINGS_", "._", "get_", "(_", "\"", "brain", "tree", "\\u", "payments", "\"_", ",_", "None_", ")_", ",_", "\"", "gateway", " ", "not", " ", "configur", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "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_", "#", " ", "Ne", "ed", " ", "a", " ", "way", " ", "to", " ", "test", " ", "this", ".", " ", "Requ", "ires", " ", "dela", "ying", " ", "the", " ", "status", " ", "to", " ", "eit", "her_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "settle", "d", "\"", " ", "or", " ", "\"", "sett", "ling", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "test", "Authoriz", "e", "And", "Refu", "nd", "(", "self", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "resp", " ", "=", " ", "self", ".", "merchant", ".", "purchase", "(", "100", ",", " ", "self", ".", "credit", "\\u", "card", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "s", "(", "resp", "[\"", "status", "\"]", ",", " ", "\"", "SUCCESS", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "response", " ", "=", " ", "self", ".", "merchant", ".", "credit", "(", "50", ",", " ", "resp", "[\"", "response", "\"]", ".", "transaction", ".", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Equal", "s", "(", "response", "[\"", "status", "\"]", ",", " ", "\"", "SUCCESS", "\")", "_", "\\u\\u\\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_", "#", " ", "The", " ", "belo", "w", " ", "tests", " ", "require", " ", "'", "test\\u", "plan", "'", " ", "to", " ", "be", " ", "created", " ", "in", " ", "the", " ", "sandbox_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "console", " ", "panel", ".", " ", "Thi", "s", " ", "cann", "ot", " ", "be", " ", "created", " ", "by", " ", "API", " ", "at", " ", "the", " ", "moment_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "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_", "._", "merchant", "_", "=_", "get", "\\u", "gateway_", "(_", "\"", "brain", "tree", "\\u", "payments", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "merchant", "_", "._", "test\\u", "mode_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "credit", "\\u", "card_", "=_", "Credit", "Card_", "(_", "first", "\\u", "name_", "=_", "\"", "Test", "\"_", ",_", "last", "\\u", "name_", "=_", "\"", "User", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "month_", "=_", "10_", ",_", "year_", "=_", "2020_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number_", "=_", "\"", "411", "11111111111", "11", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verification", "\\u", "value_", "=_", "\"", "100", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "self_", ",_", "resp_", ",_", "msg_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "resp_", "[_", "'", "status", "'_", "]_", "==_", "\"", "FAIL", "URE", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "standard", "Msg_", "=_", "resp_", "[_", "'", "response", "'_", "]_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "self_", "._", "\\u", "format", "Message_", "(_", "msg_", ",_", "standard", "Msg_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "resp_", "[_", "'", "status", "'_", "]_", ",_", "\"", "SUCCESS", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "assert", "Brain", "tree", "Respons", "e", "Failure_", "(_", "self_", ",_", "resp_", ",_", "msg_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "resp_", "[_", "'", "status", "'_", "]_", ",_", "\"", "FAIL", "URE", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Card", "Supported_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "credit", "\\u", "card_", "._", "number_", "=_", "\"", "501", "922", "2222222", "222", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Card", "Not", "Supported_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", ":_", "self_", "._", "merchant", "_", "._", "purchase", "_", "(_", "1000_", ",_", "self_", "._", "credit", "\\u", "card_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Card", "Type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "merchant", "_", "._", "validat", "e\\u", "card_", "(_", "self_", "._", "credit", "\\u", "card_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "credit", "\\u", "card_", "._", "card", "\\u", "type_", ",_", "Vis", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pur", "chase", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "self_", "._", "merchant", "_", "._", "purchase", "_", "(_", "5_", ",_", "self_", "._", "credit", "\\u", "card_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Fail", "ed", "Pur", "chase", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "self_", "._", "merchant", "_", "._", "purchase", "_", "(_", "2001_", ",_", "self_", "._", "credit", "\\u", "card_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Failure_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Decl", "ine", "d", "Pur", "chase", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "self_", "._", "merchant", "_", "._", "purchase", "_", "(_", "290", "0_", ",_", "self_", "._", "credit", "\\u", "card_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Failure_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Payment", "Success", "ful", "Signal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receive", "d\\u", "signals_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "receive_", "(_", "sender_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receive", "d\\u", "signals_", "._", "append_", "(_", "kwargs_", "._", "get_", "(_", "\"", "signal", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transaction", "\\u", "was", "\\u", "successful_", "._", "connect_", "(_", "receive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "purchase", "_", "(_", "1_", ",_", "self_", "._", "credit", "\\u", "card_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "receive", "d\\u", "signals_", ",_", "[_", "transaction", "\\u", "was", "\\u", "successful_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Payment", "Un", "Success", "ful", "Signal_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receive", "d\\u", "signals_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "receive_", "(_", "sender_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receive", "d\\u", "signals_", "._", "append_", "(_", "kwargs_", "._", "get_", "(_", "\"", "signal", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transaction", "\\u", "was", "\\u", "unsuc", "cess", "ful_", "._", "connect_", "(_", "receive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "purchase", "_", "(_", "2000_", ",_", "self_", "._", "credit", "\\u", "card_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "receive", "d\\u", "signals_", ",_", "[_", "transaction", "\\u", "was", "\\u", "unsuc", "cess", "ful_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Credit", "Card", "Expire", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "credit", "\\u", "card_", "=_", "Credit", "Card_", "(_", "first", "\\u", "name_", "=_", "\"", "Test", "\"_", ",_", "last", "\\u", "name_", "=_", "\"", "User", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "month_", "=_", "10_", ",_", "year_", "=_", "2011_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "number_", "=_", "\"", "4000", "11111111111", "5", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verification", "\\u", "value_", "=_", "\"", "100", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "purchase", "_", "(_", "2004", "_", ",_", "credit", "\\u", "card_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equals_", "(_", "resp_", "[_", "\"", "status", "\"_", "]_", ",_", "\"", "SUCCESS", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Authoriz", "e", "And", "Capture_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "self_", "._", "merchant", "_", "._", "authorize_", "(_", "100_", ",_", "self_", "._", "credit", "\\u", "card_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "capture_", "(_", "50_", ",_", "resp_", "[_", "\"", "response", "\"_", "]_", "._", "transaction_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Authoriz", "e", "And", "Void_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "self_", "._", "merchant", "_", "._", "authorize_", "(_", "105_", ",_", "self_", "._", "credit", "\\u", "card_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "void_", "(_", "resp_", "[_", "\"", "response", "\"_", "]_", "._", "transaction_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Stor", "e", "Missing", "Customer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Inva", "lid", "Data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", ":_", "self_", "._", "merchant", "_", "._", "store_", "(_", "self_", "._", "credit", "\\u", "card_", ",_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Stor", "e", "With", "out", "Bill", "ing", "Address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "customer", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Joh", "n", " ", "Do", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "email", "\"_", ":_", "\"", "john", ".", "doe", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "store_", "(_", "self_", "._", "credit", "\\u", "card_", ",_", "options_", "=_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "resp_", "[_", "\"", "response", "\"_", "]_", "._", "customer_", "._", "credit", "\\u", "cards_", "[_", "0_", "]_", "._", "expir", "ation", "\\u", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "self_", "._", "credit", "\\u", "card_", "._", "month_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "credit", "\\u", "card_", "._", "year_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "getattr_", "(_", "resp_", "[_", "\"", "response", "\"_", "]_", "._", "customer_", "._", "credit", "\\u", "cards_", "[_", "0_", "]_", ",_", "\"", "customer", "\\u", "id", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "getattr_", "(_", "resp_", "[_", "\"", "response", "\"_", "]_", "._", "customer_", "._", "credit", "\\u", "cards_", "[_", "0_", "]_", ",_", "\"", "token", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Stor", "e", "With", "Bill", "ing", "Address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "customer", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Joh", "n", " ", "Do", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "email", "\"_", ":_", "\"", "john", ".", "doe", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bill", "ing", "\\u", "address", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Joh", "nny", " ", "Do", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "compan", "y", "\"_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "email", "\"_", ":_", "\"", "john", "ny", ".", "doe", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "address", "1", "\"_", ":_", "\"", "Stre", "et", " ", "#", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "address", "2", "\"_", ":_", "\"", "House", " ", "#", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "city", "\"_", ":_", "\"", "Tim", "bu", "kt", "u", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "countr", "y", "\"_", ":_", "\"", "Unit", "ed", " ", "State", "s", " ", "of", " ", "Ame", "rica", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "zip", "\"_", ":_", "\"", "1100", "11", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "store_", "(_", "self_", "._", "credit", "\\u", "card_", ",_", "options_", "=_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "getattr_", "(_", "resp_", "[_", "\"", "response", "\"_", "]_", "._", "customer_", "._", "credit", "\\u", "cards_", "[_", "0_", "]_", ",_", "\"", "bill", "ing", "\\u", "address", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bill", "ing", "\\u", "address_", "=_", "resp_", "[_", "\"", "response", "\"_", "]_", "._", "customer_", "._", "credit", "\\u", "cards_", "[_", "0_", "]_", "._", "bill", "ing", "\\u", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bill", "ing", "\\u", "address_", "._", "countr", "y", "\\u", "code", "\\u", "alpha", "2_", ",_", "\"", "US", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bill", "ing", "\\u", "address_", "._", "postal", "\\u", "code_", ",_", "\"", "1100", "11", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bill", "ing", "\\u", "address_", "._", "street", "\\u", "address_", ",_", "\"", "Stre", "et", " ", "#", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bill", "ing", "\\u", "address_", "._", "extend", "ed", "\\u", "address_", ",_", "\"", "House", " ", "#", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "bill", "ing", "\\u", "address_", "._", "locality", "_", ",_", "\"", "Tim", "bu", "kt", "u", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Uns", "tore_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "customer", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Joh", "n", " ", "Do", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "email", "\"_", ":_", "\"", "john", ".", "doe", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "store_", "(_", "self_", "._", "credit", "\\u", "card_", ",_", "options_", "=_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "unst", "ore_", "(_", "resp_", "[_", "\"", "response", "\"_", "]_", "._", "customer_", "._", "credit", "\\u", "cards_", "[_", "0_", "]_", "._", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Recu", "rri", "ng", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "customer", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Joh", "n", " ", "Do", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "email", "\"_", ":_", "\"", "john", ".", "doe", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "recurring", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plan", "\\u", "id", "\"_", ":_", "\"", "test\\u", "plan", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "recurring", "_", "(_", "10_", ",_", "self_", "._", "credit", "\\u", "card_", ",_", "options_", "=_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscription_", "=_", "resp_", "[_", "\"", "response", "\"_", "]_", "._", "subscription_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subscription_", "._", "status_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "brain", "tree_", "._", "Subscription_", "._", "Status_", "._", "Active_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Recu", "rri", "ng", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "customer", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Joh", "n", " ", "Do", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "email", "\"_", ":_", "\"", "john", ".", "doe", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "recurring", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plan", "\\u", "id", "\"_", ":_", "\"", "test\\u", "plan", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "price", "\"_", ":_", "15_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "recurring", "_", "(_", "15_", ",_", "self_", "._", "credit", "\\u", "card_", ",_", "options_", "=_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscription_", "=_", "resp_", "[_", "\"", "response", "\"_", "]_", "._", "subscription_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subscription_", "._", "price_", ",_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Brain", "tree", "Payment", "s", "Gat", "ewa", "y", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Recu", "rri", "ng", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "customer", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "Joh", "n", " ", "Do", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "email", "\"_", ":_", "\"", "john", ".", "doe", "@", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "recurring", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plan", "\\u", "id", "\"_", ":_", "\"", "test\\u", "plan", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tria", "l\\u", "duration", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tria", "l\\u", "duration", "\\u", "unit", "\"_", ":_", "\"", "month", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "number", "\\u", "of", "\\u", "bill", "ing", "\\u", "cycle", "s", "\"_", ":_", "12_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "merchant", "_", "._", "recurring", "_", "(_", "20_", ",_", "self_", "._", "credit", "\\u", "card_", ",_", "options_", "=_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Brain", "tree", "Respons", "e", "Success_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscription_", "=_", "resp_", "[_", "\"", "response", "\"_", "]_", "._", "subscription_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "subscription_", "._", "number", "\\u", "of", "\\u", "bill", "ing", "\\u", "cycles_", ",_", "12_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
datastax/python-driver/tests/unit/cython/test_bytesio.py
[ { "content": "# Copyright 2013-2016 DataStax, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom tests.unit.cython.utils import cyimport, cythontest\nbytesio_testhelper = cyimport('tests.unit.cython.bytesio_testhelper')\n\ntry:\n import unittest2 as unittest\nexcept ImportError:\n import unittest # noqa\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_", "#", " ", "Copy", "right", " ", "2013", "-", "2016", " ", "Data", "Sta", "x", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tests_", "._", "unit_", "._", "cython", "_", "._", "utils_", "import_", "cy", "import_", ",_", "cython", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes", "io", "\\u", "testh", "elp", "er_", "=_", "cy", "import_", "(_", "'", "tests", ".", "unit", ".", "cython", ".", "bytes", "io", "\\u", "testh", "elp", "er", "'_", ")_", "\\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_", "#", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
fusionbox/django-widgy/widgy/contrib/widgy_mezzanine/__init__.py
[ { "content": "def get_widgypage_model():\n from django.conf import settings\n from django.apps import apps\n from django.core.exceptions import ImproperlyConfigured\n\n try:\n app_label, model_name = getattr(settings, 'WIDGY_MEZZANINE_PAGE_MODEL', 'widgy_mezzanine.WidgyPage').split('.')\n except ValueError:\n raise ImproperlyConfigured(\"WIDGY_MEZZANINE_PAGE_MODEL must be of the form 'app_label.model_name'\")\n model = apps.get_model(app_label, model_name)\n if model is None:\n raise ImproperlyConfigured(\"WIDGY_MEZZANINE_PAGE_MODEL refers to model '%s' that has not been installed\" % settings.WIDGY_MEZZANINE_PAGE_MODEL)\n return model", "metadata": "root.get_widgypage_model", "header": "['module', '___EOS___']", "index": 0 }, { "content": "", "metadata": "root", "header": "['module', '___EOS___']", "index": 13 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "def_", "get", "\\u", "wid", "gyp", "age", "\\u", "model_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "apps_", "import_", "apps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Impro", "perl", "y", "Configured_", "\\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 ", " _", "app", "\\u", "label_", ",_", "model", "\\u", "name_", "=_", "getattr_", "(_", "settings_", ",_", "'", "WID", "GY", "\\u", "ME", "ZZ", "ANI", "NE", "\\u", "PAGE", "\\u", "MODEL", "'_", ",_", "'", "wid", "gy", "\\u", "mezzanine", ".", "Wid", "gy", "Page", "'_", ")_", "._", "split_", "(_", "'.'_", ")_", "\\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_", "Impro", "perl", "y", "Configured_", "(_", "\"", "WID", "GY", "\\u", "ME", "ZZ", "ANI", "NE", "\\u", "PAGE", "\\u", "MODEL", " ", "must", " ", "be", " ", "of", " ", "the", " ", "form", " ", "'", "app", "\\u", "label", ".", "model", "\\u", "name", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model_", "=_", "apps_", "._", "get", "\\u", "model_", "(_", "app", "\\u", "label_", ",_", "model", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Impro", "perl", "y", "Configured_", "(_", "\"", "WID", "GY", "\\u", "ME", "ZZ", "ANI", "NE", "\\u", "PAGE", "\\u", "MODEL", " ", "refer", "s", " ", "to", " ", "model", " ", "'%", "s", "'", " ", "tha", "t", " ", "has", " ", "not", " ", "bee", "n", " ", "install", "ed", "\"_", "%_", "settings_", "._", "WID", "GY", "\\u", "ME", "ZZ", "ANI", "NE", "\\u", "PAGE", "\\u", "MODEL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "model_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
wiki-ai/revscoring/revscoring/features/wikitext/tests/test_parsed.py
[ { "content": "import pickle\n\nfrom nose.tools import eq_\n\nfrom .. import revision\nfrom ....datasources import revision_oriented\nfrom ....dependencies import solve\n\nh_headings_ds = revision.datasources.heading_titles_matching(r\"h\")\nh_headings = revision.heading_titles_matching(r\"h\")\nlvl_2_headings_ds = revision.datasources.headings_by_level(2)\nlvl_2_headings = revision.headings_by_level(2)\nenwiki_wikilinks_ds = revision.datasources.wikilink_titles_matching(r\"^:?en:\")\nenwiki_wikilinks = revision.wikilink_titles_matching(r\"^:?en:\")\nwikimedia_external_links_ds = \\\n revision.datasources.external_link_urls_matching(r\".*wikimedia.*\")\nwikimedia_external_links = \\\n revision.external_link_urls_matching(r\".*wikimedia.*\")\ncite_templates_ds = revision.datasources.template_names_matching(r\"^cite\")\ncite_templates = revision.template_names_matching(r\"^cite\")\n\nr_text = revision_oriented.revision.text\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_content():\n\n cache = {r_text: \"This is some text.\\n\" +\n \"== A heading! ==\\n\" +\n \"{{Foo}} the [[bar]]!\"}\n eq_(solve(revision.datasources.content, cache=cache),\n \"This is some text.\\n\" +\n \" A heading! \\n\" +\n \" the bar!\")\n\n eq_(solve(revision.content_chars, cache=cache), 41)\n\n eq_(pickle.loads(pickle.dumps(revision.content_chars)),\n revision.content_chars)", "metadata": "root.test_content", "header": "['module', '___EOS___']", "index": 24 }, { "content": "def test_headings():\n\n cache = {r_text: \"This is some text.\\n\" +\n \"== Heading! ==\\n\" +\n \"{{Foo}} the [[bar]]!\\n\" +\n \"=== Another heading! ===\"}\n eq_(solve(revision.datasources.heading_titles, cache=cache),\n [\"Heading!\", \"Another heading!\"])\n\n eq_(solve(revision.headings, cache=cache), 2)\n\n eq_(solve(h_headings, cache=cache), 1)\n\n eq_(solve(lvl_2_headings, cache=cache), 1)\n\n eq_(pickle.loads(pickle.dumps(revision.headings)), revision.headings)\n eq_(pickle.loads(pickle.dumps(h_headings)), h_headings)\n eq_(pickle.loads(pickle.dumps(lvl_2_headings)), lvl_2_headings)", "metadata": "root.test_headings", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def test_wikilinks():\n\n cache = {r_text: \"This is [[:en:some|text]].\\n\" +\n \"== Heading! ==\\n\" +\n \"{{Foo}} the [[bar]]!\\n\" +\n \"=== Another heading! ===\"}\n eq_(solve(revision.datasources.wikilink_titles, cache=cache),\n [\":en:some\", \"bar\"])\n\n eq_(solve(revision.wikilinks, cache=cache), 2)\n\n eq_(solve(enwiki_wikilinks, cache=cache), 1)\n\n eq_(pickle.loads(pickle.dumps(revision.wikilinks)), revision.wikilinks)\n eq_(pickle.loads(pickle.dumps(enwiki_wikilinks)), enwiki_wikilinks)", "metadata": "root.test_wikilinks", "header": "['module', '___EOS___']", "index": 60 }, { "content": "def test_external_links():\n\n cache = {r_text: \"This is [https://wikis.com].\\n\" +\n \"== Heading! ==\\n\" +\n \"{{Foo}} the [//meta.wikimedia.org foobar]!\\n\" +\n \"=== Another heading! ===\"}\n eq_(solve(revision.datasources.external_link_urls, cache=cache),\n [\"https://wikis.com\", \"//meta.wikimedia.org\"])\n\n eq_(solve(revision.external_links, cache=cache), 2)\n\n eq_(solve(wikimedia_external_links, cache=cache), 1)\n\n eq_(pickle.loads(pickle.dumps(revision.external_links)),\n revision.external_links)\n eq_(pickle.loads(pickle.dumps(wikimedia_external_links)),\n wikimedia_external_links)", "metadata": "root.test_external_links", "header": "['module', '___EOS___']", "index": 77 }, { "content": "def test_tags():\n\n cache = {r_text: \"This is [https://wikis.com].\\n\" +\n \"== Heading! ==\\n\" +\n \"<ref>Foo</ref> the <span>foobar</span>!\\n\" +\n \"=== Another heading! ===\"}\n eq_(solve(revision.datasources.tag_names, cache=cache),\n [\"ref\", \"span\"])\n\n eq_(solve(revision.tags, cache=cache), 2)\n\n eq_(solve(revision.ref_tags, cache=cache), 1)\n\n eq_(pickle.loads(pickle.dumps(revision.tags)),\n revision.tags)\n eq_(pickle.loads(pickle.dumps(revision.ref_tags)),\n revision.ref_tags)", "metadata": "root.test_tags", "header": "['module', '___EOS___']", "index": 96 }, { "content": "def test_templates():\n\n cache = {r_text: \"This is [https://wikis.com].\\n\" +\n \"== Heading! ==\\n\" +\n \"<ref>{{Cite thing}}</ref> the {{citation needed}}\\n\" +\n \"=== Another {{heading|foo}}! ===\"}\n eq_(solve(revision.datasources.template_names, cache=cache),\n [\"Cite thing\", \"citation needed\", \"heading\"])\n\n eq_(solve(revision.templates, cache=cache), 3)\n\n eq_(solve(cite_templates, cache=cache), 1)\n\n eq_(pickle.loads(pickle.dumps(revision.templates)),\n revision.templates)\n eq_(pickle.loads(pickle.dumps(cite_templates)),\n cite_templates)", "metadata": "root.test_templates", "header": "['module', '___EOS___']", "index": 115 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "eq\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "import_", "revision_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "._", "datasources", "_", "import_", "revis", "ion", "\\u", "orient", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "._", "dependencies_", "import_", "solve_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "h", "\\u", "heading", "s", "\\u", "ds_", "=_", "revision_", "._", "datasources", "_", "._", "heading", "\\u", "titles", "\\u", "matching_", "(_", "r", "\"", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h", "\\u", "headings_", "=_", "revision_", "._", "heading", "\\u", "titles", "\\u", "matching_", "(_", "r", "\"", "h", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lvl", "\\u", "2", "\\u", "heading", "s", "\\u", "ds_", "=_", "revision_", "._", "datasources", "_", "._", "heading", "s", "\\u", "by", "\\u", "level_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lvl", "\\u", "2", "\\u", "headings_", "=_", "revision_", "._", "heading", "s", "\\u", "by", "\\u", "level_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "en", "wiki", "\\u", "wiki", "link", "s", "\\u", "ds_", "=_", "revision_", "._", "datasources", "_", "._", "wiki", "link", "\\u", "titles", "\\u", "matching_", "(_", "r", "\"", "^", ":", "?", "en", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "en", "wiki", "\\u", "wiki", "links_", "=_", "revision_", "._", "wiki", "link", "\\u", "titles", "\\u", "matching_", "(_", "r", "\"", "^", ":", "?", "en", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wiki", "media", "\\u", "external", "\\u", "link", "s", "\\u", "ds_", "=_", "revision_", "._", "datasources", "_", "._", "external", "\\u", "link", "\\u", "urls", "\\u", "matching_", "(_", "r", "\".*", "wiki", "media", ".*\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wiki", "media", "\\u", "external", "\\u", "links_", "=_", "revision_", "._", "external", "\\u", "link", "\\u", "urls", "\\u", "matching_", "(_", "r", "\".*", "wiki", "media", ".*\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cite", "\\u", "template", "s", "\\u", "ds_", "=_", "revision_", "._", "datasources", "_", "._", "template", "\\u", "names", "\\u", "matching_", "(_", "r", "\"", "^", "cite", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cite", "\\u", "templates_", "=_", "revision_", "._", "template", "\\u", "names", "\\u", "matching_", "(_", "r", "\"", "^", "cite", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\\u", "text_", "=_", "revis", "ion", "\\u", "orient", "ed_", "._", "revision_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "content_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "{_", "r", "\\u", "text_", ":_", "\"", "Thi", "s", " ", "is", " ", "some", " ", "text", ".\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"==", " ", "A", " ", "heading", "!", " ", "==", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "{", "Foo", "}}", " ", "the", " ", "[[", "bar", "]]", "!\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "datasources", "_", "._", "content_", ",_", "cache_", "=_", "cache_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Thi", "s", " ", "is", " ", "some", " ", "text", ".\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "A", " ", "heading", "!", " ", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "the", " ", "bar", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "content", "\\u", "chars_", ",_", "cache_", "=_", "cache_", ")_", ",_", "41_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "revision_", "._", "content", "\\u", "chars_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revision_", "._", "content", "\\u", "chars_", ")_", "\\u\\u\\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", "headings_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "{_", "r", "\\u", "text_", ":_", "\"", "Thi", "s", " ", "is", " ", "some", " ", "text", ".\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"==", " ", "Head", "ing", "!", " ", "==", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "{", "Foo", "}}", " ", "the", " ", "[[", "bar", "]]", "!\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"==", "=", " ", "Ano", "ther", " ", "heading", "!", " ", "===", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "datasources", "_", "._", "heading", "\\u", "titles_", ",_", "cache_", "=_", "cache_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Head", "ing", "!\"_", ",_", "\"", "Ano", "ther", " ", "heading", "!\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "headings_", ",_", "cache_", "=_", "cache_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "h", "\\u", "headings_", ",_", "cache_", "=_", "cache_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "lvl", "\\u", "2", "\\u", "headings_", ",_", "cache_", "=_", "cache_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "revision_", "._", "headings_", ")_", ")_", ",_", "revision_", "._", "headings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "h", "\\u", "headings_", ")_", ")_", ",_", "h", "\\u", "headings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "lvl", "\\u", "2", "\\u", "headings_", ")_", ")_", ",_", "lvl", "\\u", "2", "\\u", "headings_", ")_", "\\u\\u\\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", "wiki", "links_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "{_", "r", "\\u", "text_", ":_", "\"", "Thi", "s", " ", "is", " ", "[[", ":", "en", ":", "some", "|", "text", "]]", ".\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"==", " ", "Head", "ing", "!", " ", "==", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "{", "Foo", "}}", " ", "the", " ", "[[", "bar", "]]", "!\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"==", "=", " ", "Ano", "ther", " ", "heading", "!", " ", "===", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "datasources", "_", "._", "wiki", "link", "\\u", "titles_", ",_", "cache_", "=_", "cache_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\":", "en", ":", "some", "\"_", ",_", "\"", "bar", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "wiki", "links_", ",_", "cache_", "=_", "cache_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "en", "wiki", "\\u", "wiki", "links_", ",_", "cache_", "=_", "cache_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "revision_", "._", "wiki", "links_", ")_", ")_", ",_", "revision_", "._", "wiki", "links_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "en", "wiki", "\\u", "wiki", "links_", ")_", ")_", ",_", "en", "wiki", "\\u", "wiki", "links_", ")_", "\\u\\u\\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", "external", "\\u", "links_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "{_", "r", "\\u", "text_", ":_", "\"", "Thi", "s", " ", "is", " ", "[", "https", "://", "wiki", "s", ".", "com", "].", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"==", " ", "Head", "ing", "!", " ", "==", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "{", "Foo", "}}", " ", "the", " ", "[", "//", "meta", ".", "wiki", "media", ".", "org", " ", "fooba", "r", "]", "!\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"==", "=", " ", "Ano", "ther", " ", "heading", "!", " ", "===", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "datasources", "_", "._", "external", "\\u", "link", "\\u", "urls_", ",_", "cache_", "=_", "cache_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "https", "://", "wiki", "s", ".", "com", "\"_", ",_", "\"//", "meta", ".", "wiki", "media", ".", "org", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "external", "\\u", "links_", ",_", "cache_", "=_", "cache_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "wiki", "media", "\\u", "external", "\\u", "links_", ",_", "cache_", "=_", "cache_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "revision_", "._", "external", "\\u", "links_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revision_", "._", "external", "\\u", "links_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "wiki", "media", "\\u", "external", "\\u", "links_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wiki", "media", "\\u", "external", "\\u", "links_", ")_", "\\u\\u\\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", "tags_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "{_", "r", "\\u", "text_", ":_", "\"", "Thi", "s", " ", "is", " ", "[", "https", "://", "wiki", "s", ".", "com", "].", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"==", " ", "Head", "ing", "!", " ", "==", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "ref", ">", "Foo", "</", "ref", ">", " ", "the", " ", "<", "span", ">", "fooba", "r", "</", "span", ">", "!\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"==", "=", " ", "Ano", "ther", " ", "heading", "!", " ", "===", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "datasources", "_", "._", "tag", "\\u", "names_", ",_", "cache_", "=_", "cache_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "ref", "\"_", ",_", "\"", "span", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "tags_", ",_", "cache_", "=_", "cache_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "ref", "\\u", "tags_", ",_", "cache_", "=_", "cache_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "revision_", "._", "tags_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revision_", "._", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "revision_", "._", "ref", "\\u", "tags_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revision_", "._", "ref", "\\u", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "templates_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "{_", "r", "\\u", "text_", ":_", "\"", "Thi", "s", " ", "is", " ", "[", "https", "://", "wiki", "s", ".", "com", "].", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"==", " ", "Head", "ing", "!", " ", "==", "\\\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "ref", ">", "{{", "Cit", "e", " ", "thing", "}}", "</", "ref", ">", " ", "the", " ", "{{", "cit", "ation", " ", "need", "ed", "}}\\", "\\", "n", "\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"==", "=", " ", "Ano", "ther", " ", "{{", "heading", "|", "foo", "}}", "!", " ", "===", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "datasources", "_", "._", "template", "\\u", "names_", ",_", "cache_", "=_", "cache_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\"", "Cit", "e", " ", "thing", "\"_", ",_", "\"", "cit", "ation", " ", "need", "ed", "\"_", ",_", "\"", "heading", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "revision_", "._", "templates_", ",_", "cache_", "=_", "cache_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "solve_", "(_", "cite", "\\u", "templates_", ",_", "cache_", "=_", "cache_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "revision_", "._", "templates_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revision_", "._", "templates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "pickle_", "._", "loads_", "(_", "pickle_", "._", "dumps_", "(_", "cite", "\\u", "templates_", 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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 ]
Comparison of constants
rizar/attention-lvcsr/libs/Theano/theano/compile/tests/test_function_module.py
[ { "content": " def test_shared_state2(self):\n a = T.scalar() # the a is for 'anonymous' (un-named).\n x, s = T.scalars('xs')\n\n f = function([x, In(a, value=1.0, name='a'), In(s, value=0.0, update=s+a*x,\n mutable=False)], s+a*x)\n g = function([x, In(a, value=1.0, name='a'), In(s, value=f.container[s])], s+a*x)\n\n f(1, 2)\n self.assertTrue(f[s] == 2)\n self.assertTrue(g[s] == 2)\n f(1, 2)\n self.assertTrue(f[s] == 4)\n self.assertTrue(g[s] == 4)\n g(1, 2) # has no effect on state\n self.assertTrue(f[s] == 4)\n self.assertTrue(g[s] == 4)", "metadata": "root.T_function.test_shared_state2", "header": "['class', 'T_function', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 409 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "T", "\\u", "function_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "shared", "\\u", "state", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "T_", "._", "scalar_", "(_", ")_", "#", " ", "the", " ", "a", " ", "is", " ", "for", " ", "'", "anonym", "ous", "'", " ", "(", "un", "-", "named", ").", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "s_", "=_", "T_", "._", "scalars", "_", "(_", "'", "xs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "0.0_", ",_", "update_", "=_", "s_", "+_", "a_", "*_", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mutable", "_", "=_", "False_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "function_", "(_", "[_", "x_", ",_", "In_", "(_", "a_", ",_", "value_", "=_", "1.0_", ",_", "name_", "=_", "'", "a", "'_", ")_", ",_", "In_", "(_", "s_", ",_", "value_", "=_", "f_", "._", "container_", "[_", "s_", "]_", ")_", "]_", ",_", "s_", "+_", "a_", "*_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g_", "[_", "s_", "]_", "==_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g_", "[_", "s_", "]_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "(_", "1_", ",_", "2_", ")_", "#", " ", "has", " ", "no", " ", "effect", " ", "on", " ", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "f_", "[_", "s_", "]_", "==_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "g_", "[_", "s_", "]_", "==_", "4_", ")_", "\\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 ]
Unused import
nii-cloud/dodai-compute/nova/tests/test_exception.py
[ { "content": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2010 United States Government as represented by the\n# Administrator of the National Aeronautics and Space Administration.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nfrom nova import test\nfrom nova import exception\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ApiErrorTestCase(test.TestCase):", "metadata": "root.ApiErrorTestCase", "header": "['module', '___EOS___']", "index": 22 }, { "content": " def test_return_valid_error(self):\n # without 'code' arg\n err = exception.ApiError('fake error')\n self.assertEqual(err.__str__(), 'fake error')\n self.assertEqual(err.code, None)\n self.assertEqual(err.msg, 'fake error')\n # with 'code' arg\n err = exception.ApiError('fake error', 'blah code')\n self.assertEqual(err.__str__(), 'blah code: fake error')\n self.assertEqual(err.code, 'blah code')\n self.assertEqual(err.msg, 'fake error')", "metadata": "root.ApiErrorTestCase.test_return_valid_error", "header": "['class', 'ApiErrorTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": "class FakeNotifier(object):\n \"\"\"Acts like the nova.notifier.api module.\"\"\"\n ERROR = 88\n\n", "metadata": "root.FakeNotifier", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def __init__(self):\n self.provided_publisher = None\n self.provided_event = None\n self.provided_priority = None\n self.provided_payload = None", "metadata": "root.FakeNotifier.__init__", "header": "['class', 'FakeNotifier', '(', 'object', ')', ':', '___EOS___']", "index": 40 }, { "content": " def notify(self, publisher, event, priority, payload):\n self.provided_publisher = publisher\n self.provided_event = event\n self.provided_priority = priority\n self.provided_payload = payload", "metadata": "root.FakeNotifier.notify", "header": "['class', 'FakeNotifier', '(', 'object', ')', ':', '___EOS___']", "index": 46 }, { "content": "def good_function():\n return 99", "metadata": "root.good_function", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def bad_function_error():\n raise exception.Error()", "metadata": "root.bad_function_error", "header": "['module', '___EOS___']", "index": 57 }, { "content": "def bad_function_exception():\n raise Exception()", "metadata": "root.bad_function_exception", "header": "['module', '___EOS___']", "index": 61 }, { "content": "class WrapExceptionTestCase(test.TestCase):\n\n\n\n", "metadata": "root.WrapExceptionTestCase", "header": "['module', '___EOS___']", "index": 65 }, { "content": " def test_wrap_exception_good_return(self):\n wrapped = exception.wrap_exception()\n self.assertEquals(99, wrapped(good_function)())", "metadata": "root.WrapExceptionTestCase.test_wrap_exception_good_return", "header": "['class', 'WrapExceptionTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 66 }, { "content": " def test_wrap_exception_throws_error(self):\n wrapped = exception.wrap_exception()\n self.assertRaises(exception.Error, wrapped(bad_function_error))", "metadata": "root.WrapExceptionTestCase.test_wrap_exception_throws_error", "header": "['class', 'WrapExceptionTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def test_wrap_exception_throws_exception(self):\n wrapped = exception.wrap_exception()\n # Note that Exception is converted to Error ...\n self.assertRaises(exception.Error, wrapped(bad_function_exception))", "metadata": "root.WrapExceptionTestCase.test_wrap_exception_throws_exception", "header": "['class', 'WrapExceptionTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 74 }, { "content": " def test_wrap_exception_with_notifier(self):\n notifier = FakeNotifier()\n wrapped = exception.wrap_exception(notifier, \"publisher\", \"event\",\n \"level\")\n self.assertRaises(exception.Error, wrapped(bad_function_exception))\n self.assertEquals(notifier.provided_publisher, \"publisher\")\n self.assertEquals(notifier.provided_event, \"event\")\n self.assertEquals(notifier.provided_priority, \"level\")\n for key in ['exception', 'args']:\n self.assertTrue(key in notifier.provided_payload.keys())", "metadata": "root.WrapExceptionTestCase.test_wrap_exception_with_notifier", "header": "['class', 'WrapExceptionTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_wrap_exception_with_notifier_defaults(self):\n notifier = FakeNotifier()\n wrapped = exception.wrap_exception(notifier)\n self.assertRaises(exception.Error, wrapped(bad_function_exception))\n self.assertEquals(notifier.provided_publisher, None)\n self.assertEquals(notifier.provided_event, \"bad_function_exception\")\n self.assertEquals(notifier.provided_priority, notifier.ERROR)", "metadata": "root.WrapExceptionTestCase.test_wrap_exception_with_notifier_defaults", "header": "['class', 'WrapExceptionTestCase', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 90 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "vim", ":", " ", "tabs", "top", "=", "4", " ", "shift", "widt", "h", "=", "4", " ", "soft", "tabs", "top", "=", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", " ", "Unit", "ed", " ", "State", "s", " ", "Gov", "ern", "ment", " ", "as", " ", "represent", "ed", " ", "by", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Administra", "tor", " ", "of", " ", "the", " ", "Nat", "ional", " ", "Aer", "ona", "uti", "cs", " ", "and", " ", "Spac", "e", " ", "Administrati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nova_", "import_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Ap", "i", "Error", "Test", "Case_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ap", "i", "Error", "Test", "Case_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "return", "\\u", "valid", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "with", "out", " ", "'", "code", "'", " ", "arg_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "exception_", "._", "Ap", "i", "Error_", "(_", "'", "fake", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "err_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", ",_", "'", "fake", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "err_", "._", "code_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "err_", "._", "msg_", ",_", "'", "fake", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "with", " ", "'", "code", "'", " ", "arg_", "\\u\\u\\uNL\\u\\u\\u_", "err_", "=_", "exception_", "._", "Ap", "i", "Error_", "(_", "'", "fake", " ", "error", "'_", ",_", "'", "bla", "h", " ", "code", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "err_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", ",_", "'", "bla", "h", " ", "code", ":", " ", "fake", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "err_", "._", "code_", ",_", "'", "bla", "h", " ", "code", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "err_", "._", "msg_", ",_", "'", "fake", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Fake", "Notifier_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Act", "s", " ", "like", " ", "the", " ", "nova", ".", "notifier", ".", "api", " ", "module", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR_", "=_", "88_", "\\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_", "Fake", "Notifier_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "provided", "\\u", "publisher_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "provided", "\\u", "event_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "provided", "\\u", "priority_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "provided", "\\u", "payload_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Notifier_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "notify_", "(_", "self_", ",_", "publisher_", ",_", "event_", ",_", "priority_", ",_", "payload_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "provided", "\\u", "publisher_", "=_", "publisher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "provided", "\\u", "event_", "=_", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "provided", "\\u", "priority_", "=_", "priority_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "provided", "\\u", "payload_", "=_", "payload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "good", "\\u", "function_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "99_", "\\u\\u\\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_", "bad", "\\u", "function", "\\u", "error_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bad", "\\u", "function", "\\u", "exception_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Wra", "p", "Except", "ion", "Test", "Case_", "(_", "test_", "._", "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_", "Wra", "p", "Except", "ion", "Test", "Case_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "wrap", "\\u", "exception", "\\u", "good", "\\u", "return_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapped_", "=_", "exception_", "._", "wrap", "\\u", "exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "99_", ",_", "wrapped_", "(_", "good", "\\u", "function_", ")_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wra", "p", "Except", "ion", "Test", "Case_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wrap", "\\u", "exception", "\\u", "throw", "s", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapped_", "=_", "exception_", "._", "wrap", "\\u", "exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Error_", ",_", "wrapped_", "(_", "bad", "\\u", "function", "\\u", "error_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wra", "p", "Except", "ion", "Test", "Case_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wrap", "\\u", "exception", "\\u", "throw", "s", "\\u", "exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapped_", "=_", "exception_", "._", "wrap", "\\u", "exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "Except", "ion", " ", "is", " ", "convert", "ed", " ", "to", " ", "Error", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Error_", ",_", "wrapped_", "(_", "bad", "\\u", "function", "\\u", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wra", "p", "Except", "ion", "Test", "Case_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wrap", "\\u", "exception", "\\u", "with", "\\u", "notifier_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "notifier_", "=_", "Fake", "Notifier_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wrapped_", "=_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", ",_", "\"", "publi", "sher", "\"_", ",_", "\"", "event", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "level", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Error_", ",_", "wrapped_", "(_", "bad", "\\u", "function", "\\u", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "notifier_", "._", "provided", "\\u", "publisher_", ",_", "\"", "publi", "sher", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "notifier_", "._", "provided", "\\u", "event_", ",_", "\"", "event", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "notifier_", "._", "provided", "\\u", "priority_", ",_", "\"", "level", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "[_", "'", "exception", "'_", ",_", "'", "args", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "key_", "in_", "notifier_", "._", "provided", "\\u", "payload_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wra", "p", "Except", "ion", "Test", "Case_", "(_", "test_", "._", "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", "wrap", "\\u", "exception", "\\u", "with", "\\u", "notifier", "\\u", "defaults_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "notifier_", "=_", "Fake", "Notifier_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wrapped_", "=_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Error_", ",_", "wrapped_", "(_", "bad", "\\u", "function", "\\u", "exception_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "notifier_", "._", "provided", "\\u", "publisher_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "notifier_", "._", "provided", "\\u", "event_", ",_", "\"", "bad", "\\u", "function", "\\u", "exception", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "notifier_", "._", "provided", "\\u", "priority_", ",_", "notifier_", "._", "ERROR_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
datastax/python-driver/cassandra/cqlengine/statements.py
[ { "content": " def get_context(self):\n \"\"\"\n returns the context dict for this statement\n :rtype: dict\n \"\"\"\n ctx = {}\n for clause in self.where_clauses or []:\n clause.update_context(ctx)\n return ctx", "metadata": "root.BaseCQLStatement.get_context", "header": "['class', 'BaseCQLStatement', '(', 'UnicodeMixin', ')', ':', '___EOS___']", "index": 519 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Base", "CQ", "LS", "tate", "ment_", "(_", "Unic", "ode", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "the", " ", "context", " ", "dict", " ", "for", " ", "this", " ", "statem", "ent", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "clause_", "in_", "self_", "._", "where", "\\u", "clauses_", "or_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clause_", "._", "update", "\\u", "context_", "(_", "ctx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ctx_", "\\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 ]
Redundant comparison
openpreserve/fido/fido/prepare.py
[ { "content": "def calculate_repetition(char, pos, offset, maxoffset):\n \"\"\"\n Recursively calculates offset/maxoffset repetition,\n when one or both offsets is greater than 65535 bytes (64KB)\n see: bugs.python.org/issue13169\n Otherwise it returns the {offset,maxoffset}\n \"\"\"\n calcbuf = cStringIO.StringIO()\n \n calcremain = False\n offsetremain = 0\n maxoffsetremain = 0\n \n if offset != None and offset != '':\n if int(offset) > 65535:\n offsetremain = str(int(offset) - 65535)\n offset = '65535'\n calcremain = True\n if maxoffset != None and maxoffset != '':\n if int(maxoffset) > 65535:\n maxoffsetremain = str(int(maxoffset) - 65535)\n maxoffset = '65535'\n calcremain = True\n \n if pos == \"BOF\" or pos == \"EOF\":\n if offset != '0':\n calcbuf.write(char + '{' + str(offset))\n if maxoffset != None:\n calcbuf.write(',' + maxoffset)\n calcbuf.write('}')\n elif maxoffset != None:\n calcbuf.write(char + '{0,' + maxoffset + '}')\n\n if pos == \"IFB\":\n if offset != '0':\n calcbuf.write(char + '{' + str(offset))\n if maxoffset != None:\n calcbuf.write(',' + maxoffset)\n calcbuf.write('}')\n if maxoffset == None:\n calcbuf.write(',}')\n elif maxoffset != None:\n calcbuf.write(char + '{0,' + maxoffset + '}')\n\n if calcremain: # recursion happens here\n calcbuf.write(calculate_repetition(char, pos, offsetremain, maxoffsetremain))\n \n val = calcbuf.getvalue()\n calcbuf.close()\n return val", "metadata": "root.calculate_repetition", "header": "['module', '___EOS___']", "index": 346 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calcul", "ate", "\\u", "repetition", "_", "(_", "char_", ",_", "pos_", ",_", "offset_", ",_", "max", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Recursive", "ly", " ", "calcul", "ates", " ", "offset", "/", "max", "offset", " ", "repetition", ",", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "one", " ", "or", " ", "bot", "h", " ", "offset", "s", " ", "is", " ", "great", "er", " ", "than", " ", "6553", "5", " ", "bytes", " ", "(", "64", "KB", ")", "\\", "10", ";", " ", " ", " ", " ", "see", ":", " ", "bug", "s", ".", "python", ".", "org", "/", "issue", "131", "6", "9", "\\", "10", ";", " ", " ", " ", " ", "Ot", "her", "wis", "e", " ", "it", " ", "return", "s", " ", "the", " ", "{", "offset", ",", "max", "offset", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calc", "buf_", "=_", "c", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "calc", "remain_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset", "remain_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "offset", "remain_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "offset_", "!=_", "None_", "and_", "offset_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "offset_", ")_", ">_", "65535_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "offset", "remain_", "=_", "str_", "(_", "int_", "(_", "offset_", ")_", "-_", "65535_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "=_", "'", "6553", "5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calc", "remain_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "max", "offset_", "!=_", "None_", "and_", "max", "offset_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "max", "offset_", ")_", ">_", "65535_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "offset", "remain_", "=_", "str_", "(_", "int_", "(_", "max", "offset_", ")_", "-_", "65535_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "offset_", "=_", "'", "6553", "5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calc", "remain_", "=_", "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_", "pos_", "==_", "\"", "BO", "F", "\"_", "or_", "pos_", "==_", "\"", "EO", "F", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "offset_", "!=_", "'", "0", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calc", "buf_", "._", "write_", "(_", "char_", "+_", "'{'_", "+_", "str_", "(_", "offset_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "offset_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calc", "buf_", "._", "write_", "(_", "','_", "+_", "max", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "calc", "buf_", "._", "write_", "(_", "'}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "max", "offset_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calc", "buf_", "._", "write_", "(_", "char_", "+_", "'{", "0", ",'_", "+_", "max", "offset_", "+_", "'}'_", ")_", "\\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_", "pos_", "==_", "\"", "IF", "B", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "offset_", "!=_", "'", "0", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calc", "buf_", "._", "write_", "(_", "char_", "+_", "'{'_", "+_", "str_", "(_", "offset_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "offset_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calc", "buf_", "._", "write_", "(_", "','_", "+_", "max", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "calc", "buf_", "._", "write_", "(_", "'}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "offset_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calc", "buf_", "._", "write_", "(_", "',", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "max", "offset_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calc", "buf_", "._", "write_", "(_", "char_", "+_", "'{", "0", ",'_", "+_", "max", "offset_", "+_", "'}'_", ")_", "\\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_", "calc", "remain_", ":_", "#", " ", "recursion", " ", "happ", "ens", " ", "here_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calc", "buf_", "._", "write_", "(_", "calcul", "ate", "\\u", "repetition", "_", "(_", "char_", ",_", "pos_", ",_", "offset", "remain_", ",_", "max", "offset", "remain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "=_", "calc", "buf_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calc", "buf_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "val_", "\\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, 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MAP4\n IMAP4_SSL\n IMAP4_stream\n\nPublic functions: Internaldate2Time\n ParseFlags\n Time2Internaldate\n\"\"\"\n\n\n__all__ = (\"IMAP4\", \"IMAP4_SSL\", \"IMAP4_stream\",\n \"Internaldate2Time\", \"ParseFlags\", \"Time2Internaldate\")\n\n__version__ = \"3.00\"\n__release__ = \"3\"\n__revision__ = \"00\"\n__credits__ = \"\"\"\nAuthentication code contributed by Donn Cave <[email protected]> June 1998.\nString method conversion by ESR, February 2001.\nGET/SETACL contributed by Anthony Baxter <[email protected]> April 2001.\nIMAP4_SSL contributed by Tino Lange <[email protected]> March 2002.\nGET/SETQUOTA contributed by Andreas Zeidler <[email protected]> June 2002.\nPROXYAUTH contributed by Rick Holbert <[email protected]> November 2002.\nIDLE via threads suggested by Philippe Normand <[email protected]> January 2005.\nGET/SETANNOTATION contributed by Tomas Lindroos <[email protected]> June 2005.\nCOMPRESS/DEFLATE contributed by Bron Gondwana <[email protected]> May 2009.\nSTARTTLS from Jython's imaplib by Alan Kennedy.\nID contributed by Dave Baggett <[email protected]> November 2009.\nImproved untagged responses handling suggested by Dave Baggett <[email protected]> November 2009.\nImproved thread naming, and 0 read detection contributed by Grant Edwards <[email protected]> June 2010.\nImproved timeout handling contributed by Ivan Vovnenko <[email protected]> October 2010.\nTimeout handling further improved by Ethan Glasser-Camp <[email protected]> December 2010.\nTime2Internaldate() patch to match RFC2060 specification of English month names from bugs.python.org/issue11024 March 2011.\nstarttls() bug fixed with the help of Sebastian Spaeth <[email protected]> April 2011.\nThreads now set the \"daemon\" flag (suggested by offlineimap-project) April 2011.\nSingle quoting introduced with the help of Vladimir Marek <[email protected]> August 2011.\nSupport for specifying SSL version by Ryan Kavanagh <[email protected]> July 2013.\nFix for gmail \"read 0\" error provided by Jim Greenleaf <[email protected]> August 2013.\nFix for offlineimap \"indexerror: string index out of range\" bug provided by Eygene Ryabinkin <[email protected]> August 2013.\nFix for missing idle_lock in _handler() provided by Franklin Brook <[email protected]> August 2014.\nConversion to Python3 provided by F. Malina <[email protected]> February 2015.\nFix for READ-ONLY error from multiple EXAMINE/SELECT calls by Pierre-Louis Bonicoli <[email protected]> March 2015.\nFix for null strings appended to untagged responses by Pierre-Louis Bonicoli <[email protected]> March 2015.\nFix for correct byte encoding for _CRAM_MD5_AUTH taken from python3.5 imaplib.py June 2015.\nFix for correct Python 3 exception handling by Tobias Brink <[email protected]> August 2015.\nFix to allow interruptible IDLE command by Tim Peoples <[email protected]> September 2015.\nAdd support for TLS levels by Ben Boeckel <[email protected]> September 2015.\"\"\"\n__author__ = \"Piers Lauder <[email protected]>\"\n__URL__ = \"http://imaplib2.sourceforge.net\"\n__license__ = \"Python License\"\n\nimport binascii, calendar, errno, os, queue, random, re, select, socket, sys, time, threading, zlib\n\n\nselect_module = select\n\n# Globals\n\nCRLF = b'\\r\\n'\nIMAP4_PORT = 143\nIMAP4_SSL_PORT = 993\n\nIDLE_TIMEOUT_RESPONSE = b'* IDLE TIMEOUT\\r\\n'\nIDLE_TIMEOUT = 60*29 # Don't stay in IDLE state longer\nREAD_POLL_TIMEOUT = 30 # Without this timeout interrupted network connections can hang reader\nREAD_SIZE = 32768 # Consume all available in socket\n\nDFLT_DEBUG_BUF_LVL = 3 # Level above which the logging output goes directly to stderr\n\nTLS_SECURE = \"tls_secure\" # Recognised TLS levels\nTLS_NO_SSL = \"tls_no_ssl\"\nTLS_COMPAT = \"tls_compat\"\n\nAllowedVersions = ('IMAP4REV1', 'IMAP4') # Most recent first\n\n# Commands\n\nCMD_VAL_STATES = 0\nCMD_VAL_ASYNC = 1\nNONAUTH, AUTH, SELECTED, LOGOUT = 'NONAUTH', 'AUTH', 'SELECTED', 'LOGOUT'\n\nCommands = {\n # name valid states asynchronous\n 'APPEND': ((AUTH, SELECTED), False),\n 'AUTHENTICATE': ((NONAUTH,), False),\n 'CAPABILITY': ((NONAUTH, AUTH, SELECTED), True),\n 'CHECK': ((SELECTED,), True),\n 'CLOSE': ((SELECTED,), False),\n 'COMPRESS': ((AUTH,), False),\n 'COPY': ((SELECTED,), True),\n 'CREATE': ((AUTH, SELECTED), True),\n 'DELETE': ((AUTH, SELECTED), True),\n 'DELETEACL': ((AUTH, SELECTED), True),\n 'EXAMINE': ((AUTH, SELECTED), False),\n 'EXPUNGE': ((SELECTED,), True),\n 'FETCH': ((SELECTED,), True),\n 'GETACL': ((AUTH, SELECTED), True),\n 'GETANNOTATION':((AUTH, SELECTED), True),\n 'GETQUOTA': ((AUTH, SELECTED), True),\n 'GETQUOTAROOT': ((AUTH, SELECTED), True),\n 'ID': ((NONAUTH, AUTH, LOGOUT, SELECTED), True),\n 'IDLE': ((SELECTED,), False),\n 'LIST': ((AUTH, SELECTED), True),\n 'LOGIN': ((NONAUTH,), False),\n 'LOGOUT': ((NONAUTH, AUTH, LOGOUT, SELECTED), False),\n 'LSUB': ((AUTH, SELECTED), True),\n 'MYRIGHTS': ((AUTH, SELECTED), True),\n 'NAMESPACE': ((AUTH, SELECTED), True),\n 'NOOP': ((NONAUTH, AUTH, SELECTED), True),\n 'PARTIAL': ((SELECTED,), True),\n 'PROXYAUTH': ((AUTH,), False),\n 'RENAME': ((AUTH, SELECTED), True),\n 'SEARCH': ((SELECTED,), True),\n 'SELECT': ((AUTH, SELECTED), False),\n 'SETACL': ((AUTH, SELECTED), False),\n 'SETANNOTATION':((AUTH, SELECTED), True),\n 'SETQUOTA': ((AUTH, SELECTED), False),\n 'SORT': ((SELECTED,), True),\n 'STARTTLS': ((NONAUTH,), False),\n 'STATUS': ((AUTH, SELECTED), True),\n 'STORE': ((SELECTED,), True),\n 'SUBSCRIBE': ((AUTH, SELECTED), False),\n 'THREAD': ((SELECTED,), True),\n 'UID': ((SELECTED,), True),\n 'UNSUBSCRIBE': ((AUTH, SELECTED), False),\n }\n\nUID_direct = ('SEARCH', 'SORT', 'THREAD')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nMonthNames = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',\n 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\n\nMon2num = {s.encode():n+1 for n, s in enumerate(MonthNames[1:])}\n\nInternalDate = re.compile(br'.*INTERNALDATE \"'\n br'(?P<day>[ 0123][0-9])-(?P<mon>[A-Z][a-z][a-z])-(?P<year>[0-9][0-9][0-9][0-9])'\n br' (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9])'\n br' (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])'\n br'\"')\n\n\n\nInternaldate2tuple = Internaldate2Time # (Backward compatible)\n\n\n\n\n\n\nFLAGS_cre = re.compile(br'.*FLAGS \\((?P<flags>[^\\)]*)\\)')\n\n\n\n\nif __name__ == '__main__':\n\n # To test: invoke either as 'python imaplib2.py [IMAP4_server_hostname]',\n # or as 'python imaplib2.py -s \"rsh IMAP4_server_hostname exec /etc/rimapd\"'\n # or as 'python imaplib2.py -l keyfile[:certfile]|: [IMAP4_SSL_server_hostname]'\n #\n # Option \"-d <level>\" turns on debugging (use \"-d 5\" for everything)\n # Option \"-i\" tests that IDLE is interruptible\n # Option \"-p <port>\" allows alternate ports\n\n if not __debug__:\n raise ValueError('Please run without -O')\n\n import getopt, getpass\n\n try:\n optlist, args = getopt.getopt(sys.argv[1:], 'd:il:s:p:')\n except getopt.error as val:\n optlist, args = (), ()\n\n debug, debug_buf_lvl, port, stream_command, keyfile, certfile, idle_intr = (None,)*7\n for opt,val in optlist:\n if opt == '-d':\n debug = int(val)\n debug_buf_lvl = debug - 1\n elif opt == '-i':\n idle_intr = 1\n elif opt == '-l':\n try:\n keyfile,certfile = val.split(':')\n except ValueError:\n keyfile,certfile = val,val\n elif opt == '-p':\n port = int(val)\n elif opt == '-s':\n stream_command = val\n if not args: args = (stream_command,)\n\n if not args: args = ('',)\n if not port: port = (keyfile is not None) and IMAP4_SSL_PORT or IMAP4_PORT\n\n host = args[0]\n\n USER = getpass.getuser()\n\n data = open(os.path.exists(\"test.data\") and \"test.data\" or __file__).read(1000)\n test_mesg = 'From: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)s%(data)s' \\\n % {'user':USER, 'lf':'\\n', 'data':data}\n\n test_seq1 = [\n ('list', ('\"\"', '\"\"')),\n ('list', ('\"\"', '\"%\"')),\n ('create', ('imaplib2_test0',)),\n ('rename', ('imaplib2_test0', 'imaplib2_test1')),\n ('CREATE', ('imaplib2_test2',)),\n ('append', ('imaplib2_test2', None, None, test_mesg)),\n ('list', ('\"\"', '\"imaplib2_test%\"')),\n ('select', ('imaplib2_test2',)),\n ('search', (None, 'SUBJECT', '\"IMAP4 test\"')),\n ('fetch', ('1:*', '(FLAGS INTERNALDATE RFC822)')),\n ('store', ('1', 'FLAGS', '(\\Deleted)')),\n ('namespace', ()),\n ('expunge', ()),\n ('recent', ()),\n ('close', ()),\n ]\n\n test_seq2 = (\n ('select', ()),\n ('response', ('UIDVALIDITY',)),\n ('response', ('EXISTS',)),\n ('append', (None, None, None, test_mesg)),\n ('examine', ()),\n ('select', ()),\n ('fetch', ('1:*', '(FLAGS UID)')),\n ('examine', ()),\n ('select', ()),\n ('uid', ('SEARCH', 'SUBJECT', '\"IMAP4 test\"')),\n ('uid', ('SEARCH', 'ALL')),\n ('uid', ('THREAD', 'references', 'UTF-8', '(SEEN)')),\n ('recent', ()),\n )\n\n\n AsyncError, M = None, None\n\n\n\n try:\n threading.currentThread().setName('main')\n\n if keyfile is not None:\n if not keyfile: keyfile = None\n if not certfile: certfile = None\n M = IMAP4_SSL(host=host, port=port, keyfile=keyfile, certfile=certfile, ssl_version=\"tls1\", debug=debug, identifier='', timeout=10, debug_buf_lvl=debug_buf_lvl, tls_level=\"tls_no_ssl\")\n elif stream_command:\n M = IMAP4_stream(stream_command, debug=debug, identifier='', timeout=10, debug_buf_lvl=debug_buf_lvl)\n else:\n M = IMAP4(host=host, port=port, debug=debug, identifier='', timeout=10, debug_buf_lvl=debug_buf_lvl)\n if M.state != 'AUTH': # Login needed\n PASSWD = getpass.getpass(\"IMAP password for %s on %s: \" % (USER, host or \"localhost\"))\n test_seq1.insert(0, ('login', (USER, PASSWD)))\n M._log(0, 'PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION)\n if 'COMPRESS=DEFLATE' in M.capabilities:\n M.enable_compression()\n\n for cmd,args in test_seq1:\n run(cmd, args)\n\n for ml in run('list', ('\"\"', '\"imaplib2_test%\"'), cb=False):\n mo = re.match(br'.*\"([^\"]+)\"$', ml)\n if mo: path = mo.group(1)\n else: path = ml.split()[-1]\n run('delete', (path,))\n\n if 'ID' in M.capabilities:\n run('id', ())\n run('id', (\"(name imaplib2)\",))\n run('id', (\"version\", __version__, \"os\", os.uname()[0]))\n \n for cmd,args in test_seq2:\n if (cmd,args) != ('uid', ('SEARCH', 'SUBJECT', 'IMAP4 test')):\n run(cmd, args)\n continue\n\n dat = run(cmd, args, cb=False)\n uid = dat[-1].split()\n if not uid: continue\n run('uid', ('FETCH', uid[-1],\n '(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)'))\n run('uid', ('STORE', uid[-1], 'FLAGS', '(\\Deleted)'))\n run('expunge', ())\n\n if 'IDLE' in M.capabilities:\n run('idle', (2,), cb=False)\n run('idle', (99,)) # Asynchronous, to test interruption of 'idle' by 'noop'\n time.sleep(1)\n run('noop', (), cb=False)\n\n run('append', (None, None, None, test_mesg), cb=False)\n num = run('search', (None, 'ALL'), cb=False)[0].split()[0]\n dat = run('fetch', (num, '(FLAGS INTERNALDATE RFC822)'), cb=False)\n M._mesg('fetch %s => %s' % (num, repr(dat)))\n run('idle', (2,))\n run('store', (num, '-FLAGS', '(\\Seen)'), cb=False),\n dat = run('fetch', (num, '(FLAGS INTERNALDATE RFC822)'), cb=False)\n M._mesg('fetch %s => %s' % (num, repr(dat)))\n run('uid', ('STORE', num, 'FLAGS', '(\\Deleted)'))\n run('expunge', ())\n if idle_intr:\n M._mesg('HIT CTRL-C to interrupt IDLE')\n try:\n run('idle', (99,), cb=False) # Synchronous, to test interruption of 'idle' by INTR\n except KeyboardInterrupt:\n M._mesg('Thanks!')\n M._mesg('')\n raise\n elif idle_intr:\n M._mesg('chosen server does not report IDLE capability')\n\n run('logout', (), cb=False)\n\n if debug:\n M._mesg('')\n M._print_log()\n M._mesg('')\n M._mesg('unused untagged responses in order, most recent last:')\n for typ,dat in M.pop_untagged_responses(): M._mesg('\\t%s %s' % (typ, dat))\n\n print('All tests OK.')\n\n except:\n if not idle_intr or M is None or not 'IDLE' in M.capabilities:\n print('Tests failed.')\n\n if not debug:\n print('''\nIf you would like to see debugging output,\ntry: %s -d5\n''' % sys.argv[0])\n\n raise\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def Int2AP(num):\n\n \"\"\"string = Int2AP(num)\n Return 'num' converted to bytes using characters from the set 'A'..'P'\n \"\"\"\n\n val = b''; AP = b'ABCDEFGHIJKLMNOP'\n num = int(abs(num))\n while num:\n num, mod = divmod(num, 16)\n val = AP[mod:mod+1] + val\n return val", "metadata": "root.Int2AP", "header": "['module', '___EOS___']", "index": 136 }, { "content": "class Request(object):\n\n \"\"\"Private class to represent a request awaiting response.\"\"\"\n\n\n\n\n\n\n", "metadata": "root.Request", "header": "['module', '___EOS___']", "index": 151 }, { "content": " def __init__(self, parent, name=None, callback=None, cb_arg=None, cb_self=False):\n self.parent = parent\n self.name = name\n self.callback = callback # Function called to process result\n if not cb_self:\n self.callback_arg = cb_arg # Optional arg passed to \"callback\"\n else:\n self.callback_arg = (self, cb_arg) # Self reference required in callback arg\n\n self.tag = parent.tagpre + bytes(str(parent.tagnum), 'ASCII')\n parent.tagnum += 1\n\n self.ready = threading.Event()\n self.response = None\n self.aborted = None\n self.data = None", "metadata": "root.Request.__init__", "header": "['class', 'Request', '(', 'object', ')', ':', '___EOS___']", "index": 155 }, { "content": " def abort(self, typ, val):\n self.aborted = (typ, val)\n self.deliver(None)", "metadata": "root.Request.abort", "header": "['class', 'Request', '(', 'object', ')', ':', '___EOS___']", "index": 173 }, { "content": " def get_response(self, exc_fmt=None):\n self.callback = None\n if __debug__: self.parent._log(3, '%s:%s.ready.wait' % (self.name, self.tag))\n self.ready.wait(threading.TIMEOUT_MAX)\n\n if self.aborted is not None:\n typ, val = self.aborted\n if exc_fmt is None:\n exc_fmt = '%s - %%s' % typ\n raise typ(exc_fmt % str(val))\n\n return self.response", "metadata": "root.Request.get_response", "header": "['class', 'Request', '(', 'object', ')', ':', '___EOS___']", "index": 178 }, { "content": " def deliver(self, response):\n if self.callback is not None:\n self.callback((response, self.callback_arg, self.aborted))\n return\n\n self.response = response\n self.ready.set()\n if __debug__: self.parent._log(3, '%s:%s.ready.set' % (self.name, self.tag))", "metadata": "root.Request.deliver", "header": "['class', 'Request', '(', 'object', ')', ':', '___EOS___']", "index": 192 }, { "content": "class IMAP4(object):\n\n \"\"\"Threaded IMAP4 client class.\n\n Instantiate with:\n IMAP4(host=None, port=None, debug=None, debug_file=None, identifier=None, timeout=None, debug_buf_lvl=None)\n\n host - host's name (default: localhost);\n port - port number (default: standard IMAP4 port);\n debug - debug level (default: 0 - no debug);\n debug_file - debug stream (default: sys.stderr);\n identifier - thread identifier prefix (default: host);\n timeout - timeout in seconds when expecting a command response (default: no timeout),\n debug_buf_lvl - debug level at which buffering is turned off.\n\n All IMAP4rev1 commands are supported by methods of the same name.\n\n Each command returns a tuple: (type, [data, ...]) where 'type'\n is usually 'OK' or 'NO', and 'data' is either the text from the\n tagged response, or untagged results from command. Each 'data' is\n either a string, or a tuple. If a tuple, then the first part is the\n header of the response, and the second part contains the data (ie:\n 'literal' value).\n\n Errors raise the exception class <instance>.error(\"<reason>\").\n IMAP4 server errors raise <instance>.abort(\"<reason>\"), which is\n a sub-class of 'error'. Mailbox status changes from READ-WRITE to\n READ-ONLY raise the exception class <instance>.readonly(\"<reason>\"),\n which is a sub-class of 'abort'.\n\n \"error\" exceptions imply a program error.\n \"abort\" exceptions imply the connection should be reset, and\n the command re-tried.\n \"readonly\" exceptions imply the command should be re-tried.\n\n All commands take two optional named arguments:\n 'callback' and 'cb_arg'\n If 'callback' is provided then the command is asynchronous, so after\n the command is queued for transmission, the call returns immediately\n with the tuple (None, None).\n The result will be posted by invoking \"callback\" with one arg, a tuple:\n callback((result, cb_arg, None))\n or, if there was a problem:\n callback((None, cb_arg, (exception class, reason)))\n\n Otherwise the command is synchronous (waits for result). But note\n that state-changing commands will both block until previous commands\n have completed, and block subsequent commands until they have finished.\n\n All (non-callback) string arguments to commands are converted to bytes,\n except for AUTHENTICATE, and the last argument to APPEND which is\n passed as an IMAP4 literal. NB: the 'password' argument to the LOGIN\n command is always quoted.\n\n There is one instance variable, 'state', that is useful for tracking\n whether the client needs to login to the server. If it has the\n value \"AUTH\" after instantiating the class, then the connection\n is pre-authenticated (otherwise it will be \"NONAUTH\"). Selecting a\n mailbox changes the state to be \"SELECTED\", closing a mailbox changes\n back to \"AUTH\", and once the client has logged out, the state changes\n to \"LOGOUT\" and no further commands may be issued.\n\n Note: to use this module, you must read the RFCs pertaining to the\n IMAP4 protocol, as the semantics of the arguments to each IMAP4\n command are left to the invoker, not to mention the results. Also,\n most IMAP servers implement a sub-set of the commands available here.\n\n Note also that you must call logout() to shut down threads before\n discarding an instance.\n \"\"\"\n\n class error(Exception): pass # Logical errors - debug required\n class abort(error): pass # Service errors - close and retry\n class readonly(abort): pass # Mailbox status changed to READ-ONLY\n\n\n continuation_cre = re.compile(br'\\+( (?P<data>.*))?')\n literal_cre = re.compile(br'.*{(?P<size>\\d+)}$')\n mapCRLF_cre = re.compile(br'\\r\\n|\\r|\\n')\n # Need to quote \"atom-specials\" :-\n # \"(\" / \")\" / \"{\" / SP / 0x00 - 0x1f / 0x7f / \"%\" / \"*\" / DQUOTE / \"\\\" / \"]\"\n # so match not the inverse set\n response_code_cre = re.compile(br'\\[(?P<type>[A-Z-]+)( (?P<data>[^\\]]*))?\\]')\n untagged_response_cre = re.compile(br'\\* (?P<type>[A-Z-]+)( (?P<data>.*))?')\n untagged_status_cre = re.compile(br'\\* (?P<data>\\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?')\n\n\n\n\n\n\n\n # Overridable methods\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # Utility methods\n\n\n\n\n\n\n\n\n\n\n\n\n # IMAP4 commands\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # Internal methods\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # Threads\n\n\n\n\n\n\n if hasattr(select_module, \"poll\"):\n\n\n else:\n\n # No \"poll\" - use select()\n\n\n\n\n\n\n # Debugging\n\n\n if __debug__:\n\n\n\n\n\n\n\n\n", "metadata": "root.IMAP4", "header": "['module', '___EOS___']", "index": 204 }, { "content": " def __init__(self, host=None, port=None, debug=None, debug_file=None, identifier=None, timeout=None, debug_buf_lvl=None):\n\n self.state = NONAUTH # IMAP4 protocol state\n self.literal = None # A literal argument to a command\n self.tagged_commands = {} # Tagged commands awaiting response\n self.untagged_responses = [] # [[typ: [data, ...]], ...]\n self.mailbox = None # Current mailbox selected\n self.is_readonly = False # READ-ONLY desired state\n self.idle_rqb = None # Server IDLE Request - see _IdleCont\n self.idle_timeout = None # Must prod server occasionally\n\n self._expecting_data = False # Expecting message data\n self._expecting_data_len = 0 # How many characters we expect\n self._accumulated_data = [] # Message data accumulated so far\n self._literal_expected = None # Message data descriptor\n\n self.compressor = None # COMPRESS/DEFLATE if not None\n self.decompressor = None\n self._tls_established = False\n\n # Create unique tag for this session,\n # and compile tagged response matcher.\n\n self.tagnum = 0\n self.tagpre = Int2AP(random.randint(4096, 65535))\n self.tagre = re.compile(br'(?P<tag>'\n + self.tagpre\n + br'\\d+) (?P<type>[A-Z]+) (?P<data>.*)', re.ASCII)\n\n if __debug__: self._init_debug(debug, debug_file, debug_buf_lvl)\n\n self.resp_timeout = timeout # Timeout waiting for command response\n\n if timeout is not None and timeout < READ_POLL_TIMEOUT:\n self.read_poll_timeout = timeout\n else:\n self.read_poll_timeout = READ_POLL_TIMEOUT\n self.read_size = READ_SIZE\n\n # Open socket to server.\n\n self.open(host, port)\n\n if __debug__:\n if debug:\n self._mesg('connected to %s on port %s' % (self.host, self.port))\n\n # Threading\n\n if identifier is not None:\n self.identifier = identifier\n else:\n self.identifier = self.host\n if self.identifier:\n self.identifier += ' '\n\n self.Terminate = self.TerminateReader = False\n\n self.state_change_free = threading.Event()\n self.state_change_pending = threading.Lock()\n self.commands_lock = threading.Lock()\n self.idle_lock = threading.Lock()\n\n self.ouq = queue.Queue(10)\n self.inq = queue.Queue()\n\n self.wrth = threading.Thread(target=self._writer)\n self.wrth.setDaemon(True)\n self.wrth.start()\n self.rdth = threading.Thread(target=self._reader)\n self.rdth.setDaemon(True)\n self.rdth.start()\n self.inth = threading.Thread(target=self._handler)\n self.inth.setDaemon(True)\n self.inth.start()\n\n # Get server welcome message,\n # request and store CAPABILITY response.\n\n try:\n self.welcome = self._request_push(name='welcome', tag='continuation').get_response('IMAP4 protocol error: %s')[1]\n\n if self._get_untagged_response('PREAUTH'):\n self.state = AUTH\n if __debug__: self._log(1, 'state => AUTH')\n elif self._get_untagged_response('OK'):\n if __debug__: self._log(1, 'state => NONAUTH')\n else:\n raise self.error('unrecognised server welcome message: %s' % repr(self.welcome))\n\n self._get_capabilities()\n if __debug__: self._log(1, 'CAPABILITY: %r' % (self.capabilities,))\n\n for version in AllowedVersions:\n if not version in self.capabilities:\n continue\n self.PROTOCOL_VERSION = version\n break\n else:\n raise self.error('server not IMAP4 compliant')\n except:\n self._close_threads()\n raise", "metadata": "root.IMAP4.__init__", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 291 }, { "content": " def __getattr__(self, attr):\n # Allow UPPERCASE variants of IMAP4 command methods.\n if attr in Commands:\n return getattr(self, attr.lower())\n raise AttributeError(\"Unknown IMAP4 command: '%s'\" % attr)", "metadata": "root.IMAP4.__getattr__", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 396 }, { "content": " def open(self, host=None, port=None):\n \"\"\"open(host=None, port=None)\n Setup connection to remote server on \"host:port\"\n (default: localhost:standard IMAP4 port).\n This connection will be used by the routines:\n read, send, shutdown, socket.\"\"\"\n\n self.host = self._choose_nonull_or_dflt('', host)\n self.port = self._choose_nonull_or_dflt(IMAP4_PORT, port)\n self.sock = self.open_socket()\n self.read_fd = self.sock.fileno()", "metadata": "root.IMAP4.open", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 407 }, { "content": " def open_socket(self):\n \"\"\"open_socket()\n Open socket choosing first address family available.\"\"\"\n\n return socket.create_connection((self.host, self.port))", "metadata": "root.IMAP4.open_socket", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 420 }, { "content": " def ssl_wrap_socket(self):\n\n try:\n import ssl\n\n TLS_MAP = {}\n if hasattr(ssl, \"PROTOCOL_TLSv1_2\"): # py3\n TLS_MAP[TLS_SECURE] = {\n \"tls1_2\": ssl.PROTOCOL_TLSv1_2,\n \"tls1_1\": ssl.PROTOCOL_TLSv1_1,\n }\n else:\n TLS_MAP[TLS_SECURE] = {}\n TLS_MAP[TLS_NO_SSL] = TLS_MAP[TLS_SECURE].copy()\n TLS_MAP[TLS_NO_SSL].update({\n \"tls1\": ssl.PROTOCOL_TLSv1,\n })\n TLS_MAP[TLS_COMPAT] = TLS_MAP[TLS_NO_SSL].copy()\n TLS_MAP[TLS_COMPAT].update({\n \"ssl23\": ssl.PROTOCOL_SSLv23,\n None: ssl.PROTOCOL_SSLv23,\n })\n if hasattr(ssl, \"PROTOCOL_SSLv3\"): # Might not be available.\n TLS_MAP[TLS_COMPAT].update({\n \"ssl3\": ssl.PROTOCOL_SSLv3\n })\n\n if self.ca_certs is not None:\n cert_reqs = ssl.CERT_REQUIRED\n else:\n cert_reqs = ssl.CERT_NONE\n\n if self.tls_level not in TLS_MAP:\n raise RuntimeError(\"unknown tls_level: %s\" % self.tls_level)\n\n if self.ssl_version not in TLS_MAP[self.tls_level]:\n raise socket.sslerror(\"Invalid SSL version '%s' requested for tls_version '%s'\" % (self.ssl_version, self.tls_level))\n\n ssl_version = TLS_MAP[self.tls_level][self.ssl_version]\n\n self.sock = ssl.wrap_socket(self.sock, self.keyfile, self.certfile, ca_certs=self.ca_certs, cert_reqs=cert_reqs, ssl_version=ssl_version)\n ssl_exc = ssl.SSLError\n self.read_fd = self.sock.fileno()\n except ImportError:\n # No ssl module, and socket.ssl has no fileno(), and does not allow certificate verification\n raise socket.sslerror(\"imaplib SSL mode does not work without ssl module\")\n\n if self.cert_verify_cb is not None:\n cert_err = self.cert_verify_cb(self.sock.getpeercert(), self.host)\n if cert_err:\n raise ssl_exc(cert_err)\n\n # Allow sending of keep-alive messages - seems to prevent some servers\n # from closing SSL, leading to deadlocks.\n self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)", "metadata": "root.IMAP4.ssl_wrap_socket", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 427 }, { "content": " def start_compressing(self):\n \"\"\"start_compressing()\n Enable deflate compression on the socket (RFC 4978).\"\"\"\n\n # rfc 1951 - pure DEFLATE, so use -15 for both windows\n self.decompressor = zlib.decompressobj(-15)\n self.compressor = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -15)", "metadata": "root.IMAP4.start_compressing", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 485 }, { "content": " def read(self, size):\n \"\"\"data = read(size)\n Read at most 'size' bytes from remote.\"\"\"\n\n if self.decompressor is None:\n return self.sock.recv(size)\n\n if self.decompressor.unconsumed_tail:\n data = self.decompressor.unconsumed_tail\n else:\n data = self.sock.recv(READ_SIZE)\n\n return self.decompressor.decompress(data, size)", "metadata": "root.IMAP4.read", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 494 }, { "content": " def send(self, data):\n \"\"\"send(data)\n Send 'data' to remote.\"\"\"\n\n if self.compressor is not None:\n data = self.compressor.compress(data)\n data += self.compressor.flush(zlib.Z_SYNC_FLUSH)\n\n self.sock.sendall(data)", "metadata": "root.IMAP4.send", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 509 }, { "content": " def shutdown(self):\n \"\"\"shutdown()\n Close I/O established in \"open\".\"\"\"\n\n try:\n self.sock.shutdown(socket.SHUT_RDWR)\n except OSError as e:\n # The server might already have closed the connection\n if e.errno != errno.ENOTCONN:\n raise\n finally:\n self.sock.close()", "metadata": "root.IMAP4.shutdown", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 520 }, { "content": " def socket(self):\n \"\"\"socket = socket()\n Return socket instance used to connect to IMAP4 server.\"\"\"\n\n return self.sock", "metadata": "root.IMAP4.socket", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 534 }, { "content": " def enable_compression(self):\n \"\"\"enable_compression()\n Ask the server to start compressing the connection.\n Should be called from user of this class after instantiation, as in:\n if 'COMPRESS=DEFLATE' in imapobj.capabilities:\n imapobj.enable_compression()\"\"\"\n\n try:\n typ, dat = self._simple_command('COMPRESS', 'DEFLATE')\n if typ == 'OK':\n self.start_compressing()\n if __debug__: self._log(1, 'Enabled COMPRESS=DEFLATE')\n finally:\n self._release_state_change()", "metadata": "root.IMAP4.enable_compression", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 545 }, { "content": " def pop_untagged_responses(self):\n \"\"\" for typ,data in pop_untagged_responses(): pass\n Generator for any remaining untagged responses.\n Returns and removes untagged responses in order of reception.\n Use at your own risk!\"\"\"\n\n while self.untagged_responses:\n self.commands_lock.acquire()\n try:\n yield self.untagged_responses.pop(0)\n finally:\n self.commands_lock.release()", "metadata": "root.IMAP4.pop_untagged_responses", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 561 }, { "content": " def recent(self, **kw):\n \"\"\"(typ, [data]) = recent()\n Return 'RECENT' responses if any exist,\n else prompt server for an update using the 'NOOP' command.\n 'data' is None if no new messages,\n else list of RECENT responses, most recent last.\"\"\"\n\n name = 'RECENT'\n typ, dat = self._untagged_response(None, [None], name)\n if dat != [None]:\n return self._deliver_dat(typ, dat, kw)\n kw['untagged_response'] = name\n return self.noop(**kw) # Prod server for response", "metadata": "root.IMAP4.recent", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 575 }, { "content": " def response(self, code, **kw):\n \"\"\"(code, [data]) = response(code)\n Return data for response 'code' if received, or None.\n Old value for response 'code' is cleared.\"\"\"\n\n typ, dat = self._untagged_response(code, [None], code.upper())\n return self._deliver_dat(typ, dat, kw)", "metadata": "root.IMAP4.response", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 590 }, { "content": " def append(self, mailbox, flags, date_time, message, **kw):\n \"\"\"(typ, [data]) = append(mailbox, flags, date_time, message)\n Append message to named mailbox.\n All args except `message' can be None.\"\"\"\n\n name = 'APPEND'\n if not mailbox:\n mailbox = 'INBOX'\n if flags:\n if (flags[0],flags[-1]) != ('(',')'):\n flags = '(%s)' % flags\n else:\n flags = None\n if date_time:\n date_time = Time2Internaldate(date_time)\n else:\n date_time = None\n if isinstance(message, str):\n message = bytes(message, 'ASCII')\n self.literal = self.mapCRLF_cre.sub(CRLF, message)\n try:\n return self._simple_command(name, mailbox, flags, date_time, **kw)\n finally:\n self._release_state_change()", "metadata": "root.IMAP4.append", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 604 }, { "content": " def authenticate(self, mechanism, authobject, **kw):\n \"\"\"(typ, [data]) = authenticate(mechanism, authobject)\n Authenticate command - requires response processing.\n\n 'mechanism' specifies which authentication mechanism is to\n be used - it must appear in <instance>.capabilities in the\n form AUTH=<mechanism>.\n\n 'authobject' must be a callable object:\n\n data = authobject(response)\n\n It will be called to process server continuation responses,\n the 'response' argument will be a 'bytes'. It should return\n bytes that will be encoded and sent to server. It should\n return None if the client abort response '*' should be sent\n instead.\"\"\"\n\n self.literal = _Authenticator(authobject).process\n try:\n typ, dat = self._simple_command('AUTHENTICATE', mechanism.upper())\n if typ != 'OK':\n self._deliver_exc(self.error, dat[-1], kw)\n self.state = AUTH\n if __debug__: self._log(1, 'state => AUTH')\n finally:\n self._release_state_change()\n return self._deliver_dat(typ, dat, kw)", "metadata": "root.IMAP4.authenticate", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 630 }, { "content": " def capability(self, **kw):\n \"\"\"(typ, [data]) = capability()\n Fetch capabilities list from server.\"\"\"\n\n name = 'CAPABILITY'\n kw['untagged_response'] = name\n return self._simple_command(name, **kw)", "metadata": "root.IMAP4.capability", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 660 }, { "content": " def check(self, **kw):\n \"\"\"(typ, [data]) = check()\n Checkpoint mailbox on server.\"\"\"\n\n return self._simple_command('CHECK', **kw)", "metadata": "root.IMAP4.check", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 669 }, { "content": " def close(self, **kw):\n \"\"\"(typ, [data]) = close()\n Close currently selected mailbox.\n\n Deleted messages are removed from writable mailbox.\n This is the recommended command before 'LOGOUT'.\"\"\"\n\n if self.state != 'SELECTED':\n raise self.error('No mailbox selected.')\n try:\n typ, dat = self._simple_command('CLOSE')\n finally:\n self.state = AUTH\n if __debug__: self._log(1, 'state => AUTH')\n self._release_state_change()\n return self._deliver_dat(typ, dat, kw)", "metadata": "root.IMAP4.close", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 676 }, { "content": " def copy(self, message_set, new_mailbox, **kw):\n \"\"\"(typ, [data]) = copy(message_set, new_mailbox)\n Copy 'message_set' messages onto end of 'new_mailbox'.\"\"\"\n\n return self._simple_command('COPY', message_set, new_mailbox, **kw)", "metadata": "root.IMAP4.copy", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 694 }, { "content": " def create(self, mailbox, **kw):\n \"\"\"(typ, [data]) = create(mailbox)\n Create new mailbox.\"\"\"\n\n return self._simple_command('CREATE', mailbox, **kw)", "metadata": "root.IMAP4.create", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 701 }, { "content": " def delete(self, mailbox, **kw):\n \"\"\"(typ, [data]) = delete(mailbox)\n Delete old mailbox.\"\"\"\n\n return self._simple_command('DELETE', mailbox, **kw)", "metadata": "root.IMAP4.delete", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 708 }, { "content": " def deleteacl(self, mailbox, who, **kw):\n \"\"\"(typ, [data]) = deleteacl(mailbox, who)\n Delete the ACLs (remove any rights) set for who on mailbox.\"\"\"\n\n return self._simple_command('DELETEACL', mailbox, who, **kw)", "metadata": "root.IMAP4.deleteacl", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 715 }, { "content": " def examine(self, mailbox='INBOX', **kw):\n \"\"\"(typ, [data]) = examine(mailbox='INBOX')\n Select a mailbox for READ-ONLY access. (Flushes all untagged responses.)\n 'data' is count of messages in mailbox ('EXISTS' response).\n Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so\n other responses should be obtained via \"response('FLAGS')\" etc.\"\"\"\n\n return self.select(mailbox=mailbox, readonly=True, **kw)", "metadata": "root.IMAP4.examine", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 722 }, { "content": " def expunge(self, **kw):\n \"\"\"(typ, [data]) = expunge()\n Permanently remove deleted items from selected mailbox.\n Generates 'EXPUNGE' response for each deleted message.\n 'data' is list of 'EXPUNGE'd message numbers in order received.\"\"\"\n\n name = 'EXPUNGE'\n kw['untagged_response'] = name\n return self._simple_command(name, **kw)", "metadata": "root.IMAP4.expunge", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 732 }, { "content": " def fetch(self, message_set, message_parts, **kw):\n \"\"\"(typ, [data, ...]) = fetch(message_set, message_parts)\n Fetch (parts of) messages.\n 'message_parts' should be a string of selected parts\n enclosed in parentheses, eg: \"(UID BODY[TEXT])\".\n 'data' are tuples of message part envelope and data,\n followed by a string containing the trailer.\"\"\"\n\n name = 'FETCH'\n kw['untagged_response'] = name\n return self._simple_command(name, message_set, message_parts, **kw)", "metadata": "root.IMAP4.fetch", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 743 }, { "content": " def getacl(self, mailbox, **kw):\n \"\"\"(typ, [data]) = getacl(mailbox)\n Get the ACLs for a mailbox.\"\"\"\n\n kw['untagged_response'] = 'ACL'\n return self._simple_command('GETACL', mailbox, **kw)", "metadata": "root.IMAP4.getacl", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 756 }, { "content": " def getannotation(self, mailbox, entry, attribute, **kw):\n \"\"\"(typ, [data]) = getannotation(mailbox, entry, attribute)\n Retrieve ANNOTATIONs.\"\"\"\n\n kw['untagged_response'] = 'ANNOTATION'\n return self._simple_command('GETANNOTATION', mailbox, entry, attribute, **kw)", "metadata": "root.IMAP4.getannotation", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 764 }, { "content": " def getquota(self, root, **kw):\n \"\"\"(typ, [data]) = getquota(root)\n Get the quota root's resource usage and limits.\n (Part of the IMAP4 QUOTA extension defined in rfc2087.)\"\"\"\n\n kw['untagged_response'] = 'QUOTA'\n return self._simple_command('GETQUOTA', root, **kw)", "metadata": "root.IMAP4.getquota", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 772 }, { "content": " def getquotaroot(self, mailbox, **kw):\n # Hmmm, this is non-std! Left for backwards-compatibility, sigh.\n # NB: usage should have been defined as:\n # (typ, [QUOTAROOT responses...]) = getquotaroot(mailbox)\n # (typ, [QUOTA responses...]) = response('QUOTA')\n \"\"\"(typ, [[QUOTAROOT responses...], [QUOTA responses...]]) = getquotaroot(mailbox)\n Get the list of quota roots for the named mailbox.\"\"\"\n\n typ, dat = self._simple_command('GETQUOTAROOT', mailbox)\n typ, quota = self._untagged_response(typ, dat, 'QUOTA')\n typ, quotaroot = self._untagged_response(typ, dat, 'QUOTAROOT')\n return self._deliver_dat(typ, [quotaroot, quota], kw)", "metadata": "root.IMAP4.getquotaroot", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 781 }, { "content": " def id(self, *kv_pairs, **kw):\n \"\"\"(typ, [data]) = <instance>.id(kv_pairs)\n 'kv_pairs' is a possibly empty list of keys and values.\n 'data' is a list of ID key value pairs or NIL.\n NB: a single argument is assumed to be correctly formatted and is passed through unchanged\n (for backward compatibility with earlier version).\n Exchange information for problem analysis and determination.\n The ID extension is defined in RFC 2971. \"\"\"\n\n name = 'ID'\n kw['untagged_response'] = name\n\n if not kv_pairs:\n data = 'NIL'\n elif len(kv_pairs) == 1:\n data = kv_pairs[0] # Assume invoker passing correctly formatted string (back-compat)\n else:\n data = '(%s)' % ' '.join([(arg and self._quote(arg) or 'NIL') for arg in kv_pairs])\n\n return self._simple_command(name, data, **kw)", "metadata": "root.IMAP4.id", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 795 }, { "content": " def idle(self, timeout=None, **kw):\n \"\"\"\"(typ, [data]) = idle(timeout=None)\n Put server into IDLE mode until server notifies some change,\n or 'timeout' (secs) occurs (default: 29 minutes),\n or another IMAP4 command is scheduled.\"\"\"\n\n name = 'IDLE'\n self.literal = _IdleCont(self, timeout).process\n try:\n return self._simple_command(name, **kw)\n finally:\n self._release_state_change()", "metadata": "root.IMAP4.idle", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 817 }, { "content": " def list(self, directory='\"\"', pattern='*', **kw):\n \"\"\"(typ, [data]) = list(directory='\"\"', pattern='*')\n List mailbox names in directory matching pattern.\n 'data' is list of LIST responses.\n\n NB: for 'pattern':\n % matches all except separator ( so LIST \"\" \"%\" returns names at root)\n * matches all (so LIST \"\" \"*\" returns whole directory tree from root)\"\"\"\n\n name = 'LIST'\n kw['untagged_response'] = name\n return self._simple_command(name, directory, pattern, **kw)", "metadata": "root.IMAP4.list", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 831 }, { "content": " def login(self, user, password, **kw):\n \"\"\"(typ, [data]) = login(user, password)\n Identify client using plaintext password.\n NB: 'password' will be quoted.\"\"\"\n\n try:\n typ, dat = self._simple_command('LOGIN', user, self._quote(password))\n if typ != 'OK':\n self._deliver_exc(self.error, dat[-1], kw)\n self.state = AUTH\n if __debug__: self._log(1, 'state => AUTH')\n finally:\n self._release_state_change()\n return self._deliver_dat(typ, dat, kw)", "metadata": "root.IMAP4.login", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 845 }, { "content": " def login_cram_md5(self, user, password, **kw):\n \"\"\"(typ, [data]) = login_cram_md5(user, password)\n Force use of CRAM-MD5 authentication.\"\"\"\n\n self.user, self.password = user, password\n return self.authenticate('CRAM-MD5', self._CRAM_MD5_AUTH, **kw)", "metadata": "root.IMAP4.login_cram_md5", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 861 }, { "content": " def _CRAM_MD5_AUTH(self, challenge):\n \"\"\"Authobject to use with CRAM-MD5 authentication.\"\"\"\n import hmac\n pwd = (self.password.encode('ASCII') if isinstance(self.password, str)\n else self.password)\n return self.user + \" \" + hmac.HMAC(pwd, challenge, 'md5').hexdigest()", "metadata": "root.IMAP4._CRAM_MD5_AUTH", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 869 }, { "content": " def logout(self, **kw):\n \"\"\"(typ, [data]) = logout()\n Shutdown connection to server.\n Returns server 'BYE' response.\n NB: You must call this to shut down threads before discarding an instance.\"\"\"\n\n self.state = LOGOUT\n if __debug__: self._log(1, 'state => LOGOUT')\n\n try:\n try:\n typ, dat = self._simple_command('LOGOUT')\n except:\n typ, dat = 'NO', ['%s: %s' % sys.exc_info()[:2]]\n if __debug__: self._log(1, dat)\n\n self._close_threads()\n finally:\n self._release_state_change()\n\n if __debug__: self._log(1, 'connection closed')\n\n bye = self._get_untagged_response('BYE', leave=True)\n if bye:\n typ, dat = 'BYE', bye\n return self._deliver_dat(typ, dat, kw)", "metadata": "root.IMAP4.logout", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 877 }, { "content": " def lsub(self, directory='\"\"', pattern='*', **kw):\n \"\"\"(typ, [data, ...]) = lsub(directory='\"\"', pattern='*')\n List 'subscribed' mailbox names in directory matching pattern.\n 'data' are tuples of message part envelope and data.\"\"\"\n\n name = 'LSUB'\n kw['untagged_response'] = name\n return self._simple_command(name, directory, pattern, **kw)", "metadata": "root.IMAP4.lsub", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 905 }, { "content": " def myrights(self, mailbox, **kw):\n \"\"\"(typ, [data]) = myrights(mailbox)\n Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).\"\"\"\n\n name = 'MYRIGHTS'\n kw['untagged_response'] = name\n return self._simple_command(name, mailbox, **kw)", "metadata": "root.IMAP4.myrights", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 915 }, { "content": " def namespace(self, **kw):\n \"\"\"(typ, [data, ...]) = namespace()\n Returns IMAP namespaces ala rfc2342.\"\"\"\n\n name = 'NAMESPACE'\n kw['untagged_response'] = name\n return self._simple_command(name, **kw)", "metadata": "root.IMAP4.namespace", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 924 }, { "content": " def noop(self, **kw):\n \"\"\"(typ, [data]) = noop()\n Send NOOP command.\"\"\"\n\n if __debug__: self._dump_ur(3)\n return self._simple_command('NOOP', **kw)", "metadata": "root.IMAP4.noop", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 933 }, { "content": " def partial(self, message_num, message_part, start, length, **kw):\n \"\"\"(typ, [data, ...]) = partial(message_num, message_part, start, length)\n Fetch truncated part of a message.\n 'data' is tuple of message part envelope and data.\n NB: obsolete.\"\"\"\n\n name = 'PARTIAL'\n kw['untagged_response'] = 'FETCH'\n return self._simple_command(name, message_num, message_part, start, length, **kw)", "metadata": "root.IMAP4.partial", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 941 }, { "content": " def proxyauth(self, user, **kw):\n \"\"\"(typ, [data]) = proxyauth(user)\n Assume authentication as 'user'.\n (Allows an authorised administrator to proxy into any user's mailbox.)\"\"\"\n\n try:\n return self._simple_command('PROXYAUTH', user, **kw)\n finally:\n self._release_state_change()", "metadata": "root.IMAP4.proxyauth", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 952 }, { "content": " def rename(self, oldmailbox, newmailbox, **kw):\n \"\"\"(typ, [data]) = rename(oldmailbox, newmailbox)\n Rename old mailbox name to new.\"\"\"\n\n return self._simple_command('RENAME', oldmailbox, newmailbox, **kw)", "metadata": "root.IMAP4.rename", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 963 }, { "content": " def search(self, charset, *criteria, **kw):\n \"\"\"(typ, [data]) = search(charset, criterion, ...)\n Search mailbox for matching messages.\n 'data' is space separated list of matching message numbers.\"\"\"\n\n name = 'SEARCH'\n kw['untagged_response'] = name\n if charset:\n return self._simple_command(name, 'CHARSET', charset, *criteria, **kw)\n return self._simple_command(name, *criteria, **kw)", "metadata": "root.IMAP4.search", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 970 }, { "content": " def select(self, mailbox='INBOX', readonly=False, **kw):\n \"\"\"(typ, [data]) = select(mailbox='INBOX', readonly=False)\n Select a mailbox. (Flushes all untagged responses.)\n 'data' is count of messages in mailbox ('EXISTS' response).\n Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so\n other responses should be obtained via \"response('FLAGS')\" etc.\"\"\"\n\n self.mailbox = mailbox\n\n self.is_readonly = bool(readonly)\n if readonly:\n name = 'EXAMINE'\n else:\n name = 'SELECT'\n try:\n rqb = self._command(name, mailbox)\n typ, dat = rqb.get_response('command: %s => %%s' % rqb.name)\n if typ != 'OK':\n if self.state == SELECTED:\n self.state = AUTH\n if __debug__: self._log(1, 'state => AUTH')\n if typ == 'BAD':\n self._deliver_exc(self.error, '%s command error: %s %s. Data: %.100s' % (name, typ, dat, mailbox), kw)\n return self._deliver_dat(typ, dat, kw)\n self.state = SELECTED\n if __debug__: self._log(1, 'state => SELECTED')\n finally:\n self._release_state_change()\n\n if self._get_untagged_response('READ-ONLY', leave=True) and not readonly:\n if __debug__: self._dump_ur(1)\n self._deliver_exc(self.readonly, '%s is not writable' % mailbox, kw)\n typ, dat = self._untagged_response(typ, [None], 'EXISTS')\n return self._deliver_dat(typ, dat, kw)", "metadata": "root.IMAP4.select", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 982 }, { "content": " def setacl(self, mailbox, who, what, **kw):\n \"\"\"(typ, [data]) = setacl(mailbox, who, what)\n Set a mailbox acl.\"\"\"\n\n try:\n return self._simple_command('SETACL', mailbox, who, what, **kw)\n finally:\n self._release_state_change()", "metadata": "root.IMAP4.setacl", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1018 }, { "content": " def setannotation(self, *args, **kw):\n \"\"\"(typ, [data]) = setannotation(mailbox[, entry, attribute]+)\n Set ANNOTATIONs.\"\"\"\n\n kw['untagged_response'] = 'ANNOTATION'\n return self._simple_command('SETANNOTATION', *args, **kw)", "metadata": "root.IMAP4.setannotation", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1028 }, { "content": " def setquota(self, root, limits, **kw):\n \"\"\"(typ, [data]) = setquota(root, limits)\n Set the quota root's resource limits.\"\"\"\n\n kw['untagged_response'] = 'QUOTA'\n try:\n return self._simple_command('SETQUOTA', root, limits, **kw)\n finally:\n self._release_state_change()", "metadata": "root.IMAP4.setquota", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1036 }, { "content": " def sort(self, sort_criteria, charset, *search_criteria, **kw):\n \"\"\"(typ, [data]) = sort(sort_criteria, charset, search_criteria, ...)\n IMAP4rev1 extension SORT command.\"\"\"\n\n name = 'SORT'\n if (sort_criteria[0],sort_criteria[-1]) != ('(',')'):\n sort_criteria = '(%s)' % sort_criteria\n kw['untagged_response'] = name\n return self._simple_command(name, sort_criteria, charset, *search_criteria, **kw)", "metadata": "root.IMAP4.sort", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1047 }, { "content": " def starttls(self, keyfile=None, certfile=None, ca_certs=None, cert_verify_cb=None, ssl_version=\"ssl23\", tls_level=TLS_COMPAT, **kw):\n \"\"\"(typ, [data]) = starttls(keyfile=None, certfile=None, ca_certs=None, cert_verify_cb=None, ssl_version=\"ssl23\", tls_level=\"tls_compat\")\n Start TLS negotiation as per RFC 2595.\"\"\"\n\n name = 'STARTTLS'\n\n if name not in self.capabilities:\n raise self.abort('TLS not supported by server')\n\n if self._tls_established:\n raise self.abort('TLS session already established')\n\n # Must now shutdown reader thread after next response, and restart after changing read_fd\n\n self.read_size = 1 # Don't consume TLS handshake\n self.TerminateReader = True\n\n try:\n typ, dat = self._simple_command(name)\n finally:\n self._release_state_change()\n self.rdth.join()\n self.TerminateReader = False\n self.read_size = READ_SIZE\n\n if typ != 'OK':\n # Restart reader thread and error\n self.rdth = threading.Thread(target=self._reader)\n self.rdth.setDaemon(True)\n self.rdth.start()\n raise self.error(\"Couldn't establish TLS session: %s\" % dat)\n\n self.keyfile = keyfile\n self.certfile = certfile\n self.ca_certs = ca_certs\n self.cert_verify_cb = cert_verify_cb\n self.ssl_version = ssl_version\n self.tls_level = tls_level\n\n try:\n self.ssl_wrap_socket()\n finally:\n # Restart reader thread\n self.rdth = threading.Thread(target=self._reader)\n self.rdth.setDaemon(True)\n self.rdth.start()\n\n self._get_capabilities()\n\n self._tls_established = True\n\n typ, dat = self._untagged_response(typ, dat, name)\n return self._deliver_dat(typ, dat, kw)", "metadata": "root.IMAP4.starttls", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1058 }, { "content": " def status(self, mailbox, names, **kw):\n \"\"\"(typ, [data]) = status(mailbox, names)\n Request named status conditions for mailbox.\"\"\"\n\n name = 'STATUS'\n kw['untagged_response'] = name\n return self._simple_command(name, mailbox, names, **kw)", "metadata": "root.IMAP4.status", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1113 }, { "content": " def store(self, message_set, command, flags, **kw):\n \"\"\"(typ, [data]) = store(message_set, command, flags)\n Alters flag dispositions for messages in mailbox.\"\"\"\n\n if (flags[0],flags[-1]) != ('(',')'):\n flags = '(%s)' % flags # Avoid quoting the flags\n kw['untagged_response'] = 'FETCH'\n return self._simple_command('STORE', message_set, command, flags, **kw)", "metadata": "root.IMAP4.store", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1122 }, { "content": " def subscribe(self, mailbox, **kw):\n \"\"\"(typ, [data]) = subscribe(mailbox)\n Subscribe to new mailbox.\"\"\"\n\n try:\n return self._simple_command('SUBSCRIBE', mailbox, **kw)\n finally:\n self._release_state_change()", "metadata": "root.IMAP4.subscribe", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1132 }, { "content": " def thread(self, threading_algorithm, charset, *search_criteria, **kw):\n \"\"\"(type, [data]) = thread(threading_alogrithm, charset, search_criteria, ...)\n IMAPrev1 extension THREAD command.\"\"\"\n\n name = 'THREAD'\n kw['untagged_response'] = name\n return self._simple_command(name, threading_algorithm, charset, *search_criteria, **kw)", "metadata": "root.IMAP4.thread", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1142 }, { "content": " def uid(self, command, *args, **kw):\n \"\"\"(typ, [data]) = uid(command, arg, ...)\n Execute \"command arg ...\" with messages identified by UID,\n rather than message number.\n Assumes 'command' is legal in current state.\n Returns response appropriate to 'command'.\"\"\"\n\n command = command.upper()\n if command in UID_direct:\n resp = command\n else:\n resp = 'FETCH'\n kw['untagged_response'] = resp\n return self._simple_command('UID', command, *args, **kw)", "metadata": "root.IMAP4.uid", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1151 }, { "content": " def unsubscribe(self, mailbox, **kw):\n \"\"\"(typ, [data]) = unsubscribe(mailbox)\n Unsubscribe from old mailbox.\"\"\"\n\n try:\n return self._simple_command('UNSUBSCRIBE', mailbox, **kw)\n finally:\n self._release_state_change()", "metadata": "root.IMAP4.unsubscribe", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1167 }, { "content": " def xatom(self, name, *args, **kw):\n \"\"\"(typ, [data]) = xatom(name, arg, ...)\n Allow simple extension commands notified by server in CAPABILITY response.\n Assumes extension command 'name' is legal in current state.\n Returns response appropriate to extension command 'name'.\"\"\"\n\n name = name.upper()\n if not name in Commands:\n Commands[name] = ((self.state,), False)\n try:\n return self._simple_command(name, *args, **kw)\n finally:\n self._release_state_change()", "metadata": "root.IMAP4.xatom", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1177 }, { "content": " def _append_untagged(self, typ, dat):\n\n # Append new 'dat' to end of last untagged response if same 'typ',\n # else append new response.\n\n if dat is None: dat = b''\n\n self.commands_lock.acquire()\n\n if self.untagged_responses:\n urn, urd = self.untagged_responses[-1]\n if urn != typ:\n urd = None\n else:\n urd = None\n\n if urd is None:\n urd = []\n self.untagged_responses.append([typ, urd])\n\n urd.append(dat)\n\n self.commands_lock.release()\n\n if __debug__: self._log(5, 'untagged_responses[%s] %s += [\"%.80r\"]' % (typ, len(urd)-1, dat))", "metadata": "root.IMAP4._append_untagged", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1196 }, { "content": " def _check_bye(self):\n\n bye = self._get_untagged_response('BYE', leave=True)\n if bye:\n raise self.abort(bye[-1].decode('ASCII', 'replace'))", "metadata": "root.IMAP4._check_bye", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1223 }, { "content": " def _choose_nonull_or_dflt(self, dflt, *args):\n if isinstance(dflt, str):\n dflttyp = str # Allow any string type\n else:\n dflttyp = type(dflt)\n for arg in args:\n if arg is not None:\n if isinstance(arg, dflttyp):\n return arg\n if __debug__: self._log(0, 'bad arg is %s, expecting %s' % (type(arg), dflttyp))\n return dflt", "metadata": "root.IMAP4._choose_nonull_or_dflt", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1230 }, { "content": " def _command(self, name, *args, **kw):\n\n if Commands[name][CMD_VAL_ASYNC]:\n cmdtyp = 'async'\n else:\n cmdtyp = 'sync'\n\n if __debug__: self._log(1, '[%s] %s %s' % (cmdtyp, name, args))\n\n if __debug__: self._log(3, 'state_change_pending.acquire')\n self.state_change_pending.acquire()\n\n self._end_idle()\n\n if cmdtyp == 'async':\n self.state_change_pending.release()\n if __debug__: self._log(3, 'state_change_pending.release')\n else:\n # Need to wait for all async commands to complete\n self._check_bye()\n self.commands_lock.acquire()\n if self.tagged_commands:\n self.state_change_free.clear()\n need_event = True\n else:\n need_event = False\n self.commands_lock.release()\n if need_event:\n if __debug__: self._log(3, 'sync command %s waiting for empty commands Q' % name)\n self.state_change_free.wait(threading.TIMEOUT_MAX)\n if __debug__: self._log(3, 'sync command %s proceeding' % name)\n\n if self.state not in Commands[name][CMD_VAL_STATES]:\n self.literal = None\n raise self.error('command %s illegal in state %s'\n % (name, self.state))\n\n self._check_bye()\n\n if name in ('EXAMINE', 'SELECT'):\n self.commands_lock.acquire()\n self.untagged_responses = [] # Flush all untagged responses\n self.commands_lock.release()\n else:\n for typ in ('OK', 'NO', 'BAD'):\n while self._get_untagged_response(typ):\n continue\n\n if not self.is_readonly and self._get_untagged_response('READ-ONLY', leave=True):\n self.literal = None\n raise self.readonly('mailbox status changed to READ-ONLY')\n\n if self.Terminate:\n raise self.abort('connection closed')\n\n rqb = self._request_push(name=name, **kw)\n\n name = bytes(name, 'ASCII')\n data = rqb.tag + b' ' + name\n for arg in args:\n if arg is None: continue\n if isinstance(arg, str):\n arg = bytes(arg, \"ASCII\")\n data = data + b' ' + arg\n\n literal = self.literal\n if literal is not None:\n self.literal = None\n if type(literal) is type(self._command):\n literator = literal\n else:\n literator = None\n data = data + bytes(' {%s}' % len(literal), 'ASCII')\n\n if __debug__: self._log(4, 'data=%r' % data)\n\n rqb.data = data + CRLF\n\n if literal is None:\n self.ouq.put(rqb)\n return rqb\n\n # Must setup continuation expectancy *before* ouq.put \n crqb = self._request_push(name=name, tag='continuation')\n\n self.ouq.put(rqb)\n\n while True:\n # Wait for continuation response\n\n ok, data = crqb.get_response('command: %s => %%s' % name)\n if __debug__: self._log(4, 'continuation => %s, %r' % (ok, data))\n\n # NO/BAD response?\n\n if not ok:\n break\n\n # Send literal\n\n if literator is not None:\n literal = literator(data, rqb)\n\n if literal is None:\n break\n\n if literator is not None:\n # Need new request for next continuation response\n crqb = self._request_push(name=name, tag='continuation')\n\n if __debug__: self._log(4, 'write literal size %s' % len(literal))\n crqb.data = literal + CRLF\n self.ouq.put(crqb)\n\n if literator is None:\n break\n\n return rqb", "metadata": "root.IMAP4._command", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1243 }, { "content": " def _command_complete(self, rqb, kw):\n\n # Called for non-callback commands\n\n self._check_bye()\n typ, dat = rqb.get_response('command: %s => %%s' % rqb.name)\n if typ == 'BAD':\n if __debug__: self._print_log()\n raise self.error('%s command error: %s %s. Data: %.100s' % (rqb.name, typ, dat, rqb.data))\n if 'untagged_response' in kw:\n return self._untagged_response(typ, dat, kw['untagged_response'])\n return typ, dat", "metadata": "root.IMAP4._command_complete", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1363 }, { "content": " def _command_completer(self, cb_arg_list):\n\n # Called for callback commands\n response, cb_arg, error = cb_arg_list\n rqb, kw = cb_arg\n rqb.callback = kw['callback']\n rqb.callback_arg = kw.get('cb_arg')\n if error is not None:\n if __debug__: self._print_log()\n typ, val = error\n rqb.abort(typ, val)\n return\n bye = self._get_untagged_response('BYE', leave=True)\n if bye:\n rqb.abort(self.abort, bye[-1].decode('ASCII', 'replace'))\n return\n typ, dat = response\n if typ == 'BAD':\n if __debug__: self._print_log()\n rqb.abort(self.error, '%s command error: %s %s. Data: %.100s' % (rqb.name, typ, dat, rqb.data))\n return\n if __debug__: self._log(4, '_command_completer(%s, %s, None) = %s' % (response, cb_arg, rqb.tag))\n if 'untagged_response' in kw:\n response = self._untagged_response(typ, dat, kw['untagged_response'])\n rqb.deliver(response)", "metadata": "root.IMAP4._command_completer", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1377 }, { "content": " def _deliver_dat(self, typ, dat, kw):\n\n if 'callback' in kw:\n kw['callback'](((typ, dat), kw.get('cb_arg'), None))\n return typ, dat", "metadata": "root.IMAP4._deliver_dat", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1404 }, { "content": " def _deliver_exc(self, exc, dat, kw):\n\n if 'callback' in kw:\n kw['callback']((None, kw.get('cb_arg'), (exc, dat)))\n raise exc(dat)", "metadata": "root.IMAP4._deliver_exc", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1411 }, { "content": " def _end_idle(self):\n\n self.idle_lock.acquire()\n irqb = self.idle_rqb\n if irqb is None:\n self.idle_lock.release()\n return\n self.idle_rqb = None\n self.idle_timeout = None\n self.idle_lock.release()\n irqb.data = bytes('DONE', 'ASCII') + CRLF\n self.ouq.put(irqb)\n if __debug__: self._log(2, 'server IDLE finished')", "metadata": "root.IMAP4._end_idle", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1418 }, { "content": " def _get_capabilities(self):\n typ, dat = self.capability()\n if dat == [None]:\n raise self.error('no CAPABILITY response from server')\n dat = str(dat[-1], \"ASCII\")\n dat = dat.upper()\n self.capabilities = tuple(dat.split())", "metadata": "root.IMAP4._get_capabilities", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1433 }, { "content": " def _get_untagged_response(self, name, leave=False):\n\n self.commands_lock.acquire()\n\n for i, (typ, dat) in enumerate(self.untagged_responses):\n if typ == name:\n if not leave:\n del self.untagged_responses[i]\n self.commands_lock.release()\n if __debug__: self._log(5, '_get_untagged_response(%s) => %.80r' % (name, dat))\n return dat\n\n self.commands_lock.release()\n return None", "metadata": "root.IMAP4._get_untagged_response", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1442 }, { "content": " def _match(self, cre, s):\n\n # Run compiled regular expression 'cre' match method on 's'.\n # Save result, return success.\n\n self.mo = cre.match(s)\n return self.mo is not None", "metadata": "root.IMAP4._match", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1458 }, { "content": " def _put_response(self, resp):\n\n if self._expecting_data:\n rlen = len(resp)\n dlen = min(self._expecting_data_len, rlen)\n if __debug__: self._log(5, '_put_response expecting data len %s, got %s' % (self._expecting_data_len, rlen))\n self._expecting_data_len -= dlen\n self._expecting_data = (self._expecting_data_len != 0)\n if rlen <= dlen:\n self._accumulated_data.append(resp)\n return\n self._accumulated_data.append(resp[:dlen])\n resp = resp[dlen:]\n\n if self._accumulated_data:\n typ, dat = self._literal_expected\n self._append_untagged(typ, (dat, b''.join(self._accumulated_data)))\n self._accumulated_data = []\n\n # Protocol mandates all lines terminated by CRLF\n resp = resp[:-2]\n if __debug__: self._log(5, '_put_response(%r)' % resp)\n\n if 'continuation' in self.tagged_commands:\n continuation_expected = True\n else:\n continuation_expected = False\n\n if self._literal_expected is not None:\n dat = resp\n if self._match(self.literal_cre, dat):\n self._literal_expected[1] = dat\n self._expecting_data = True\n self._expecting_data_len = int(self.mo.group('size'))\n if __debug__: self._log(4, 'expecting literal size %s' % self._expecting_data_len)\n return\n typ = self._literal_expected[0]\n self._literal_expected = None\n if dat:\n self._append_untagged(typ, dat) # Tail\n if __debug__: self._log(4, 'literal completed')\n else:\n # Command completion response?\n if self._match(self.tagre, resp):\n tag = self.mo.group('tag')\n typ = str(self.mo.group('type'), 'ASCII')\n dat = self.mo.group('data')\n if typ in ('OK', 'NO', 'BAD') and self._match(self.response_code_cre, dat):\n self._append_untagged(str(self.mo.group('type'), 'ASCII'), self.mo.group('data'))\n if not tag in self.tagged_commands:\n if __debug__: self._log(1, 'unexpected tagged response: %r' % resp)\n else:\n self._request_pop(tag, (typ, [dat]))\n else:\n dat2 = None\n\n # '*' (untagged) responses?\n\n if not self._match(self.untagged_response_cre, resp):\n if self._match(self.untagged_status_cre, resp):\n dat2 = self.mo.group('data2')\n\n if self.mo is None:\n # Only other possibility is '+' (continuation) response...\n\n if self._match(self.continuation_cre, resp):\n if not continuation_expected:\n if __debug__: self._log(1, \"unexpected continuation response: '%r'\" % resp)\n return\n self._request_pop('continuation', (True, self.mo.group('data')))\n return\n\n if __debug__: self._log(1, \"unexpected response: '%r'\" % resp)\n return\n\n typ = str(self.mo.group('type'), 'ASCII')\n dat = self.mo.group('data')\n if dat is None: dat = b'' # Null untagged response\n if dat2: dat = dat + b' ' + dat2\n\n # Is there a literal to come?\n\n if self._match(self.literal_cre, dat):\n self._expecting_data = True\n self._expecting_data_len = int(self.mo.group('size'))\n if __debug__: self._log(4, 'read literal size %s' % self._expecting_data_len)\n self._literal_expected = [typ, dat]\n return\n\n self._append_untagged(typ, dat)\n if typ in ('OK', 'NO', 'BAD') and self._match(self.response_code_cre, dat):\n self._append_untagged(str(self.mo.group('type'), 'ASCII'), self.mo.group('data'))\n\n if typ != 'OK': # NO, BYE, IDLE\n self._end_idle()\n\n # Command waiting for aborted continuation response?\n\n if continuation_expected:\n self._request_pop('continuation', (False, resp))\n\n # Bad news?\n\n if typ in ('NO', 'BAD', 'BYE'):\n if typ == 'BYE':\n self.Terminate = True\n if __debug__: self._log(1, '%s response: %r' % (typ, dat))", "metadata": "root.IMAP4._put_response", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1467 }, { "content": " def _quote(self, arg):\n\n return '\"%s\"' % arg.replace('\\\\', '\\\\\\\\').replace('\"', '\\\\\"')", "metadata": "root.IMAP4._quote", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1576 }, { "content": " def _release_state_change(self):\n\n if self.state_change_pending.locked():\n self.state_change_pending.release()\n if __debug__: self._log(3, 'state_change_pending.release')", "metadata": "root.IMAP4._release_state_change", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1581 }, { "content": " def _request_pop(self, name, data):\n\n self.commands_lock.acquire()\n rqb = self.tagged_commands.pop(name)\n if not self.tagged_commands:\n need_event = True\n else:\n need_event = False\n self.commands_lock.release()\n\n if __debug__: self._log(4, '_request_pop(%s, %r) [%d] = %s' % (name, data, len(self.tagged_commands), rqb.tag))\n rqb.deliver(data)\n\n if need_event:\n if __debug__: self._log(3, 'state_change_free.set')\n self.state_change_free.set()", "metadata": "root.IMAP4._request_pop", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1588 }, { "content": " def _request_push(self, tag=None, name=None, **kw):\n\n self.commands_lock.acquire()\n rqb = Request(self, name=name, **kw)\n if tag is None:\n tag = rqb.tag\n self.tagged_commands[tag] = rqb\n self.commands_lock.release()\n if __debug__: self._log(4, '_request_push(%s, %s, %s) = %s' % (tag, name, repr(kw), rqb.tag))\n return rqb", "metadata": "root.IMAP4._request_push", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1606 }, { "content": " def _simple_command(self, name, *args, **kw):\n\n if 'callback' in kw:\n # Note: old calling sequence for back-compat with python <2.6\n self._command(name, callback=self._command_completer, cb_arg=kw, cb_self=True, *args)\n return (None, None)\n return self._command_complete(self._command(name, *args), kw)", "metadata": "root.IMAP4._simple_command", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1618 }, { "content": " def _untagged_response(self, typ, dat, name):\n\n if typ == 'NO':\n return typ, dat\n data = self._get_untagged_response(name)\n if not data:\n return typ, [None]\n while True:\n dat = self._get_untagged_response(name)\n if not dat:\n break\n data += dat\n if __debug__: self._log(4, '_untagged_response(%s, ?, %s) => %.80r' % (typ, name, data))\n return typ, data", "metadata": "root.IMAP4._untagged_response", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1627 }, { "content": " def _close_threads(self):\n\n if __debug__: self._log(1, '_close_threads')\n\n self.ouq.put(None)\n self.wrth.join()\n\n if __debug__: self._log(1, 'call shutdown')\n\n self.shutdown()\n\n self.rdth.join()\n self.inth.join()", "metadata": "root.IMAP4._close_threads", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1647 }, { "content": " def _handler(self):\n\n resp_timeout = self.resp_timeout\n\n threading.currentThread().setName(self.identifier + 'handler')\n\n time.sleep(0.1) # Don't start handling before main thread ready\n\n if __debug__: self._log(1, 'starting')\n\n typ, val = self.abort, 'connection terminated'\n\n while not self.Terminate:\n\n self.idle_lock.acquire()\n if self.idle_timeout is not None:\n timeout = self.idle_timeout - time.time()\n if timeout <= 0:\n timeout = 1\n if __debug__:\n if self.idle_rqb is not None:\n self._log(5, 'server IDLING, timeout=%.2f' % timeout)\n else:\n timeout = resp_timeout\n self.idle_lock.release()\n\n try:\n line = self.inq.get(True, timeout)\n except queue.Empty:\n if self.idle_rqb is None:\n if resp_timeout is not None and self.tagged_commands:\n if __debug__: self._log(1, 'response timeout')\n typ, val = self.abort, 'no response after %s secs' % resp_timeout\n break\n continue\n if self.idle_timeout > time.time():\n continue\n if __debug__: self._log(2, 'server IDLE timedout')\n line = IDLE_TIMEOUT_RESPONSE\n\n if line is None:\n if __debug__: self._log(1, 'inq None - terminating')\n break\n\n if not isinstance(line, bytes):\n typ, val = line\n break\n\n try:\n self._put_response(line)\n except:\n typ, val = self.error, 'program error: %s - %s' % sys.exc_info()[:2]\n break\n\n self.Terminate = True\n\n if __debug__: self._log(1, 'terminating: %s' % repr(val))\n\n while not self.ouq.empty():\n try:\n qel = self.ouq.get_nowait()\n if qel is not None:\n qel.abort(typ, val)\n except queue.Empty:\n break\n self.ouq.put(None)\n\n self.commands_lock.acquire()\n for name in list(self.tagged_commands.keys()):\n rqb = self.tagged_commands.pop(name)\n rqb.abort(typ, val)\n self.state_change_free.set()\n self.commands_lock.release()\n if __debug__: self._log(3, 'state_change_free.set')\n\n if __debug__: self._log(1, 'finished')", "metadata": "root.IMAP4._handler", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1662 }, { "content": " def _reader(self):\n\n threading.currentThread().setName(self.identifier + 'reader')\n\n if __debug__: self._log(1, 'starting using poll')\n\n def poll_error(state):\n PollErrors = {\n select.POLLERR: 'Error',\n select.POLLHUP: 'Hang up',\n select.POLLNVAL: 'Invalid request: descriptor not open',\n }\n return ' '.join([PollErrors[s] for s in PollErrors.keys() if (s & state)])\n\n line_part = b''\n\n poll = select.poll()\n\n poll.register(self.read_fd, select.POLLIN)\n\n rxzero = 0\n terminate = False\n read_poll_timeout = self.read_poll_timeout * 1000 # poll() timeout is in millisecs\n\n while not (terminate or self.Terminate):\n if self.state == LOGOUT:\n timeout = 10\n else:\n timeout = read_poll_timeout\n try:\n r = poll.poll(timeout)\n if __debug__: self._log(5, 'poll => %s' % repr(r))\n if not r:\n continue # Timeout\n\n fd,state = r[0]\n\n if state & select.POLLIN:\n data = self.read(self.read_size) # Drain ssl buffer if present\n start = 0\n dlen = len(data)\n if __debug__: self._log(5, 'rcvd %s' % dlen)\n if dlen == 0:\n rxzero += 1\n if rxzero > 5:\n raise IOError(\"Too many read 0\")\n time.sleep(0.1)\n continue # Try again\n rxzero = 0\n\n while True:\n stop = data.find(b'\\n', start)\n if stop < 0:\n line_part += data[start:]\n break\n stop += 1\n line_part, start, line = \\\n b'', stop, line_part + data[start:stop]\n if __debug__: self._log(4, '< %r' % line)\n self.inq.put(line)\n if self.TerminateReader:\n terminate = True\n\n if state & ~(select.POLLIN):\n raise IOError(poll_error(state))\n except:\n reason = 'socket error: %s - %s' % sys.exc_info()[:2]\n if __debug__:\n if not self.Terminate:\n self._print_log()\n if self.debug: self.debug += 4 # Output all\n self._log(1, reason)\n self.inq.put((self.abort, reason))\n break\n\n poll.unregister(self.read_fd)\n\n if __debug__: self._log(1, 'finished')", "metadata": "root.IMAP4._reader", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1742 }, { "content": " def _reader(self):\n\n threading.currentThread().setName(self.identifier + 'reader')\n\n if __debug__: self._log(1, 'starting using select')\n\n line_part = b''\n\n rxzero = 0\n terminate = False\n\n while not (terminate or self.Terminate):\n if self.state == LOGOUT:\n timeout = 1\n else:\n timeout = self.read_poll_timeout\n try:\n r,w,e = select.select([self.read_fd], [], [], timeout)\n if __debug__: self._log(5, 'select => %s, %s, %s' % (r,w,e))\n if not r: # Timeout\n continue\n\n data = self.read(self.read_size) # Drain ssl buffer if present\n start = 0\n dlen = len(data)\n if __debug__: self._log(5, 'rcvd %s' % dlen)\n if dlen == 0:\n rxzero += 1\n if rxzero > 5:\n raise IOError(\"Too many read 0\")\n time.sleep(0.1)\n continue # Try again\n rxzero = 0\n\n while True:\n stop = data.find(b'\\n', start)\n if stop < 0:\n line_part += data[start:]\n break\n stop += 1\n line_part, start, line = \\\n b'', stop, (line_part + data[start:stop]).decode(errors='ignore')\n if __debug__: self._log(4, '< %r' % line)\n self.inq.put(line)\n if self.TerminateReader:\n terminate = True\n except:\n reason = 'socket error: %s - %s' % sys.exc_info()[:2]\n if __debug__:\n if not self.Terminate:\n self._print_log()\n if self.debug: self.debug += 4 # Output all\n self._log(1, reason)\n self.inq.put((self.abort, reason))\n break\n\n if __debug__: self._log(1, 'finished')", "metadata": "root.IMAP4._reader", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1825 }, { "content": " def _writer(self):\n\n threading.currentThread().setName(self.identifier + 'writer')\n\n if __debug__: self._log(1, 'starting')\n\n reason = 'Terminated'\n\n while not self.Terminate:\n rqb = self.ouq.get()\n if rqb is None:\n break # Outq flushed\n\n try:\n self.send(rqb.data)\n if __debug__: self._log(4, '> %r' % rqb.data)\n except:\n reason = 'socket error: %s - %s' % sys.exc_info()[:2]\n if __debug__:\n if not self.Terminate:\n self._print_log()\n if self.debug: self.debug += 4 # Output all\n self._log(1, reason)\n rqb.abort(self.abort, reason)\n break\n\n self.inq.put((self.abort, reason))\n\n if __debug__: self._log(1, 'finished')", "metadata": "root.IMAP4._writer", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1884 }, { "content": " def _init_debug(self, debug=None, debug_file=None, debug_buf_lvl=None):\n self.debug_lock = threading.Lock()\n\n self.debug = self._choose_nonull_or_dflt(0, debug)\n self.debug_file = self._choose_nonull_or_dflt(sys.stderr, debug_file)\n self.debug_buf_lvl = self._choose_nonull_or_dflt(DFLT_DEBUG_BUF_LVL, debug_buf_lvl)\n\n self._cmd_log_len = 20\n self._cmd_log_idx = 0\n self._cmd_log = {} # Last `_cmd_log_len' interactions\n if self.debug:\n self._mesg('imaplib2 version %s' % __version__)\n self._mesg('imaplib2 debug level %s, buffer level %s' % (self.debug, self.debug_buf_lvl))", "metadata": "root.IMAP4._init_debug", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1921 }, { "content": " def _dump_ur(self, lvl):\n if lvl > self.debug:\n return\n\n l = self.untagged_responses # NB: bytes array\n if not l:\n return\n\n t = '\\n\\t\\t'\n l = ['%s: \"%s\"' % (x[0], x[1][0] and b'\" \"'.join(x[1]) or '') for x in l]\n self.debug_lock.acquire()\n self._mesg('untagged responses dump:%s%s' % (t, t.join(l)))\n self.debug_lock.release()", "metadata": "root.IMAP4._dump_ur", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1936 }, { "content": " def _log(self, lvl, line):\n if lvl > self.debug:\n return\n\n if line[-2:] == CRLF:\n line = line[:-2] + '\\\\r\\\\n'\n\n tn = threading.currentThread().getName()\n\n if lvl <= 1 or self.debug > self.debug_buf_lvl:\n self.debug_lock.acquire()\n self._mesg(line, tn)\n self.debug_lock.release()\n if lvl != 1:\n return\n\n # Keep log of last `_cmd_log_len' interactions for debugging.\n self.debug_lock.acquire()\n self._cmd_log[self._cmd_log_idx] = (line, tn, time.time())\n self._cmd_log_idx += 1\n if self._cmd_log_idx >= self._cmd_log_len:\n self._cmd_log_idx = 0\n self.debug_lock.release()", "metadata": "root.IMAP4._log", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1951 }, { "content": " def _mesg(self, s, tn=None, secs=None):\n if secs is None:\n secs = time.time()\n if tn is None:\n tn = threading.currentThread().getName()\n tm = time.strftime('%M:%S', time.localtime(secs))\n try:\n self.debug_file.write(' %s.%02d %s %s\\n' % (tm, (secs*100)%100, tn, s))\n self.debug_file.flush()\n finally:\n pass", "metadata": "root.IMAP4._mesg", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1976 }, { "content": " def _print_log(self):\n self.debug_lock.acquire()\n i, n = self._cmd_log_idx, self._cmd_log_len\n if n: self._mesg('last %d log messages:' % n)\n while n:\n try:\n self._mesg(*self._cmd_log[i])\n except:\n pass\n i += 1\n if i >= self._cmd_log_len:\n i = 0\n n -= 1\n self.debug_lock.release()", "metadata": "root.IMAP4._print_log", "header": "['class', 'IMAP4', '(', 'object', ')', ':', '___EOS___']", "index": 1989 }, { "content": "class IMAP4_SSL(IMAP4):\n\n \"\"\"IMAP4 client class over SSL connection\n\n Instantiate with:\n IMAP4_SSL(host=None, port=None, keyfile=None, certfile=None, ca_certs=None, cert_verify_cb=None, ssl_version=\"ssl23\", debug=None, debug_file=None, identifier=None, timeout=None, debug_buf_lvl=None, tls_level=\"tls_compat\")\n\n host - host's name (default: localhost);\n port - port number (default: standard IMAP4 SSL port);\n keyfile - PEM formatted file that contains your private key (default: None);\n certfile - PEM formatted certificate chain file (default: None);\n ca_certs - PEM formatted certificate chain file used to validate server certificates (default: None);\n cert_verify_cb - function to verify authenticity of server certificates (default: None);\n ssl_version - SSL version to use (default: \"ssl23\", choose from: \"tls1\",\"ssl3\",\"ssl23\");\n debug - debug level (default: 0 - no debug);\n debug_file - debug stream (default: sys.stderr);\n identifier - thread identifier prefix (default: host);\n timeout - timeout in seconds when expecting a command response.\n debug_buf_lvl - debug level at which buffering is turned off.\n tls_level - TLS security level (default: \"tls_compat\").\n\n The recognized values for tls_level are:\n tls_secure: accept only TLS protocols recognized as \"secure\"\n tls_no_ssl: disable SSLv2 and SSLv3 support\n tls_compat: accept all SSL/TLS versions\n\n For more documentation see the docstring of the parent class IMAP4.\n \"\"\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.IMAP4_SSL", "header": "['module', '___EOS___']", "index": 2006 }, { "content": " def __init__(self, host=None, port=None, keyfile=None, certfile=None, ca_certs=None, cert_verify_cb=None, ssl_version=\"ssl23\", debug=None, debug_file=None, identifier=None, timeout=None, debug_buf_lvl=None, tls_level=TLS_COMPAT):\n self.keyfile = keyfile\n self.certfile = certfile\n self.ca_certs = ca_certs\n self.cert_verify_cb = cert_verify_cb\n self.ssl_version = ssl_version\n self.tls_level = tls_level\n IMAP4.__init__(self, host, port, debug, debug_file, identifier, timeout, debug_buf_lvl)", "metadata": "root.IMAP4_SSL.__init__", "header": "['class', 'IMAP4_SSL', '(', 'IMAP4', ')', ':', '___EOS___']", "index": 2036 }, { "content": " def open(self, host=None, port=None):\n \"\"\"open(host=None, port=None)\n Setup secure connection to remote server on \"host:port\"\n (default: localhost:standard IMAP4 SSL port).\n This connection will be used by the routines:\n read, send, shutdown, socket, ssl.\"\"\"\n\n self.host = self._choose_nonull_or_dflt('', host)\n self.port = self._choose_nonull_or_dflt(IMAP4_SSL_PORT, port)\n self.sock = self.open_socket()\n self.ssl_wrap_socket()", "metadata": "root.IMAP4_SSL.open", "header": "['class', 'IMAP4_SSL', '(', 'IMAP4', ')', ':', '___EOS___']", "index": 2046 }, { "content": " def read(self, size):\n \"\"\"data = read(size)\n Read at most 'size' bytes from remote.\"\"\"\n\n if self.decompressor is None:\n return self.sock.read(size)\n\n if self.decompressor.unconsumed_tail:\n data = self.decompressor.unconsumed_tail\n else:\n data = self.sock.read(READ_SIZE)\n\n return self.decompressor.decompress(data, size)", "metadata": "root.IMAP4_SSL.read", "header": "['class', 'IMAP4_SSL', '(', 'IMAP4', ')', ':', '___EOS___']", "index": 2059 }, { "content": " def send(self, data):\n \"\"\"send(data)\n Send 'data' to remote.\"\"\"\n\n if self.compressor is not None:\n data = self.compressor.compress(data)\n data += self.compressor.flush(zlib.Z_SYNC_FLUSH)\n\n if hasattr(self.sock, \"sendall\"):\n self.sock.sendall(data)\n else:\n dlen = len(data)\n while dlen > 0:\n sent = self.sock.write(data)\n if sent == dlen:\n break # avoid copy\n data = data[sent:]\n dlen = dlen - sent", "metadata": "root.IMAP4_SSL.send", "header": "['class', 'IMAP4_SSL', '(', 'IMAP4', ')', ':', '___EOS___']", "index": 2074 }, { "content": " def ssl(self):\n \"\"\"ssl = ssl()\n Return ssl instance used to communicate with the IMAP4 server.\"\"\"\n\n return self.sock", "metadata": "root.IMAP4_SSL.ssl", "header": "['class', 'IMAP4_SSL', '(', 'IMAP4', ')', ':', '___EOS___']", "index": 2094 }, { "content": "class IMAP4_stream(IMAP4):\n\n \"\"\"IMAP4 client class over a stream\n\n Instantiate with:\n IMAP4_stream(command, debug=None, debug_file=None, identifier=None, timeout=None, debug_buf_lvl=None)\n\n command - string that can be passed to subprocess.Popen();\n debug - debug level (default: 0 - no debug);\n debug_file - debug stream (default: sys.stderr);\n identifier - thread identifier prefix (default: host);\n timeout - timeout in seconds when expecting a command response.\n debug_buf_lvl - debug level at which buffering is turned off.\n\n For more documentation see the docstring of the parent class IMAP4.\n \"\"\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.IMAP4_stream", "header": "['module', '___EOS___']", "index": 2102 }, { "content": " def __init__(self, command, debug=None, debug_file=None, identifier=None, timeout=None, debug_buf_lvl=None):\n self.command = command\n self.host = command\n self.port = None\n self.sock = None\n self.writefile, self.readfile = None, None\n self.read_fd = None\n IMAP4.__init__(self, None, None, debug, debug_file, identifier, timeout, debug_buf_lvl)", "metadata": "root.IMAP4_stream.__init__", "header": "['class', 'IMAP4_stream', '(', 'IMAP4', ')', ':', '___EOS___']", "index": 2120 }, { "content": " def open(self, host=None, port=None):\n \"\"\"open(host=None, port=None)\n Setup a stream connection via 'self.command'.\n This connection will be used by the routines:\n read, send, shutdown, socket.\"\"\"\n\n from subprocess import Popen, PIPE\n from io import DEFAULT_BUFFER_SIZE\n\n if __debug__: self._log(0, 'opening stream from command \"%s\"' % self.command)\n self._P = Popen(self.command, shell=True, stdin=PIPE, stdout=PIPE, close_fds=True, bufsize=DEFAULT_BUFFER_SIZE)\n self.writefile, self.readfile = self._P.stdin, self._P.stdout\n self.read_fd = self.readfile.fileno()", "metadata": "root.IMAP4_stream.open", "header": "['class', 'IMAP4_stream', '(', 'IMAP4', ')', ':', '___EOS___']", "index": 2130 }, { "content": " def read(self, size):\n \"\"\"Read 'size' bytes from remote.\"\"\"\n\n if self.decompressor is None:\n return os.read(self.read_fd, size)\n\n if self.decompressor.unconsumed_tail:\n data = self.decompressor.unconsumed_tail\n else:\n data = os.read(self.read_fd, READ_SIZE)\n\n return self.decompressor.decompress(data, size)", "metadata": "root.IMAP4_stream.read", "header": "['class', 'IMAP4_stream', '(', 'IMAP4', ')', ':', '___EOS___']", "index": 2145 }, { "content": " def send(self, data):\n \"\"\"Send data to remote.\"\"\"\n\n if self.compressor is not None:\n data = self.compressor.compress(data)\n data += self.compressor.flush(zlib.Z_SYNC_FLUSH)\n\n self.writefile.write(data)\n self.writefile.flush()", "metadata": "root.IMAP4_stream.send", "header": "['class', 'IMAP4_stream', '(', 'IMAP4', ')', ':', '___EOS___']", "index": 2159 }, { "content": " def shutdown(self):\n \"\"\"Close I/O established in \"open\".\"\"\"\n\n self.readfile.close()\n self.writefile.close()\n self._P.wait()", "metadata": "root.IMAP4_stream.shutdown", "header": "['class', 'IMAP4_stream', '(', 'IMAP4', ')', ':', '___EOS___']", "index": 2170 }, { "content": "class _Authenticator(object):\n\n \"\"\"Private class to provide en/de-coding\n for base64 authentication conversation.\"\"\"\n\n\n\n", "metadata": "root._Authenticator", "header": "['module', '___EOS___']", "index": 2178 }, { "content": " def __init__(self, mechinst):\n self.mech = mechinst # Callable object to provide/process data", "metadata": "root._Authenticator.__init__", "header": "['class', '_Authenticator', '(', 'object', ')', ':', '___EOS___']", "index": 2183 }, { "content": " def process(self, data, rqb):\n ret = self.mech(self.decode(data))\n if ret is None:\n return b'*' # Abort conversation\n return self.encode(ret)", "metadata": "root._Authenticator.process", "header": "['class', '_Authenticator', '(', 'object', ')', ':', '___EOS___']", "index": 2186 }, { "content": " def encode(self, inp):\n #\n # Invoke binascii.b2a_base64 iteratively with\n # short even length buffers, strip the trailing\n # line feed from the result and append. \"Even\"\n # means a number that factors to both 6 and 8,\n # so when it gets to the end of the 8-bit input\n # there's no partial 6-bit output.\n #\n oup = b''\n if isinstance(inp, str):\n inp = inp.encode('ASCII')\n while inp:\n if len(inp) > 48:\n t = inp[:48]\n inp = inp[48:]\n else:\n t = inp\n inp = b''\n e = binascii.b2a_base64(t)\n if e:\n oup = oup + e[:-1]\n return oup", "metadata": "root._Authenticator.encode", "header": "['class', '_Authenticator', '(', 'object', ')', ':', '___EOS___']", "index": 2192 }, { "content": " def decode(self, inp):\n if not inp:\n return b''\n return binascii.a2b_base64(inp)", "metadata": "root._Authenticator.decode", "header": "['class', '_Authenticator', '(', 'object', ')', ':', '___EOS___']", "index": 2216 }, { "content": "class _IdleCont(object):\n\n \"\"\"When process is called, server is in IDLE state\n and will send asynchronous changes.\"\"\"\n\n", "metadata": "root._IdleCont", "header": "['module', '___EOS___']", "index": 2224 }, { "content": " def __init__(self, parent, timeout):\n self.parent = parent\n self.timeout = parent._choose_nonull_or_dflt(IDLE_TIMEOUT, timeout)\n self.parent.idle_timeout = self.timeout + time.time()", "metadata": "root._IdleCont.__init__", "header": "['class', '_IdleCont', '(', 'object', ')', ':', '___EOS___']", "index": 2229 }, { "content": " def process(self, data, rqb):\n self.parent.idle_lock.acquire()\n self.parent.idle_rqb = rqb\n self.parent.idle_timeout = self.timeout + time.time()\n self.parent.idle_lock.release()\n if __debug__: self.parent._log(2, 'server IDLE started, timeout in %.2f secs' % self.timeout)\n return None", "metadata": "root._IdleCont.process", "header": "['class', '_IdleCont', '(', 'object', ')', ':', '___EOS___']", "index": 2234 }, { "content": "def Internaldate2Time(resp):\n\n \"\"\"time_tuple = Internaldate2Time(resp)\n\n Parse an IMAP4 INTERNALDATE string.\n\n Return corresponding local time. The return value is a\n time.struct_time instance or None if the string has wrong format.\"\"\"\n\n mo = InternalDate.match(resp)\n if not mo:\n return None\n\n mon = Mon2num[mo.group('mon')]\n zonen = mo.group('zonen')\n\n day = int(mo.group('day'))\n year = int(mo.group('year'))\n hour = int(mo.group('hour'))\n min = int(mo.group('min'))\n sec = int(mo.group('sec'))\n zoneh = int(mo.group('zoneh'))\n zonem = int(mo.group('zonem'))\n\n # INTERNALDATE timezone must be subtracted to get UT\n\n zone = (zoneh*60 + zonem)*60\n if zonen == b'-':\n zone = -zone\n\n tt = (year, mon, day, hour, min, sec, -1, -1, -1)\n return time.localtime(calendar.timegm(tt) - zone)", "metadata": "root.Internaldate2Time", "header": "['module', '___EOS___']", "index": 2256 }, { "content": "def Time2Internaldate(date_time):\n\n \"\"\"'\"DD-Mmm-YYYY HH:MM:SS +HHMM\"' = Time2Internaldate(date_time)\n\n Convert 'date_time' to IMAP4 INTERNALDATE representation.\n\n The date_time argument can be a number (int or float) representing\n seconds since epoch (as returned by time.time()), a 9-tuple\n representing local time, an instance of time.struct_time (as\n returned by time.localtime()), an aware datetime instance or a\n double-quoted string. In the last case, it is assumed to already\n be in the correct format.\"\"\"\n\n from datetime import datetime, timezone, timedelta\n\n if isinstance(date_time, (int, float)):\n tt = time.localtime(date_time)\n elif isinstance(date_time, tuple):\n try:\n gmtoff = date_time.tm_gmtoff\n except AttributeError:\n if time.daylight:\n dst = date_time[8]\n if dst == -1:\n dst = time.localtime(time.mktime(date_time))[8]\n gmtoff = -(time.timezone, time.altzone)[dst]\n else:\n gmtoff = -time.timezone\n delta = timedelta(seconds=gmtoff)\n dt = datetime(*date_time[:6], tzinfo=timezone(delta))\n elif isinstance(date_time, datetime):\n if date_time.tzinfo is None:\n raise ValueError(\"date_time must be aware\")\n dt = date_time\n elif isinstance(date_time, str) and (date_time[0],date_time[-1]) == ('\"','\"'):\n return date_time # Assume in correct format\n else:\n raise ValueError(\"date_time not of a known type\")\n\n fmt = '\"%d-{}-%Y %H:%M:%S %z\"'.format(MonthNames[dt.month])\n return dt.strftime(fmt)", "metadata": "root.Time2Internaldate", "header": "['module', '___EOS___']", "index": 2293 }, { "content": "def ParseFlags(resp):\n\n \"\"\"('flag', ...) = ParseFlags(line)\n Convert IMAP4 flags response to python tuple.\"\"\"\n\n mo = FLAGS_cre.match(resp)\n if not mo:\n return ()\n\n return tuple(mo.group('flags').split())", "metadata": "root.ParseFlags", "header": "['module', '___EOS___']", "index": 2339 }, { "content": " def responder(cb_arg_list):\n response, cb_arg, error = cb_arg_list\n global AsyncError\n cmd, args = cb_arg\n if error is not None:\n AsyncError = error\n M._log(0, '[cb] ERROR %s %.100s => %s' % (cmd, args, error))\n return\n typ, dat = response\n M._log(0, '[cb] %s %.100s => %s %.100s' % (cmd, args, typ, dat))\n if typ == 'NO':\n AsyncError = (Exception, dat[0])", "metadata": "root.responder", "header": "['module', '___EOS___']", "index": 2438 }, { "content": " def run(cmd, args, cb=True):\n if AsyncError:\n M._log(1, 'AsyncError %s' % repr(AsyncError))\n M.logout()\n typ, val = AsyncError\n raise typ(val)\n if not M.debug: M._log(0, '%s %.100s' % (cmd, args))\n try:\n if cb:\n typ, dat = getattr(M, cmd)(callback=responder, cb_arg=(cmd, args), *args)\n M._log(1, '%s %.100s => %s %.100s' % (cmd, args, typ, dat))\n else:\n typ, dat = getattr(M, cmd)(*args)\n M._log(1, '%s %.100s => %s %.100s' % (cmd, args, typ, dat))\n except:\n M._log(1, '%s - %s' % sys.exc_info()[:2])\n M.logout()\n raise\n if typ == 'NO':\n M._log(1, 'NO')\n M.logout()\n raise Exception(dat[0])\n return dat", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 2451 } ]
[]
[]
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_", "\"\"\"", "Thread", "ed", " ", "IMAP", "4", " ", "client", " ", "for", " ", "Pyth", "on", " ", "3", ".", "\\", "10", ";", "\\", "10", ";", "Base", "d", " ", "on", " ", "RF", "C", " ", "350", "1", " ", "and", " ", "original", " ", "imap", "lib", " ", "module", ".", "\\", "10", ";", "\\", "10", ";", "Public", " ", "classe", "s", ":", " ", " ", " ", "IMAP", "4", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "IMAP", "4", "\\u", "SS", "L", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "IMAP", "4", "\\u", "stream", "\\", "10", ";", "\\", "10", ";", "Public", " ", "function", "s", ":", " ", "Intern", "ald", "ate", "2", "Time", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Pars", "e", "Fla", "gs", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "Time", "2", "Intern", "ald", "ate", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "\"", "IMAP", "4", "\"_", ",_", "\"", "IMAP", "4", "\\u", "SS", "L", "\"_", ",_", "\"", "IMAP", "4", "\\u", "stream", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Intern", "ald", "ate", "2", "Time", "\"_", ",_", "\"", "Pars", "e", "Fla", "gs", "\"_", ",_", "\"", "Time", "2", "Intern", "ald", "ate", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\"", "3.0", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "release", "\\u\\u_", "=_", "\"", "3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "revision\\u\\u_", "=_", "\"", "00", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "credits\\u\\u_", "=_", "\"\"\"", "\\", "10", ";", "Auth", "entica", "tion", " ", "code", " ", "contribute", "d", " ", "by", " ", "Don", "n", " ", "Cav", "e", " ", "<", "don", "n", "@", "u", ".", "wash", "ing", "ton", ".", "edu", ">", " ", "Jun", "e", " ", "199", "8", ".", "\\", "10", ";", "String", " ", "method", " ", "conve", "rsi", "on", " ", "by", " ", "ESR", ",", " ", "Fe", "bru", "ary", " ", "200", "1", ".", "\\", "10", ";", "GET", "/", "SET", "ACL", " ", "contribute", "d", " ", "by", " ", "Ant", "hon", "y", " ", "Ba", "xter", " ", "<", "ant", "hon", "y", "@", "interl", "ink", ".", "com", ".", "au", ">", " ", "Apri", "l", " ", "200", "1", ".", "\\", "10", ";", "IMAP", "4", "\\u", "SS", "L", " ", "contribute", "d", " ", "by", " ", "Tin", "o", " ", "Lang", "e", " ", "<", "Tin", "o", ".", "Lang", "e", "@", "is", "g", ".", "de", ">", " ", "March", " ", "2002", ".", "\\", "10", ";", "GET", "/", "SET", "QUOTA", " ", "contribute", "d", " ", "by", " ", "Andre", "as", " ", "Ze", "idle", "r", " ", "<", "az", "@", "kre", "ativ", "kom", "bin", "at", ".", "de", ">", " ", "Jun", "e", " ", "2002", ".", "\\", "10", ";", "PROX", "YA", "UTH", " ", "contribute", "d", " ", "by", " ", "Ric", "k", " ", "Hol", "bert", " ", "<", "hol", "bert", ".1", "3", "@", "osu", ".", "edu", ">", " ", "Nove", "mber", " ", "2002", ".", "\\", "10", ";", "IDLE", " ", "via", " ", "thread", "s", " ", "suggested", " ", "by", " ", "Phil", "ipp", "e", " ", "Norm", "and", " ", "<", "phil", "@", "resp", "yre", ".", "org", ">", " ", "Januar", "y", " ", "2005", ".", "\\", "10", ";", "GET", "/", "SET", "ANNOTAT", "ION", " ", "contribute", "d", " ", "by", " ", "Tom", "as", " ", "Lin", "dro", "os", " ", "<", "ski", "tta", "@", "abo", ".", "fi", ">", " ", "Jun", "e", " ", "2005", ".", "\\", "10", ";", "COMPRESS", "/", "DEF", "LATE", " ", "contribute", "d", " ", "by", " ", "Bro", "n", " ", "Gon", "dwa", "na", " ", "<", "bro", "ng", "@", "bro", "ng", ".", "net", ">", " ", "Ma", "y", " ", "200", "9", ".", "\\", "10", ";", "START", "TLS", " ", "from", " ", "Jy", "tho", "n", "'", "s", " ", "imap", "lib", " ", "by", " ", "Ala", "n", " ", "Ken", "ned", "y", ".", "\\", "10", ";", "ID", " ", "contribute", "d", " ", "by", " ", "Dav", "e", " ", "Bag", "gett", " ", "<", "dav", "e", "@", "bag", "gett", ".", "org", ">", " ", "Nove", "mber", " ", "200", "9", ".", "\\", "10", ";", "Impro", "ved", " ", "unta", "gged", " ", "response", "s", " ", "handling", " ", "suggested", " ", "by", " ", "Dav", "e", " ", "Bag", "gett", " ", "<", "dav", "e", "@", "bag", "gett", ".", "org", ">", " ", "Nove", "mber", " ", "200", "9", ".", "\\", "10", ";", "Impro", "ved", " ", "thread", " ", "nami", "ng", ",", " ", "and", " ", "0", " ", "read", " ", "detect", "ion", " ", "contribute", "d", " ", "by", " ", "Grant", " ", "Ed", "ward", "s", " ", "<", "grant", ".", "b", ".", "ed", "ward", "s", "@", "gma", "il", ".", "com", ">", " ", "Jun", "e", " ", "2010", ".", "\\", "10", ";", "Impro", "ved", " ", "timeo", "ut", " ", "handling", " ", "contribute", "d", " ", "by", " ", "Iv", "an", " ", "Vo", "vne", "nk", "o", " ", "<", "ivo", "vne", "nk", "o", "@", "gma", "il", ".", "com", ">", " ", "Oct", "obe", "r", " ", "2010", ".", "\\", "10", ";", "Time", "out", " ", "handling", " ", "fur", "ther", " ", "improve", "d", " ", "by", " ", "Eth", "an", " ", "Gla", "sse", "r", "-", "Camp", " ", "<", "glass", "e", "@", "cs", ".", "rpi", ".", "edu", ">", " ", "Dece", "mber", " ", "2010", ".", "\\", "10", ";", "Time", "2", "Intern", "ald", "ate", "()", " ", "patch", " ", "to", " ", "match", " ", "RF", "C2", "060", " ", "specifica", "tion", " ", "of", " ", "Eng", "lish", " ", "month", " ", "names", " ", "from", " ", "bug", "s", ".", "python", ".", "org", "/", "issue", "1102", "4", " ", "March", " ", "2011", ".", "\\", "10", ";", "startt", "ls", "()", " ", "bug", " ", "fixed", " ", "with", " ", "the", " ", "help", " ", "of", " ", "Se", "bast", "ian", " ", "Spa", "eth", " ", "<", "se", "bast", "ian", "@", "ssp", "ae", "th", ".", "de", ">", " ", "Apri", "l", " ", "2011", ".", "\\", "10", ";", "Thread", "s", " ", "now", " ", "set", " ", "the", " ", "\"", "daemon", "\"", " ", "flag", " ", "(", "suggested", " ", "by", " ", "offline", "imap", "-", "project", ")", " ", "Apri", "l", " ", "2011", ".", "\\", "10", ";", "Sing", "le", " ", "quoting", " ", "introduce", "d", " ", "with", " ", "the", " ", "help", " ", "of", " ", "Vla", "dim", "ir", " ", "Mar", "ek", " ", "<", "vla", "dim", "ir", ".", "mar", "ek", "@", "oracle", ".", "com", ">", " ", "August", " ", "2011", ".", "\\", "10", ";", "Supp", "ort", " ", "for", " ", "speci", "fy", "ing", " ", "SS", "L", " ", "version", " ", "by", " ", "Ry", "an", " ", "Ka", "van", "ag", "h", " ", "<", "rak", "@", "debi", "an", ".", "org", ">", " ", "Ju", "ly", " ", "2013", ".", "\\", "10", ";", "Fix", " ", "for", " ", "gma", "il", " ", "\"", "read", " ", "0", "\"", " ", "error", " ", "provided", " ", "by", " ", "Ji", "m", " ", "Green", "leaf", " ", "<", "jam", "es", ".", "a", ".", "green", "leaf", "@", "gma", "il", ".", "com", ">", " ", "August", " ", "2013", ".", "\\", "10", ";", "Fix", " ", "for", " ", "offline", "imap", " ", "\"", "indexer", "ror", ":", " ", "string", " ", "index", " ", "out", " ", "of", " ", "range", "\"", " ", "bug", " ", "provided", " ", "by", " ", "Ey", "gene", " ", "Ry", "abi", "nk", "in", " ", "<", "rea", "@", "code", "labs", ".", "ru", ">", " ", "August", " ", "2013", ".", "\\", "10", ";", "Fix", " ", "for", " ", "missi", "ng", " ", "idle", "\\u", "lock", " ", "in", " ", "\\u", "handler", "()", " ", "provided", " ", "by", " ", "Frankl", "in", " ", "Bro", "ok", " ", "<", "fran", "kli", "n", "@", "bro", "ok", ".", "se", ">", " ", "August", " ", "2014", ".", "\\", "10", ";", "Conversion", " ", "to", " ", "Pyth", "on", "3", " ", "provided", " ", "by", " ", "F", ".", " ", "Mal", "ina", " ", "<", "fma", "lin", "a", "@", "gma", "il", ".", "com", ">", " ", "Fe", "bru", "ary", " ", "201", "5", ".", "\\", "10", ";", "Fix", " ", "for", " ", "READ", "-", "ONL", "Y", " ", "error", " ", "from", " ", "multiple", " ", "EX", "AMI", "NE", "/", "SELECT", " ", "calls", " ", "by", " ", "Pie", "rre", "-", "Lou", "is", " ", "Bon", "ico", "li", " ", "<", "pie", "rre", "-", "lou", "is", ".", "bon", "ico", "li", "@", "gm", "x", ".", "fr", ">", " ", "March", " ", "201", "5", ".", "\\", "10", ";", "Fix", " ", "for", " ", "null", " ", "string", "s", " ", "append", "ed", " ", "to", " ", "unta", "gged", " ", "response", "s", " ", "by", " ", "Pie", "rre", "-", "Lou", "is", " ", "Bon", "ico", "li", " ", "<", "pie", "rre", "-", "lou", "is", ".", "bon", "ico", "li", "@", "gm", "x", ".", "fr", ">", " ", "March", " ", "201", "5", ".", "\\", "10", ";", "Fix", " ", "for", " ", "correct", " ", "byte", " ", "encoding", " ", "for", " ", "\\u", "CRA", "M", "\\u", "MD", "5", "\\u", "AUTH", " ", "take", "n", " ", "from", " ", "python", "3.5", " ", "imap", "lib", ".", "py", " ", "Jun", "e", " ", "201", "5", ".", "\\", "10", ";", "Fix", " ", "for", " ", "correct", " ", "Pyth", "on", " ", "3", " ", "exception", " ", "handling", " ", "by", " ", "To", "bias", " ", "Bri", "nk", " ", "<", "tob", "ias", ".", "bri", "nk", "@", "gma", "il", ".", "com", ">", " ", "August", " ", "201", "5", ".", "\\", "10", ";", "Fix", " ", "to", " ", "allow", " ", "interrupt", "ibl", "e", " ", "IDLE", " ", "command", " ", "by", " ", "Tim", " ", "Pe", "opl", "es", " ", "<", "dro", "med", "ary", "512", "@", "users", ".", "sf", ".", "net", ">", " ", "Sept", "ember", " ", "201", "5", ".", "\\", "10", ";", "Add", " ", "support", " ", "for", " ", "TLS", " ", "level", "s", " ", "by", " ", "Ben", " ", "Bo", "eck", "el", " ", "<", "maths", "tuf", "@", "gma", "il", ".", "com", ">", " ", "Sept", "ember", " ", "201", "5", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Pie", "rs", " ", "Lau", "der", " ", "<", "pie", "rs", "@", "jane", "eli", "x", ".", "com", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "URL", "\\u\\u_", "=_", "\"", "http", "://", "imap", "lib", "2", ".", "sourcef", "org", "e", ".", "net", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "Pyth", "on", " ", "License", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "binascii_", ",_", "calendar_", ",_", "errno_", ",_", "os_", ",_", "queue_", ",_", "random_", ",_", "re_", ",_", "select_", ",_", "socket_", ",_", "sys_", ",_", "time_", ",_", "threading_", ",_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "select", "\\u", "module_", "=_", "select_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Globals_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CRL", "F_", "=_", "b", "'\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMAP", "4", "\\u", "PORT_", "=_", "143_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMAP", "4", "\\u", "SS", "L", "\\u", "PORT_", "=_", "993", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "IDLE", "\\u", "TIME", "OUT", "\\u", "RESPONSE_", "=_", "b", "'*", " ", "IDLE", " ", "TIME", "OUT", "\\\\", "r", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IDLE", "\\u", "TIMEOUT_", "=_", "60_", "*_", "29_", "#", " ", "Don", "'", "t", " ", "stay", " ", "in", " ", "IDLE", " ", "state", " ", "long", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "READ", "\\u", "POLL", "\\u", "TIMEOUT_", "=_", "30_", "#", " ", "With", "out", " ", "this", " ", "timeo", "ut", " ", "interrupted", " ", "network", " ", "connections", " ", "can", " ", "hang", " ", "reader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "READ", "\\u", "SIZE_", "=_", "32768_", "#", " ", "Consume", " ", "all", " ", "avail", "able", " ", "in", " ", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DF", "LT", "\\u", "DEBU", "G", "\\u", "BUF", "\\u", "LV", "L_", "=_", "3_", "#", " ", "Leve", "l", " ", "above", " ", "whi", "ch", " ", "the", " ", "logg", "ing", " ", "output", " ", "go", "es", " ", "direct", "ly", " ", "to", " ", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TLS", "\\u", "SECU", "RE_", "=_", "\"", "tls", "\\u", "secure", "\"_", "#", " ", "Reco", "gni", "sed", " ", "TLS", " ", "levels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TLS", "\\u", "NO", "\\u", "SSL_", "=_", "\"", "tls", "\\u", "no", "\\u", "ssl", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TLS", "\\u", "COMPA", "T_", "=_", "\"", "tls", "\\u", "compa", "t", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "All", "owe", "d", "Version", "s_", "=_", "(_", "'", "IMAP", "4", "REV", "1", "'_", ",_", "'", "IMAP", "4", "'_", ")_", "#", " ", "Mos", "t", " ", "recent", " ", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Commands_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CMD", "\\u", "VAL", "\\u", "STATES_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CMD", "\\u", "VAL", "\\u", "ASYN", "C_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NON", "AUTH_", ",_", "AUTH_", ",_", "SELECTED", "_", ",_", "LOGO", "UT_", "=_", "'", "NON", "AUTH", "'_", ",_", "'", "AUTH", "'_", ",_", "'", "SELECTED", "'_", ",_", "'", "LOGO", "UT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Commands_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "name", " ", " ", " ", " ", "valid", " ", "state", "s", " ", " ", " ", " ", " ", "async", "hronous", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "APPEN", "D", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AUTH", "ENTI", "CATE", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CAPA", "BILITY", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CHECK", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CLOSE", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "COMPRESS", "'_", ":_", "(_", "(_", "AUTH_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "COPY", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CREATE", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DELET", "E", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DELET", "EAC", "L", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "EX", "AMI", "NE", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "EXP", "UN", "GE", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "FETCH", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "GET", "ACL", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "GET", "ANNOTAT", "ION", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "GET", "QUOTA", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "GET", "QUOTA", "ROO", "T", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ID", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", "AUTH_", ",_", "LOGO", "UT_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "IDLE", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LIST", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LOGIN", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LOGO", "UT", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", "AUTH_", ",_", "LOGO", "UT_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LS", "UB", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "MY", "RIG", "HT", "S", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NAMESPACE", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NOO", "P", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PARTI", "AL", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PROX", "YA", "UTH", "'_", ":_", "(_", "(_", "AUTH_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "RENA", "ME", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SEARCH", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SELECT", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SET", "ACL", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SET", "ANNOTAT", "ION", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SET", "QUOTA", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SORT", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "START", "TLS", "'_", ":_", "(_", "(_", "NON", "AUTH_", ",_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "STATUS", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "STORE", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SUBSCRI", "BE", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "THREAD", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "UI", "D", "'_", ":_", "(_", "(_", "SELECTED", "_", ",_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "UNSU", "BS", "CRI", "BE", "'_", ":_", "(_", "(_", "AUTH_", ",_", "SELECTED", "_", ")_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UI", "D", "\\u", "direct_", "=_", "(_", "'", "SEARCH", "'_", ",_", "'", "SORT", "'_", ",_", "'", "THREAD", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Mont", "h", "Names_", "=_", "[_", "None_", ",_", "'", "Jan", "'_", ",_", "'", "Fe", "b", "'_", ",_", "'", "Mar", "'_", ",_", "'", "Ap", "r", "'_", ",_", "'", "Ma", "y", "'_", ",_", "'", "Jun", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ju", "l", "'_", ",_", "'", "Au", "g", "'_", ",_", "'", "Se", "p", "'_", ",_", "'", "Oct", "'_", ",_", "'", "Nov", "'_", ",_", "'", "De", "c", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Mon", "2n", "um_", "=_", "{_", "s_", "._", "encode_", "(_", ")_", ":_", "n_", "+_", "1_", "for_", "n_", ",_", "s_", "in_", "enumerate_", "(_", "Mont", "h", "Names_", "[_", "1_", ":_", "]_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Intern", "al", "Date_", "=_", "re_", "._", "compile_", "(_", "br", "'.*", "INTERN", "AL", "DAT", "E", " ", "\"'_", "\\u\\u\\uNL\\u\\u\\u_", "br", "'(", "?", "P", "<", "day", ">[", " ", "0123", "][", "0", "-", "9", "])", "-(", "?", "P", "<", "mon", ">[", "A", "-", "Z", "][", "a", "-", "z", "][", "a", "-", "z", "])", "-(", "?", "P", "<", "year", ">[", "0", "-", "9", "][", "0", "-", "9", "][", "0", "-", "9", "][", "0", "-", "9", "])'_", "\\u\\u\\uNL\\u\\u\\u_", "br", "'", " ", "(?", "P", "<", "hour", ">[", "0", "-", "9", "][", "0", "-", "9", "])", ":(?", "P", "<", "min", ">[", "0", "-", "9", "][", "0", "-", "9", "])", ":(?", "P", "<", "sec", ">[", "0", "-", "9", "][", "0", "-", "9", "])'_", "\\u\\u\\uNL\\u\\u\\u_", "br", "'", " ", "(?", "P", "<", "zone", "n", ">[-", "+]", ")(?", "P", "<", "zone", "h", ">[", "0", "-", "9", "][", "0", "-", "9", "])(", "?", "P", "<", "zone", "m", ">[", "0", "-", "9", "][", "0", "-", "9", "])'_", "\\u\\u\\uNL\\u\\u\\u_", "br", "'\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "Intern", "ald", "ate", "2t", "uple_", "=_", "Intern", "ald", "ate", "2", "Time_", "#", " ", "(", "Backward", " ", "compatible", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "FLAG", "S", "\\u", "cre", "_", "=_", "re_", "._", "compile_", "(_", "br", "'.*", "FLAG", "S", " ", "\\\\((", "?", "P", "<", "flags", ">[", "^", "\\\\)", "]*)", "\\\\)", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "test", ":", " ", "invoke", " ", "eit", "her", " ", "as", " ", "'", "python", " ", "imap", "lib", "2", ".", "py", " ", "[", "IMAP", "4", "\\u", "server", "\\u", "host", "name", "]'", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "as", " ", "'", "python", " ", "imap", "lib", "2", ".", "py", " ", "-", "s", " ", "\"", "rsh", " ", "IMAP", "4", "\\u", "server", "\\u", "host", "name", " ", "exec", " ", "/", "etc", "/", "rim", "apd", "\"'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "as", " ", "'", "python", " ", "imap", "lib", "2", ".", "py", " ", "-", "l", " ", "keyfile", "[:", "certfile", "]|", ":", " ", "[", "IMAP", "4", "\\u", "SS", "L", "\\u", "server", "\\u", "host", "name", "]'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "n", " ", "\"-", "d", " ", "<", "level", ">\"", " ", "turns", " ", "on", " ", "debugg", "ing", " ", "(", "use", " ", "\"-", "d", " ", "5", "\"", " ", "for", " ", "every", "thing", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "n", " ", "\"-", "i", "\"", " ", "tests", " ", "tha", "t", " ", "IDLE", " ", "is", " ", "interrupt", "ible_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "n", " ", "\"-", "p", " ", "<", "port", ">\"", " ", "allow", "s", " ", "alternat", "e", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Ple", "ase", " ", "run", " ", "with", "out", " ", "-", "O", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "getopt_", ",_", "getpass_", "\\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 ", " _", "opt", "list_", ",_", "args_", "=_", "getopt_", "._", "getopt_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ",_", "'", "d", ":", "il", ":", "s", ":", "p", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "getopt_", "._", "error_", "as_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "list_", ",_", "args_", "=_", "(_", ")_", ",_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "debug_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", ",_", "port_", ",_", "stream", "\\u", "command_", ",_", "keyfile_", ",_", "certfile", "_", ",_", "idle", "\\u", "intr", "_", "=_", "(_", "None_", ",_", ")_", "*_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opt_", ",_", "val_", "in_", "opt", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opt_", "==_", "'-", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug_", "=_", "int_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "debug_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "i", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idle", "\\u", "intr", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "l", "'_", ":_", "\\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 ", " _", "keyfile_", ",_", "certfile", "_", "=_", "val_", "._", "split_", "(_", "':'_", ")_", "\\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 ", " _", "keyfile_", ",_", "certfile", "_", "=_", "val_", ",_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "p", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "int_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opt_", "==_", "'-", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stream", "\\u", "command_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "args_", ":_", "args_", "=_", "(_", "stream", "\\u", "command_", ",_", ")_", "\\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_", "args_", ":_", "args_", "=_", "(_", "''_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "port_", ":_", "port_", "=_", "(_", "keyfile_", "is_", "not_", "None_", ")_", "and_", "IMAP", "4", "\\u", "SS", "L", "\\u", "PORT_", "or_", "IMAP", "4", "\\u", "PORT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "USER_", "=_", "getpass_", "._", "getuser", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "open_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "\"", "test", ".", "data", "\"_", ")_", "and_", "\"", "test", ".", "data", "\"_", "or_", "\\u\\u", "file\\u\\u_", ")_", "._", "read_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "mesg_", "=_", "'", "Fro", "m", ":", " ", "%", "(", "user", ")", "s", "@", "local", "host", "%", "(", "lf", ")", "s", "Sub", "ject", ":", " ", "IMAP", "4", " ", "test", "%", "(", "lf", ")", "s", "%", "(", "lf", ")", "s", "%", "(", "data", ")", "s", "'_", "%_", "{_", "'", "user", "'_", ":_", "USER_", ",_", "'", "lf", "'_", ":_", "'\\\\", "n", "'_", ",_", "'", "data", "'_", ":_", "data_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "seq1_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "list", "'_", ",_", "(_", "'\"\"'_", ",_", "'\"\"'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "list", "'_", ",_", "(_", "'\"\"'_", ",_", "'\"", "%", "\"'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "create", "'_", ",_", "(_", "'", "imap", "lib", "2", "\\u", "test0", "'_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "rename", "'_", ",_", "(_", "'", "imap", "lib", "2", "\\u", "test0", "'_", ",_", "'", "imap", "lib", "2", "\\u", "test", "1", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "CREATE", "'_", ",_", "(_", "'", "imap", "lib", "2", "\\u", "test", "2", "'_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "append", "'_", ",_", "(_", "'", "imap", "lib", "2", "\\u", "test", "2", "'_", ",_", "None_", ",_", "None_", ",_", "test\\u", "mesg_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "list", "'_", ",_", "(_", "'\"\"'_", ",_", "'\"", "imap", "lib", "2", "\\u", "test", "%", "\"'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "select", "'_", ",_", "(_", "'", "imap", "lib", "2", "\\u", "test", "2", "'_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "search", "'_", ",_", "(_", "None_", ",_", "'", "SUBJECT", "'_", ",_", "'\"", "IMAP", "4", " ", "test", "\"'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fetch", "'_", ",_", "(_", "'", "1", ":*", "'_", ",_", "'(", "FLAG", "S", " ", "INTERN", "AL", "DAT", "E", " ", "RF", "C8", "2", "2", ")'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "store", "'_", ",_", "(_", "'", "1", "'_", ",_", "'", "FLAG", "S", "'_", ",_", "'(\\\\", "Delete", "d", ")'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "namespace", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "exp", "unge", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "recent", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "close", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "seq2_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "select", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "response", "'_", ",_", "(_", "'", "UI", "DV", "ALI", "DI", "TY", "'_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "response", "'_", ",_", "(_", "'", "EXIST", "S", "'_", ",_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "append", "'_", ",_", "(_", "None_", ",_", "None_", ",_", "None_", ",_", "test\\u", "mesg_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "examine", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "select", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fetch", "'_", ",_", "(_", "'", "1", ":*", "'_", ",_", "'(", "FLAG", "S", " ", "UI", "D", ")'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "examine", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "select", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "uid", "'_", ",_", "(_", "'", "SEARCH", "'_", ",_", "'", "SUBJECT", "'_", ",_", "'\"", "IMAP", "4", " ", "test", "\"'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "uid", "'_", ",_", "(_", "'", "SEARCH", "'_", ",_", "'", "ALL", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "uid", "'_", ",_", "(_", "'", "THREAD", "'_", ",_", "'", "reference", "s", "'_", ",_", "'", "UT", "F", "-", "8", "'_", ",_", "'(", "SEE", "N", ")'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "recent", "'_", ",_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Async", "Error_", ",_", "M_", "=_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "set", "Name_", "(_", "'", "main", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "keyfile_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "keyfile_", ":_", "keyfile_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "certfile", "_", ":_", "certfile", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "=_", "IMAP", "4", "\\u", "SSL_", "(_", "host_", "=_", "host_", ",_", "port_", "=_", "port_", ",_", "keyfile_", "=_", "keyfile_", ",_", "certfile", "_", "=_", "certfile", "_", ",_", "ssl", "\\u", "version_", "=_", "\"", "tls", "1", "\"_", ",_", "debug_", "=_", "debug_", ",_", "identifier_", "=_", "''_", ",_", "timeout_", "=_", "10_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "debug", "\\u", "buf", "\\u", "lvl_", ",_", "tls", "\\u", "level_", "=_", "\"", "tls", "\\u", "no", "\\u", "ssl", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stream", "\\u", "command_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "=_", "IMAP", "4", "\\u", "stream_", "(_", "stream", "\\u", "command_", ",_", "debug_", "=_", "debug_", ",_", "identifier_", "=_", "''_", ",_", "timeout_", "=_", "10_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "debug", "\\u", "buf", "\\u", "lvl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "=_", "IMAP", "4_", "(_", "host_", "=_", "host_", ",_", "port_", "=_", "port_", ",_", "debug_", "=_", "debug_", ",_", "identifier_", "=_", "''_", ",_", "timeout_", "=_", "10_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "debug", "\\u", "buf", "\\u", "lvl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "M_", "._", "state_", "!=_", "'", "AUTH", "'_", ":_", "#", " ", "Logi", "n", " ", "needed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PASS", "WD", "_", "=_", "getpass_", "._", "getpass_", "(_", "\"", "IMAP", " ", "password", " ", "for", " ", "%", "s", " ", "on", " ", "%", "s", ":", " ", "\"_", "%_", "(_", "USER_", ",_", "host_", "or_", "\"", "local", "host", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "seq1_", "._", "insert_", "(_", "0_", ",_", "(_", "'", "login", "'_", ",_", "(_", "USER_", ",_", "PASS", "WD", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "M_", "._", "\\u", "log_", "(_", "0_", ",_", "'", "PROTOCOL", "\\u", "VERSI", "ON", " ", "=", " ", "%", "s", "'_", "%_", "M_", "._", "PROTOCOL", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "COMPRESS", "=", "DEF", "LATE", "'_", "in_", "M_", "._", "capabilities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "enable", "\\u", "compression_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cmd_", ",_", "args_", "in_", "test\\u", "seq1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "cmd_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ml_", "in_", "run_", "(_", "'", "list", "'_", ",_", "(_", "'\"\"'_", ",_", "'\"", "imap", "lib", "2", "\\u", "test", "%", "\"'_", ")_", ",_", "cb_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mo_", "=_", "re_", "._", "match_", "(_", "br", "'.*", "\"([", "^", "\"]+", ")\"", "$'_", ",_", "ml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mo_", ":_", "path_", "=_", "mo_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "path_", "=_", "ml_", "._", "split_", "(_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "delete", "'_", ",_", "(_", "path_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "ID", "'_", "in_", "M_", "._", "capabilities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "'", "id", "'_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "id", "'_", ",_", "(_", "\"(", "name", " ", "imap", "lib", "2", ")\"_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "id", "'_", ",_", "(_", "\"", "version", "\"_", ",_", "\\u\\u", "version\\u\\u_", ",_", "\"", "os", "\"_", ",_", "os_", "._", "uname_", "(_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cmd_", ",_", "args_", "in_", "test\\u", "seq2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "cmd_", ",_", "args_", ")_", "!=_", "(_", "'", "uid", "'_", ",_", "(_", "'", "SEARCH", "'_", ",_", "'", "SUBJECT", "'_", ",_", "'", "IMAP", "4", " ", "test", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "cmd_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dat_", "=_", "run_", "(_", "cmd_", ",_", "args_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", "=_", "dat_", "[_", "-_", "1_", "]_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "uid_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "uid", "'_", ",_", "(_", "'", "FETCH", "'_", ",_", "uid_", "[_", "-_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "FLAG", "S", " ", "INTERN", "AL", "DAT", "E", " ", "RF", "C8", "22.", "SIZE", " ", "RF", "C8", "22.", "HEAD", "ER", " ", "RF", "C8", "22.", "TEXT", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "uid", "'_", ",_", "(_", "'", "STORE", "'_", ",_", "uid_", "[_", "-_", "1_", "]_", ",_", "'", "FLAG", "S", "'_", ",_", "'(\\\\", "Delete", "d", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "exp", "unge", "'_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "IDLE", "'_", "in_", "M_", "._", "capabilities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "'", "idle", "'_", ",_", "(_", "2_", ",_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "idle", "'_", ",_", "(_", "99_", ",_", ")_", ")_", "#", " ", "Async", "hronous", ",", " ", "to", " ", "test", " ", "interrupt", "ion", " ", "of", " ", "'", "idle", "'", " ", "by", " ", "'", "noop", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "noop", "'_", ",_", "(_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "(_", "'", "append", "'_", ",_", "(_", "None_", ",_", "None_", ",_", "None_", ",_", "test\\u", "mesg_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", "=_", "run_", "(_", "'", "search", "'_", ",_", "(_", "None_", ",_", "'", "ALL", "'_", ")_", ",_", "cb_", "=_", "False_", ")_", "[_", "0_", "]_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dat_", "=_", "run_", "(_", "'", "fetch", "'_", ",_", "(_", "num_", ",_", "'(", "FLAG", "S", " ", "INTERN", "AL", "DAT", "E", " ", "RF", "C8", "2", "2", ")'_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "mesg_", "(_", "'", "fetch", " ", "%", "s", " ", "=>", " ", "%", "s", "'_", "%_", "(_", "num_", ",_", "repr_", "(_", "dat_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "idle", "'_", ",_", "(_", "2_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "store", "'_", ",_", "(_", "num_", ",_", "'-", "FLAG", "S", "'_", ",_", "'(\\\\", "Seen", ")'_", ")_", ",_", "cb_", "=_", "False_", ")_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dat_", "=_", "run_", "(_", "'", "fetch", "'_", ",_", "(_", "num_", ",_", "'(", "FLAG", "S", " ", "INTERN", "AL", "DAT", "E", " ", "RF", "C8", "2", "2", ")'_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "mesg_", "(_", "'", "fetch", " ", "%", "s", " ", "=>", " ", "%", "s", "'_", "%_", "(_", "num_", ",_", "repr_", "(_", "dat_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "uid", "'_", ",_", "(_", "'", "STORE", "'_", ",_", "num_", ",_", "'", "FLAG", "S", "'_", ",_", "'(\\\\", "Delete", "d", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "'", "exp", "unge", "'_", ",_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "idle", "\\u", "intr", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "\\u", "mesg_", "(_", "'", "HIT", " ", "CTR", "L", "-", "C", " ", "to", " ", "interrupt", " ", "IDLE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "run_", "(_", "'", "idle", "'_", ",_", "(_", "99_", ",_", ")_", ",_", "cb_", "=_", "False_", ")_", "#", " ", "Synchro", "nous", ",", " ", "to", " ", "test", " ", "interrupt", "ion", " ", "of", " ", "'", "idle", "'", " ", "by", " ", "INT", "R_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "M_", "._", "\\u", "mesg_", "(_", "'", "Thanks", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "mesg_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "idle", "\\u", "intr", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "\\u", "mesg_", "(_", "'", "chosen", " ", "server", " ", "doe", "s", " ", "not", " ", "report", " ", "IDLE", " ", "capab", "ilit", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run_", "(_", "'", "logo", "ut", "'_", ",_", "(_", ")_", ",_", "cb_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "\\u", "mesg_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "print", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "mesg_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "mesg_", "(_", "'", "unu", "sed", " ", "unta", "gged", " ", "response", "s", " ", "in", " ", "order", ",", " ", "most", " ", "recent", " ", "last", ":'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "typ_", ",_", "dat_", "in_", "M_", "._", "pop", "\\u", "unta", "gged", "\\u", "responses_", "(_", ")_", ":_", "M_", "._", "\\u", "mesg_", "(_", "'\\\\", "t", "%", "s", " ", "%", "s", "'_", "%_", "(_", "typ_", ",_", "dat_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'", "All", " ", "tests", " ", "OK", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "idle", "\\u", "intr", "_", "or_", "M_", "is_", "None_", "or_", "not_", "'", "IDLE", "'_", "in_", "M_", "._", "capabilities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Test", "s", " ", "fail", "ed", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'''", "\\", "10", ";", "If", " ", "you", " ", "wou", "ld", " ", "like", " ", "to", " ", "see", " ", "debugg", "ing", " ", "output", ",", "\\", "10", ";", "try", ":", " ", "%", "s", " ", "-", "d5", "\\", "10", ";'", "''_", "%_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\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_", "Int", "2", "AP_", "(_", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "string", " ", "=", " ", "Int", "2", "AP", "(", "num", ")", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "'", "num", "'", " ", "convert", "ed", " ", "to", " ", "bytes", " ", "usi", "ng", " ", "character", "s", " ", "from", " ", "the", " ", "set", " ", "'", "A", "'..", "'", "P", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "val_", "=_", "b", "''_", ";_", "AP_", "=_", "b", "'", "ABCDE", "FG", "HI", "JK", "LM", "NOP", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", "=_", "int_", "(_", "abs_", "(_", "num_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num_", ",_", "mod_", "=_", "divmod_", "(_", "num_", ",_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "AP_", "[_", "mod_", ":_", "mod_", "+_", "1_", "]_", "+_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Request_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Priva", "te", " ", "class", " ", "to", " ", "represent", " ", "a", " ", "request", " ", "await", "ing", " ", "response", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Request_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", ",_", "name_", "=_", "None_", ",_", "callback_", "=_", "None_", ",_", "cb", "\\u", "arg_", "=_", "None_", ",_", "cb", "\\u", "self_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "callback_", "=_", "callback_", "#", " ", "Function", " ", "call", "ed", " ", "to", " ", "process", " ", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "cb", "\\u", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "callback", "\\u", "arg_", "=_", "cb", "\\u", "arg_", "#", " ", "Optio", "nal", " ", "arg", " ", "pass", "ed", " ", "to", " ", "\"", "callback", "\"_", "\\u\\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_", "._", "callback", "\\u", "arg_", "=_", "(_", "self_", ",_", "cb", "\\u", "arg_", ")_", "#", " ", "Self", " ", "reference", " ", "require", "d", " ", "in", " ", "callback", " ", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "tag_", "=_", "parent_", "._", "tag", "pre_", "+_", "bytes_", "(_", "str_", "(_", "parent_", "._", "tag", "num_", ")_", ",_", "'", "ASCII", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "tag", "num_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ready_", "=_", "threading_", "._", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "abort", "ed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "abort_", "(_", "self_", ",_", "typ_", ",_", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abort", "ed_", "=_", "(_", "typ_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "deliver", "_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "response_", "(_", "self_", ",_", "exc", "\\u", "fmt_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "callback_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "parent_", "._", "\\u", "log_", "(_", "3_", ",_", "'%", "s", ":", "%", "s", ".", "read", "y", ".", "wait", "'_", "%_", "(_", "self_", "._", "name_", ",_", "self_", "._", "tag_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ready_", "._", "wait_", "(_", "threading_", "._", "TIME", "OUT", "\\u", "MAX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "abort", "ed_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "val_", "=_", "self_", "._", "abort", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exc", "\\u", "fmt_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "fmt_", "=_", "'%", "s", " ", "-", " ", "%%", "s", "'_", "%_", "typ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "typ_", "(_", "exc", "\\u", "fmt_", "%_", "str_", "(_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deliver", "_", "(_", "self_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "callback_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "callback_", "(_", "(_", "response_", ",_", "self_", "._", "callback", "\\u", "arg_", ",_", "self_", "._", "abort", "ed_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "response_", "=_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ready_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "parent_", "._", "\\u", "log_", "(_", "3_", ",_", "'%", "s", ":", "%", "s", ".", "read", "y", ".", "set", "'_", "%_", "(_", "self_", "._", "name_", ",_", "self_", "._", "tag_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thread", "ed", " ", "IMAP", "4", " ", "client", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Instantiate", " ", "with", ":", "\\", "10", ";", " ", " ", " ", " ", "IMAP", "4", "(", "host", "=", "Non", "e", ",", " ", "port", "=", "Non", "e", ",", " ", "debug", "=", "Non", "e", ",", " ", "debug", "\\u", "file", "=", "Non", "e", ",", " ", "identifi", "er", "=", "Non", "e", ",", " ", "timeo", "ut", "=", "Non", "e", ",", " ", "debug", "\\u", "buf", "\\u", "lvl", "=", "Non", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "host", " ", " ", "-", " ", "host", "'", "s", " ", "name", " ", "(", "default", ":", " ", "local", "host", ");", "\\", "10", ";", " ", " ", " ", " ", "port", " ", " ", "-", " ", "port", " ", "number", " ", "(", "default", ":", " ", "standard", " ", "IMAP", "4", " ", "port", ");", "\\", "10", ";", " ", " ", " ", " ", "debug", " ", " ", " ", " ", " ", "-", " ", "debug", " ", "level", " ", "(", "default", ":", " ", "0", " ", "-", " ", "no", " ", "debug", ");", "\\", "10", ";", " ", " ", " ", " ", "debug", "\\u", "file", " ", " ", " ", " ", "-", " ", "debug", " ", "stream", " ", "(", "default", ":", " ", "sys", ".", "std", "err", ");", "\\", "10", ";", " ", " ", " ", " ", "identifi", "er", " ", " ", " ", " ", "-", " ", "thread", " ", "identifi", "er", " ", "prefix", " ", "(", "default", ":", " ", "host", ");", "\\", "10", ";", " ", " ", " ", " ", "timeo", "ut", " ", " ", " ", "-", " ", "timeo", "ut", " ", "in", " ", "second", "s", " ", "whe", "n", " ", "expect", "ing", " ", "a", " ", "command", " ", "response", " ", "(", "default", ":", " ", "no", " ", "timeo", "ut", "),", "\\", "10", ";", " ", " ", " ", " ", "debug", "\\u", "buf", "\\u", "lvl", " ", "-", " ", "debug", " ", "level", " ", "at", " ", "whi", "ch", " ", "bufferi", "ng", " ", "is", " ", "turn", "ed", " ", "off", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "IMAP", "4", "rev", "1", " ", "command", "s", " ", "are", " ", "support", "ed", " ", "by", " ", "method", "s", " ", "of", " ", "the", " ", "same", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "command", " ", "return", "s", " ", "a", " ", "tuple", ":", " ", "(", "type", ",", " ", "[", "data", ",", " ", "...]", ")", " ", "where", " ", "'", "type", "'", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "usual", "ly", " ", "'", "OK", "'", " ", "or", " ", "'", "NO", "',", " ", "and", " ", "'", "data", "'", " ", "is", " ", "eit", "her", " ", "the", " ", "text", " ", "from", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "tagg", "ed", " ", "response", ",", " ", "or", " ", "unta", "gged", " ", "results", " ", "from", " ", "command", ".", " ", "Ea", "ch", " ", "'", "data", "'", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "eit", "her", " ", "a", " ", "string", ",", " ", "or", " ", "a", " ", "tuple", ".", " ", "If", " ", "a", " ", "tuple", ",", " ", "then", " ", "the", " ", "first", " ", "part", " ", "is", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "header", " ", "of", " ", "the", " ", "response", ",", " ", "and", " ", "the", " ", "second", " ", "part", " ", "contain", "s", " ", "the", " ", "data", " ", "(", "ie", ":", "\\", "10", ";", " ", " ", " ", " ", "'", "literal", "'", " ", "value", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Error", "s", " ", "raise", " ", "the", " ", "exception", " ", "class", " ", "<", "instance", ">.", "error", "(\"", "<", "reason", ">\"", ").", "\\", "10", ";", " ", " ", " ", " ", "IMAP", "4", " ", "server", " ", "error", "s", " ", "raise", " ", "<", "instance", ">.", "abort", "(\"", "<", "reason", ">\"", "),", " ", "whi", "ch", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "sub", "-", "class", " ", "of", " ", "'", "error", "'.", " ", "Mail", "box", " ", "status", " ", "change", "s", " ", "from", " ", "READ", "-", "WRITE", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "READ", "-", "ONL", "Y", " ", "raise", " ", "the", " ", "exception", " ", "class", " ", "<", "instance", ">.", "read", "only", "(\"", "<", "reason", ">\"", "),", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "is", " ", "a", " ", "sub", "-", "class", " ", "of", " ", "'", "abort", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"", "error", "\"", " ", "exception", "s", " ", "impl", "y", " ", "a", " ", "program", " ", "error", ".", "\\", "10", ";", " ", " ", " ", " ", "\"", "abort", "\"", " ", "exception", "s", " ", "impl", "y", " ", "the", " ", "connecti", "on", " ", "shou", "ld", " ", "be", " ", "reset", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "command", " ", "re", "-", "trie", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"", "read", "only", "\"", " ", "exception", "s", " ", "impl", "y", " ", "the", " ", "command", " ", "shou", "ld", " ", "be", " ", "re", "-", "trie", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "command", "s", " ", "take", " ", "two", " ", "option", "al", " ", "named", " ", "argu", "ment", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "'", "callback", "'", " ", "and", " ", "'", "cb", "\\u", "arg", "'", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "'", "callback", "'", " ", "is", " ", "provided", " ", "then", " ", "the", " ", "command", " ", "is", " ", "async", "hronous", ",", " ", "so", " ", "after", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "command", " ", "is", " ", "queue", "d", " ", "for", " ", "transmission", ",", " ", "the", " ", "call", " ", "return", "s", " ", "immediate", "ly", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "the", " ", "tuple", " ", "(", "Non", "e", ",", " ", "Non", "e", ").", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "result", " ", "will", " ", "be", " ", "poste", "d", " ", "by", " ", "inv", "oki", "ng", " ", "\"", "callback", "\"", " ", "with", " ", "one", " ", "arg", ",", " ", "a", " ", "tuple", ":", "\\", "10", ";", " ", " ", " ", " ", "callback", "((", "result", ",", " ", "cb", "\\u", "arg", ",", " ", "Non", "e", "))\\", "10", ";", " ", " ", " ", " ", "or", ",", " ", "if", " ", "there", " ", "was", " ", "a", " ", "problem", ":", "\\", "10", ";", " ", " ", " ", " ", "callback", "((", "Non", "e", ",", " ", "cb", "\\u", "arg", ",", " ", "(", "exception", " ", "class", ",", " ", "reason", ")))", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ot", "her", "wis", "e", " ", "the", " ", "command", " ", "is", " ", "synchron", "ous", " ", "(", "waits", " ", "for", " ", "result", ").", " ", "Bu", "t", " ", "note", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "state", "-", "chang", "ing", " ", "command", "s", " ", "will", " ", "bot", "h", " ", "block", " ", "unti", "l", " ", "previ", "ous", " ", "command", "s", "\\", "10", ";", " ", " ", " ", " ", "have", " ", "complete", "d", ",", " ", "and", " ", "block", " ", "subsequen", "t", " ", "command", "s", " ", "unti", "l", " ", "the", "y", " ", "have", " ", "finish", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "(", "non", "-", "callback", ")", " ", "string", " ", "argu", "ment", "s", " ", "to", " ", "command", "s", " ", "are", " ", "convert", "ed", " ", "to", " ", "bytes", ",", "\\", "10", ";", " ", " ", " ", " ", "except", " ", "for", " ", "AUTH", "ENTI", "CATE", ",", " ", "and", " ", "the", " ", "last", " ", "argu", "ment", " ", "to", " ", "APPEN", "D", " ", "whi", "ch", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "pass", "ed", " ", "as", " ", "an", " ", "IMAP", "4", " ", "literal", ".", " ", " ", "NB", ":", " ", "the", " ", "'", "password", "'", " ", "argu", "ment", " ", "to", " ", "the", " ", "LOGIN", "\\", "10", ";", " ", " ", " ", " ", "command", " ", "is", " ", "alw", "ay", "s", " ", "quoted", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "is", " ", "one", " ", "instance", " ", "variab", "le", ",", " ", "'", "state", "',", " ", "tha", "t", " ", "is", " ", "usef", "ul", " ", "for", " ", "track", "ing", "\\", "10", ";", " ", " ", " ", " ", "whe", "ther", " ", "the", " ", "client", " ", "need", "s", " ", "to", " ", "login", " ", "to", " ", "the", " ", "server", ".", " ", "If", " ", "it", " ", "has", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "\"", "AUTH", "\"", " ", "after", " ", "instant", "iati", "ng", " ", "the", " ", "class", ",", " ", "then", " ", "the", " ", "connecti", "on", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "pre", "-", "authenticat", "ed", " ", "(", "other", "wis", "e", " ", "it", " ", "will", " ", "be", " ", "\"", "NON", "AUTH", "\")", ".", " ", "Selecti", "ng", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "mailbo", "x", " ", "change", "s", " ", "the", " ", "state", " ", "to", " ", "be", " ", "\"", "SELECTED", "\",", " ", "clos", "ing", " ", "a", " ", "mailbo", "x", " ", "change", "s", "\\", "10", ";", " ", " ", " ", " ", "back", " ", "to", " ", "\"", "AUTH", "\",", " ", "and", " ", "onc", "e", " ", "the", " ", "client", " ", "has", " ", "logged", " ", "out", ",", " ", "the", " ", "state", " ", "change", "s", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "\"", "LOGO", "UT", "\"", " ", "and", " ", "no", " ", "fur", "ther", " ", "command", "s", " ", "may", " ", "be", " ", "issue", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "to", " ", "use", " ", "this", " ", "module", ",", " ", "you", " ", "must", " ", "read", " ", "the", " ", "RF", "Cs", " ", "pert", "ain", "ing", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "IMAP", "4", " ", "protoc", "ol", ",", " ", "as", " ", "the", " ", "semantics", " ", "of", " ", "the", " ", "argu", "ment", "s", " ", "to", " ", "each", " ", "IMAP", "4", "\\", "10", ";", " ", " ", " ", " ", "command", " ", "are", " ", "left", " ", "to", " ", "the", " ", "invoke", "r", ",", " ", "not", " ", "to", " ", "menti", "on", " ", "the", " ", "results", ".", " ", "Al", "so", ",", "\\", "10", ";", " ", " ", " ", " ", "most", " ", "IMAP", " ", "server", "s", " ", "implement", " ", "a", " ", "sub", "-", "set", " ", "of", " ", "the", " ", "command", "s", " ", "avail", "able", " ", "here", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "als", "o", " ", "tha", "t", " ", "you", " ", "must", " ", "call", " ", "logo", "ut", "()", " ", "to", " ", "shut", " ", "down", " ", "thread", "s", " ", "bef", "ore", "\\", "10", ";", " ", " ", " ", " ", "discard", "ing", " ", "an", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "error_", "(_", "Exception_", ")_", ":_", "pass_", "#", " ", "Logi", "cal", " ", "error", "s", " ", "-", " ", "debug", " ", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "abort_", "(_", "error_", ")_", ":_", "pass_", "#", " ", "Service", " ", "error", "s", " ", "-", " ", "close", " ", "and", " ", "retry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "readonly_", "(_", "abort_", ")_", ":_", "pass_", "#", " ", "Mail", "box", " ", "status", " ", "change", "d", " ", "to", " ", "READ", "-", "ONLY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "continuation", "\\u", "cre", "_", "=_", "re_", "._", "compile_", "(_", "br", "'\\\\", "+(", " ", "(?", "P", "<", "data", ">.*)", ")?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "literal", "\\u", "cre", "_", "=_", "re_", "._", "compile_", "(_", "br", "'.*", "{(", "?", "P", "<", "size", ">\\\\", "d", "+)", "}$'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map", "CRL", "F", "\\u", "cre", "_", "=_", "re_", "._", "compile_", "(_", "br", "'\\\\", "r", "\\\\", "n", "|\\\\", "r", "|\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "quote", " ", "\"", "atom", "-", "specials", "\"", " ", ":-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"(", "\"", " ", "/", " ", "\")", "\"", " ", "/", " ", "\"{", "\"", " ", "/", " ", "SP", " ", "/", " ", "0x00", " ", "-", " ", "0x1f", " ", "/", " ", "0x7f", " ", "/", " ", "\"%", "\"", " ", "/", " ", "\"*", "\"", " ", "/", " ", "DQ", "UO", "TE", " ", "/", " ", "\"\\\\\"", " ", "/", " ", "\"]\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "match", " ", "not", " ", "the", " ", "inv", "erse", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "code", "\\u", "cre", "_", "=_", "re_", "._", "compile_", "(_", "br", "'\\\\[", "(?", "P", "<", "type", ">[", "A", "-", "Z", "-]+)", "(", " ", "(?", "P", "<", "data", ">[", "^", "\\\\]", "]*)", ")?", "\\\\]", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unta", "gged", "\\u", "response", "\\u", "cre", "_", "=_", "re_", "._", "compile_", "(_", "br", "'\\\\", "*", " ", "(?", "P", "<", "type", ">[", "A", "-", "Z", "-]+)", "(", " ", "(?", "P", "<", "data", ">.*)", ")?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unta", "gged", "\\u", "status", "\\u", "cre", "_", "=_", "re_", "._", "compile_", "(_", "br", "'\\\\", "*", " ", "(?", "P", "<", "data", ">\\\\", "d", "+)", " ", "(?", "P", "<", "type", ">[", "A", "-", "Z", "-]+)", "(", " ", "(?", "P", "<", "data", "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\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Over", "rid", "able", " ", "methods_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", " ", " ", "Utili", "ty", " ", "methods_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "IMAP", "4", " ", "commands_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u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\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Intern", "al", " ", "methods_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", " ", " ", "Threads_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "select", "\\u", "module_", ",_", "\"", "poll", "\"_", ")_", ":_", "\\u\\u\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", " ", "\"", "poll", "\"", " ", "-", " ", "use", " ", "select", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", " ", " ", "Deb", "ugg", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "host_", "=_", "None_", ",_", "port_", "=_", "None_", ",_", "debug_", "=_", "None_", ",_", "debug", "\\u", "file_", "=_", "None_", ",_", "identifier_", "=_", "None_", ",_", "timeout_", "=_", "None_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state_", "=_", "NON", "AUTH_", "#", " ", "IMAP", "4", " ", "protoc", "ol", " ", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "literal_", "=_", "None_", "#", " ", "A", " ", "literal", " ", "argu", "ment", " ", "to", " ", "a", " ", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tagg", "ed", "\\u", "commands_", "=_", "{_", "}_", "#", " ", "Tagg", "ed", " ", "command", "s", " ", "await", "ing", " ", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unta", "gged", "\\u", "responses_", "=_", "[_", "]_", "#", " ", "[[", "typ", ":", " ", "[", "data", ",", " ", "...]", "],", " ", "...]", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mailbox_", "=_", "None_", "#", " ", "Curr", "ent", " ", "mailbo", "x", " ", "selected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "readonly_", "=_", "False_", "#", " ", "READ", "-", "ONL", "Y", " ", "desi", "red", " ", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "idle", "\\u", "rq", "b_", "=_", "None_", "#", " ", "Server", " ", "IDLE", " ", "Request", " ", "-", " ", "see", " ", "\\u", "Id", "le", "Cont", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "idle", "\\u", "timeout_", "=_", "None_", "#", " ", "Mus", "t", " ", "prod", " ", "server", " ", "occ", "asi", "onal", "ly_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "expect", "ing", "\\u", "data_", "=_", "False_", "#", " ", "Expecti", "ng", " ", "message", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "expect", "ing", "\\u", "data\\u", "len_", "=_", "0_", "#", " ", "Ho", "w", " ", "many", " ", "character", "s", " ", "we", " ", "expect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "accumulated", "\\u", "data_", "=_", "[_", "]_", "#", " ", "Messag", "e", " ", "data", " ", "accumulated", " ", "so", " ", "far_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "literal", "\\u", "expected_", "=_", "None_", "#", " ", "Messag", "e", " ", "data", " ", "descriptor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "compressor", "_", "=_", "None_", "#", " ", "COMPRESS", "/", "DEF", "LATE", " ", "if", " ", "not", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "decompress", "or_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "tls", "\\u", "establish", "ed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "unique", " ", "tag", " ", "for", " ", "this", " ", "session", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "compile", " ", "tagg", "ed", " ", "response", " ", "matche", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tag", "num_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tag", "pre_", "=_", "Int", "2", "AP_", "(_", "random_", "._", "randint_", "(_", "4096_", ",_", "65535_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tag", "re_", "=_", "re_", "._", "compile_", "(_", "br", "'(", "?", "P", "<", "tag", ">'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "self_", "._", "tag", "pre_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "br", "'\\\\", "d", "+)", " ", "(?", "P", "<", "type", ">[", "A", "-", "Z", "]+)", " ", "(?", "P", "<", "data", ">.*)", "'_", ",_", "re_", "._", "ASCII", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "init", "\\u", "debug_", "(_", "debug_", ",_", "debug", "\\u", "file_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "resp", "\\u", "timeout_", "=_", "timeout_", "#", " ", "Time", "out", " ", "wait", "ing", " ", "for", " ", "command", " ", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "timeout_", "is_", "not_", "None_", "and_", "timeout_", "<_", "READ", "\\u", "POLL", "\\u", "TIMEOUT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "read", "\\u", "poll", "\\u", "timeout_", "=_", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "read", "\\u", "poll", "\\u", "timeout_", "=_", "READ", "\\u", "POLL", "\\u", "TIMEOUT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "read", "\\u", "size_", "=_", "READ", "\\u", "SIZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "socket", " ", "to", " ", "server", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "open_", "(_", "host_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mesg_", "(_", "'", "connect", "ed", " ", "to", " ", "%", "s", " ", "on", " ", "port", " ", "%", "s", "'_", "%_", "(_", "self_", "._", "host_", ",_", "self_", "._", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thread", "ing_", "\\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_", "identifier_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "identifier_", "=_", "identifier_", "\\u\\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_", "._", "identifier_", "=_", "self_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "identifier_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "identifier_", "+=_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Terminate", "_", "=_", "self_", "._", "Terminate", "Reader_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "state", "\\u", "change", "\\u", "free_", "=_", "threading_", "._", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state", "\\u", "change", "\\u", "pending_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "idle", "\\u", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ou", "q_", "=_", "queue_", "._", "Queue_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "in", "q_", "=_", "queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wrt", "h_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "self_", "._", "\\u", "writer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wrt", "h_", "._", "set", "Daemon_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wrt", "h_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rdt", "h_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "self_", "._", "\\u", "reader_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rdt", "h_", "._", "set", "Daemon_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rdt", "h_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "int", "h_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "self_", "._", "\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "int", "h_", "._", "set", "Daemon_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "int", "h_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "server", " ", "welcome", " ", "message", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "request", " ", "and", " ", "store", " ", "CAPA", "BILITY", " ", "response", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "welcome", "_", "=_", "self_", "._", "\\u", "request", "\\u", "push_", "(_", "name_", "=_", "'", "welcome", "'_", ",_", "tag_", "=_", "'", "continuation", "'_", ")_", "._", "get", "\\u", "response_", "(_", "'", "IMAP", "4", " ", "protoc", "ol", " ", "error", ":", " ", "%", "s", "'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "'", "PRE", "AUTH", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state_", "=_", "AUTH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "state", " ", "=>", " ", "AUTH", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "'", "OK", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "state", " ", "=>", " ", "NON", "AUTH", "'_", ")_", "\\u\\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_", "self_", "._", "error_", "(_", "'", "unre", "cogni", "sed", " ", "server", " ", "welcome", " ", "message", ":", " ", "%", "s", "'_", "%_", "repr_", "(_", "self_", "._", "welcome", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "get", "\\u", "capabilities_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "CAPA", "BILITY", ":", " ", "%", "r", "'_", "%_", "(_", "self_", "._", "capabilities_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "version_", "in_", "All", "owe", "d", "Version", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "version_", "in_", "self_", "._", "capabilities_", ":_", "\\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_", "self_", "._", "PROTOCOL", "\\u", "VERSION_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "self_", "._", "error_", "(_", "'", "server", " ", "not", " ", "IMAP", "4", " ", "compliant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "close", "\\u", "threads_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getattr\\u\\u_", "(_", "self_", ",_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", "ow", " ", "UPPER", "CASE", " ", "variant", "s", " ", "of", " ", "IMAP", "4", " ", "command", " ", "method", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "attr_", "in_", "Commands_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "getattr_", "(_", "self_", ",_", "attr_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Attribute", "Error_", "(_", "\"", "Un", "know", "n", " ", "IMAP", "4", " ", "command", ":", " ", "'%", "s", "'\"_", "%_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open_", "(_", "self_", ",_", "host_", "=_", "None_", ",_", "port_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "open", "(", "host", "=", "Non", "e", ",", " ", "port", "=", "Non", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Set", "up", " ", "connecti", "on", " ", "to", " ", "remote", " ", "server", " ", "on", " ", "\"", "host", ":", "port", "\"", "\\", "10", ";", " ", " ", " ", " ", "(", "default", ":", " ", "local", "host", ":", "standard", " ", "IMAP", "4", " ", "port", ").", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "connecti", "on", " ", "will", " ", "be", " ", "used", " ", "by", " ", "the", " ", "routin", "es", ":", "\\", "10", ";", " ", " ", " ", " ", "read", ",", " ", "send", ",", " ", "shut", "down", ",", " ", "socket", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "host_", "=_", "self_", "._", "\\u", "choose", "\\u", "non", "ull", "\\u", "or", "\\u", "dfl", "t_", "(_", "''_", ",_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port_", "=_", "self_", "._", "\\u", "choose", "\\u", "non", "ull", "\\u", "or", "\\u", "dfl", "t_", "(_", "IMAP", "4", "\\u", "PORT_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "=_", "self_", "._", "open", "\\u", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "read", "\\u", "fd_", "=_", "self_", "._", "sock_", "._", "fileno_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "\\u", "socket_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "open", "\\u", "socket", "()", "\\", "10", ";", " ", " ", " ", " ", "Open", " ", "socket", " ", "choo", "sing", " ", "first", " ", "address", " ", "famil", "y", " ", "avail", "able", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "socket_", "._", "create", "\\u", "connection_", "(_", "(_", "self_", "._", "host_", ",_", "self_", "._", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ssl", "\\u", "wrap", "\\u", "socket_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "ssl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TLS", "\\u", "MAP_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "ssl_", ",_", "\"", "PROTOCOL", "\\u", "TLS", "v1", "\\u", "2", "\"_", ")_", ":_", "#", " ", "py3", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "TLS", "\\u", "MAP_", "[_", "TLS", "\\u", "SECU", "RE_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tls", "1", "\\u", "2", "\"_", ":_", "ssl_", "._", "PROTOCOL", "\\u", "TLS", "v1", "\\u", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tls", "1", "\\u", "1", "\"_", ":_", "ssl_", "._", "PROTOCOL", "\\u", "TLS", "v1", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "TLS", "\\u", "MAP_", "[_", "TLS", "\\u", "SECU", "RE_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "TLS", "\\u", "MAP_", "[_", "TLS", "\\u", "NO", "\\u", "SSL_", "]_", "=_", "TLS", "\\u", "MAP_", "[_", "TLS", "\\u", "SECU", "RE_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TLS", "\\u", "MAP_", "[_", "TLS", "\\u", "NO", "\\u", "SSL_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tls", "1", "\"_", ":_", "ssl_", "._", "PROTOCOL", "\\u", "TLS", "v1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TLS", "\\u", "MAP_", "[_", "TLS", "\\u", "COMPA", "T_", "]_", "=_", "TLS", "\\u", "MAP_", "[_", "TLS", "\\u", "NO", "\\u", "SSL_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TLS", "\\u", "MAP_", "[_", "TLS", "\\u", "COMPA", "T_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ssl", "23", "\"_", ":_", "ssl_", "._", "PROTOCOL", "\\u", "SS", "Lv", "23_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ":_", "ssl_", "._", "PROTOCOL", "\\u", "SS", "Lv", "23_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "ssl_", ",_", "\"", "PROTOCOL", "\\u", "SS", "Lv", "3", "\"_", ")_", ":_", "#", " ", "Mi", "ght", " ", "not", " ", "be", " ", "avail", "able", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "TLS", "\\u", "MAP_", "[_", "TLS", "\\u", "COMPA", "T_", "]_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ssl", "3", "\"_", ":_", "ssl_", "._", "PROTOCOL", "\\u", "SS", "Lv", "3_", "\\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_", "self_", "._", "ca", "\\u", "certs_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cert", "\\u", "reqs_", "=_", "ssl_", "._", "CERT", "\\u", "REQUIRED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cert", "\\u", "reqs_", "=_", "ssl_", "._", "CERT", "\\u", "NONE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "tls", "\\u", "level_", "not_", "in_", "TLS", "\\u", "MAP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "unknown", " ", "tls", "\\u", "level", ":", " ", "%", "s", "\"_", "%_", "self_", "._", "tls", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "ssl", "\\u", "version_", "not_", "in_", "TLS", "\\u", "MAP_", "[_", "self_", "._", "tls", "\\u", "level_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "socket_", "._", "ssl", "error_", "(_", "\"", "Inva", "lid", " ", "SS", "L", " ", "version", " ", "'%", "s", "'", " ", "request", "ed", " ", "for", " ", "tls", "\\u", "version", " ", "'%", "s", "'\"_", "%_", "(_", "self_", "._", "ssl", "\\u", "version_", ",_", "self_", "._", "tls", "\\u", "level_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ssl", "\\u", "version_", "=_", "TLS", "\\u", "MAP_", "[_", "self_", "._", "tls", "\\u", "level_", "]_", "[_", "self_", "._", "ssl", "\\u", "version_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sock_", "=_", "ssl_", "._", "wrap", "\\u", "socket_", "(_", "self_", "._", "sock_", ",_", "self_", "._", "keyfile_", ",_", "self_", "._", "certfile", "_", ",_", "ca", "\\u", "certs_", "=_", "self_", "._", "ca", "\\u", "certs_", ",_", "cert", "\\u", "reqs_", "=_", "cert", "\\u", "reqs_", ",_", "ssl", "\\u", "version_", "=_", "ssl", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssl", "\\u", "exc_", "=_", "ssl_", "._", "SS", "LE", "rror_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "read", "\\u", "fd_", "=_", "self_", "._", "sock_", "._", "fileno_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "ssl", " ", "module", ",", " ", "and", " ", "socket", ".", "ssl", " ", "has", " ", "no", " ", "filen", "o", "()", ",", " ", "and", " ", "doe", "s", " ", "not", " ", "allow", " ", "certifica", "te", " ", "verification", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "socket_", "._", "ssl", "error_", "(_", "\"", "imap", "lib", " ", "SS", "L", " ", "mode", " ", "doe", "s", " ", "not", " ", "work", " ", "with", "out", " ", "ssl", " ", "module", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "cert", "\\u", "verify", "\\u", "cb_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cert", "\\u", "err_", "=_", "self_", "._", "cert", "\\u", "verify", "\\u", "cb_", "(_", "self_", "._", "sock_", "._", "getp", "eer", "cert_", "(_", ")_", ",_", "self_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cert", "\\u", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "ssl", "\\u", "exc_", "(_", "cert", "\\u", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", "ow", " ", "sendin", "g", " ", "of", " ", "keep", "-", "alive", " ", "message", "s", " ", "-", " ", "see", "ms", " ", "to", " ", "prevent", " ", "some", " ", "servers_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "clos", "ing", " ", "SS", "L", ",", " ", "lead", "ing", " ", "to", " ", "deadl", "ock", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sock_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "KEEP", "ALI", "VE_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "compress", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "start", "\\u", "compress", "ing", "()", "\\", "10", ";", " ", " ", " ", " ", "Enable", " ", "deflate", " ", "compress", "ion", " ", "on", " ", "the", " ", "socket", " ", "(", "RF", "C", " ", "497", "8", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rfc", " ", "195", "1", " ", "-", " ", "pure", " ", "DEF", "LATE", ",", " ", "so", " ", "use", " ", "-1", "5", " ", "for", " ", "bot", "h", " ", "windows_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "decompress", "or_", "=_", "zlib_", "._", "decompress", "obj_", "(_", "-_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compressor", "_", "=_", "zlib_", "._", "compress", "obj_", "(_", "zlib_", "._", "Z", "\\u", "DEF", "AUL", "T", "\\u", "COMPRESS", "ION_", ",_", "zlib_", "._", "DEF", "LATE", "D_", ",_", "-_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "data", " ", "=", " ", "read", "(", "size", ")", "\\", "10", ";", " ", " ", " ", " ", "Read", " ", "at", " ", "most", " ", "'", "size", "'", " ", "bytes", " ", "from", " ", "remote", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "decompress", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "sock_", "._", "recv_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "decompress", "or_", "._", "uncon", "sum", "ed", "\\u", "tail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "decompress", "or_", "._", "uncon", "sum", "ed", "\\u", "tail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "sock_", "._", "recv_", "(_", "READ", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "decompress", "or_", "._", "decompress_", "(_", "data_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "send", "(", "data", ")", "\\", "10", ";", " ", " ", " ", " ", "Sen", "d", " ", "'", "data", "'", " ", "to", " ", "remote", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "compressor", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "compressor", "_", "._", "compress_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "+=_", "self_", "._", "compressor", "_", "._", "flush_", "(_", "zlib_", "._", "Z", "\\u", "SYNC", "\\u", "FLU", "SH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sock_", "._", "sendall_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shutdown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "shut", "down", "()", "\\", "10", ";", " ", " ", " ", " ", "Clos", "e", " ", "I", "/", "O", " ", "establish", "ed", " ", "in", " ", "\"", "open", "\".", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sock_", "._", "shutdown_", "(_", "socket_", "._", "SHU", "T", "\\u", "RD", "WR", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "server", " ", "mig", "ht", " ", "alr", "ead", "y", " ", "have", " ", "close", "d", " ", "the", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "errno_", "!=_", "errno_", "._", "ENO", "TC", "ON", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "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_", "socket_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "socket", " ", "=", " ", "socket", "()", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "socket", " ", "instance", " ", "used", " ", "to", " ", "connect", " ", "to", " ", "IMAP", "4", " ", "server", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "sock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "enable", "\\u", "compression_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "enable", "\\u", "compress", "ion", "()", "\\", "10", ";", " ", " ", " ", " ", "As", "k", " ", "the", " ", "server", " ", "to", " ", "start", " ", "compress", "ing", " ", "the", " ", "connecti", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "be", " ", "call", "ed", " ", "from", " ", "user", " ", "of", " ", "this", " ", "class", " ", "after", " ", "instantiation", ",", " ", "as", " ", "in", ":", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "'", "COMPRESS", "=", "DEF", "LATE", "'", " ", "in", " ", "imap", "obj", ".", "capab", "ilities", ":", "\\", "10", ";", " ", " ", " ", " ", "imap", "obj", ".", "enable", "\\u", "compress", "ion", "()\"", "\"\"_", "\\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 ", " _", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "COMPRESS", "'_", ",_", "'", "DEF", "LATE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "==_", "'", "OK", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "start", "\\u", "compress", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "Enable", "d", " ", "COMPRESS", "=", "DEF", "LATE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "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_", "pop", "\\u", "unta", "gged", "\\u", "responses_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "for", " ", "typ", ",", "data", " ", "in", " ", "pop", "\\u", "unta", "gged", "\\u", "response", "s", "():", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", "Generat", "or", " ", "for", " ", "any", " ", "rema", "inin", "g", " ", "unta", "gged", " ", "response", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "and", " ", "remove", "s", " ", "unta", "gged", " ", "response", "s", " ", "in", " ", "order", " ", "of", " ", "recep", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "at", " ", "your", " ", "own", " ", "risk", "!\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "self_", "._", "unta", "gged", "\\u", "responses_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "command", "s", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "unta", "gged", "\\u", "responses_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "command", "s", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "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_", "recent_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "recent", "()", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "'", "REC", "ENT", "'", " ", "response", "s", " ", "if", " ", "any", " ", "exist", ",", "\\", "10", ";", " ", " ", " ", " ", "else", " ", "prompt", " ", "server", " ", "for", " ", "an", " ", "update", " ", "usi", "ng", " ", "the", " ", "'", "NOO", "P", "'", " ", "command", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "data", "'", " ", "is", " ", "Non", "e", " ", "if", " ", "no", " ", "new", " ", "message", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "else", " ", "list", " ", "of", " ", "REC", "ENT", " ", "response", "s", ",", " ", "most", " ", "recent", " ", "last", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "REC", "ENT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "unta", "gged", "\\u", "response_", "(_", "None_", ",_", "[_", "None_", "]_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dat_", "!=_", "[_", "None_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "deliver", "\\u", "dat_", "(_", "typ_", ",_", "dat_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "noop_", "(_", "**_", "kw_", ")_", "#", " ", "Prod", " ", "server", " ", "for", " ", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "response_", "(_", "self_", ",_", "code_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "code", ",", " ", "[", "data", "])", " ", "=", " ", "response", "(", "code", ")", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "data", " ", "for", " ", "response", " ", "'", "code", "'", " ", "if", " ", "receive", "d", ",", " ", "or", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "Old", " ", "value", " ", "for", " ", "response", " ", "'", "code", "'", " ", "is", " ", "clear", "ed", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "unta", "gged", "\\u", "response_", "(_", "code_", ",_", "[_", "None_", "]_", ",_", "code_", "._", "upper_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "deliver", "\\u", "dat_", "(_", "typ_", ",_", "dat_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append_", "(_", "self_", ",_", "mailbox_", ",_", "flags_", ",_", "date", "\\u", "time_", ",_", "message_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "append", "(", "mailbo", "x", ",", " ", "flags", ",", " ", "date", "\\u", "time", ",", " ", "message", ")", "\\", "10", ";", " ", " ", " ", " ", "Append", " ", "message", " ", "to", " ", "named", " ", "mailbo", "x", ".", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "args", " ", "except", " ", "`", "message", "'", " ", "can", " ", "be", " ", "Non", "e", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "APPEN", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "mailbox_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mailbox_", "=_", "'", "IN", "BO", "X", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "flags_", "[_", "0_", "]_", ",_", "flags_", "[_", "-_", "1_", "]_", ")_", "!=_", "(_", "'('_", ",_", "')'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "=_", "'(", "%", "s", ")'_", "%_", "flags_", "\\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 ", " _", "flags_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "date", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "date", "\\u", "time_", "=_", "Time", "2", "Intern", "ald", "ate_", "(_", "date", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "date", "\\u", "time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "message_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "bytes_", "(_", "message_", ",_", "'", "ASCII", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "literal_", "=_", "self_", "._", "map", "CRL", "F", "\\u", "cre", "_", "._", "sub_", "(_", "CRL", "F_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "mailbox_", ",_", "flags_", ",_", "date", "\\u", "time_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "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_", "authenticate_", "(_", "self_", ",_", "mechanism", "_", ",_", "auth", "object_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "authenticat", "e", "(", "mechanism", ",", " ", "auth", "object", ")", "\\", "10", ";", " ", " ", " ", " ", "Auth", "entica", "te", " ", "command", " ", "-", " ", "require", "s", " ", "response", " ", "process", "ing", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'", "mechanism", "'", " ", "speci", "fie", "s", " ", "whi", "ch", " ", "authenticat", "ion", " ", "mechanism", " ", "is", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "used", " ", "-", " ", "it", " ", "must", " ", "appear", " ", "in", " ", "<", "instance", ">.", "capab", "ilities", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "form", " ", "AUTH", "=", "<", "mechanism", ">.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'", "auth", "object", "'", " ", "must", " ", "be", " ", "a", " ", "calla", "ble", " ", "object", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "=", " ", "auth", "object", "(", "response", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "will", " ", "be", " ", "call", "ed", " ", "to", " ", "process", " ", "server", " ", "continuation", " ", "response", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "'", "response", "'", " ", "argu", "ment", " ", "will", " ", "be", " ", "a", " ", "'", "bytes", "'.", " ", " ", "It", " ", "shou", "ld", " ", "return", "\\", "10", ";", " ", " ", " ", " ", "bytes", " ", "tha", "t", " ", "will", " ", "be", " ", "encode", "d", " ", "and", " ", "sent", " ", "to", " ", "server", ".", " ", " ", "It", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "Non", "e", " ", "if", " ", "the", " ", "client", " ", "abort", " ", "response", " ", "'*", "'", " ", "shou", "ld", " ", "be", " ", "sent", "\\", "10", ";", " ", " ", " ", " ", "inst", "ead", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "literal_", "=_", "\\u", "Authenticator", "_", "(_", "auth", "object_", ")_", "._", "process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "AUTH", "ENTI", "CATE", "'_", ",_", "mechanism", "_", "._", "upper_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "!=_", "'", "OK", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "deliver", "\\u", "exc_", "(_", "self_", "._", "error_", ",_", "dat_", "[_", "-_", "1_", "]_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "state_", "=_", "AUTH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "state", " ", "=>", " ", "AUTH", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "deliver", "\\u", "dat_", "(_", "typ_", ",_", "dat_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "capability_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "capab", "ilit", "y", "()", "\\", "10", ";", " ", " ", " ", " ", "Fe", "tch", " ", "capab", "ilities", " ", "list", " ", "from", " ", "server", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "CAPA", "BILITY", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "check", "()", "\\", "10", ";", " ", " ", " ", " ", "Checkpoint", " ", "mailbo", "x", " ", "on", " ", "server", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "CHECK", "'_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "close", "()", "\\", "10", ";", " ", " ", " ", " ", "Clos", "e", " ", "currentl", "y", " ", "selecte", "d", " ", "mailbo", "x", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Delete", "d", " ", "message", "s", " ", "are", " ", "remove", "d", " ", "from", " ", "writ", "able", " ", "mailbo", "x", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "recommende", "d", " ", "command", " ", "bef", "ore", " ", "'", "LOGO", "UT", "'.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "state_", "!=_", "'", "SELECTED", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "self_", "._", "error_", "(_", "'", "No", " ", "mailbo", "x", " ", "selecte", "d", ".'_", ")_", "\\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 ", " _", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "CLOSE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state_", "=_", "AUTH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "state", " ", "=>", " ", "AUTH", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "deliver", "\\u", "dat_", "(_", "typ_", ",_", "dat_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy_", "(_", "self_", ",_", "message", "\\u", "set_", ",_", "new", "\\u", "mailbox_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "copy", "(", "message", "\\u", "set", ",", " ", "new", "\\u", "mailbo", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Copy", " ", "'", "message", "\\u", "set", "'", " ", "message", "s", " ", "onto", " ", "end", " ", "of", " ", "'", "new", "\\u", "mailbo", "x", "'.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "COPY", "'_", ",_", "message", "\\u", "set_", ",_", "new", "\\u", "mailbox_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create_", "(_", "self_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "create", "(", "mailbo", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "new", " ", "mailbo", "x", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "CREATE", "'_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "delete", "(", "mailbo", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Delete", " ", "old", " ", "mailbo", "x", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "DELET", "E", "'_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "acl_", "(_", "self_", ",_", "mailbox_", ",_", "who_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "delete", "acl", "(", "mailbo", "x", ",", " ", "who", ")", "\\", "10", ";", " ", " ", " ", " ", "Delete", " ", "the", " ", "ACL", "s", " ", "(", "remove", " ", "any", " ", "rights", ")", " ", "set", " ", "for", " ", "who", " ", "on", " ", "mailbo", "x", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "DELET", "EAC", "L", "'_", ",_", "mailbox_", ",_", "who_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "examine", "_", "(_", "self_", ",_", "mailbox_", "=_", "'", "IN", "BO", "X", "'_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "examine", "(", "mailbo", "x", "='", "IN", "BO", "X", "')", "\\", "10", ";", " ", " ", " ", " ", "Select", " ", "a", " ", "mailbo", "x", " ", "for", " ", "READ", "-", "ONL", "Y", " ", "access", ".", " ", "(", "Flu", "she", "s", " ", "all", " ", "unta", "gged", " ", "response", "s", ".)", "\\", "10", ";", " ", " ", " ", " ", "'", "data", "'", " ", "is", " ", "count", " ", "of", " ", "message", "s", " ", "in", " ", "mailbo", "x", " ", "('", "EXIST", "S", "'", " ", "response", ").", "\\", "10", ";", " ", " ", " ", " ", "Man", "date", "d", " ", "response", "s", " ", "are", " ", "('", "FLAG", "S", "',", " ", "'", "EXIST", "S", "',", " ", "'", "REC", "ENT", "',", " ", "'", "UI", "DV", "ALI", "DI", "TY", "')", ",", " ", "so", "\\", "10", ";", " ", " ", " ", " ", "other", " ", "response", "s", " ", "shou", "ld", " ", "be", " ", "obtain", "ed", " ", "via", " ", "\"", "response", "('", "FLAG", "S", "')", "\"", " ", "etc", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "select_", "(_", "mailbox_", "=_", "mailbox_", ",_", "readonly_", "=_", "True_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "exp", "unge", "_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "exp", "unge", "()", "\\", "10", ";", " ", " ", " ", " ", "Permanent", "ly", " ", "remove", " ", "delete", "d", " ", "items", " ", "from", " ", "selecte", "d", " ", "mailbo", "x", ".", "\\", "10", ";", " ", " ", " ", " ", "Generate", "s", " ", "'", "EXP", "UN", "GE", "'", " ", "response", " ", "for", " ", "each", " ", "delete", "d", " ", "message", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "data", "'", " ", "is", " ", "list", " ", "of", " ", "'", "EXP", "UN", "GE", "'", "d", " ", "message", " ", "numbers", " ", "in", " ", "order", " ", "receive", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "EXP", "UN", "GE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fetch_", "(_", "self_", ",_", "message", "\\u", "set_", ",_", "message", "\\u", "parts_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", ",", " ", "...]", ")", " ", "=", " ", "fetch", "(", "message", "\\u", "set", ",", " ", "message", "\\u", "part", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "Fe", "tch", " ", "(", "part", "s", " ", "of", ")", " ", "message", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "message", "\\u", "part", "s", "'", " ", "shou", "ld", " ", "be", " ", "a", " ", "string", " ", "of", " ", "selecte", "d", " ", "part", "s", "\\", "10", ";", " ", " ", " ", " ", "enclose", "d", " ", "in", " ", "parenthes", "es", ",", " ", "eg", ":", " ", "\"(", "UI", "D", " ", "BODY", "[", "TEXT", "])", "\".\\", "10", ";", " ", " ", " ", " ", "'", "data", "'", " ", "are", " ", "tuple", "s", " ", "of", " ", "message", " ", "part", " ", "envelop", "e", " ", "and", " ", "data", ",", "\\", "10", ";", " ", " ", " ", " ", "followe", "d", " ", "by", " ", "a", " ", "string", " ", "contain", "ing", " ", "the", " ", "trailer", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "FETCH", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "message", "\\u", "set_", ",_", "message", "\\u", "parts_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "geta", "cl_", "(_", "self_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "geta", "cl", "(", "mailbo", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "ACL", "s", " ", "for", " ", "a", " ", "mailbo", "x", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "'", "ACL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "GET", "ACL", "'_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "geta", "nno", "tation", "_", "(_", "self_", ",_", "mailbox_", ",_", "entry_", ",_", "attribute_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "geta", "nno", "tation", "(", "mailbo", "x", ",", " ", "entry", ",", " ", "attribute", ")", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "ANNOTAT", "ION", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "'", "ANNOTAT", "ION", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "GET", "ANNOTAT", "ION", "'_", ",_", "mailbox_", ",_", "entry_", ",_", "attribute_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "quota_", "(_", "self_", ",_", "root_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "get", "quot", "a", "(", "root", ")", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "quot", "a", " ", "root", "'", "s", " ", "resource", " ", "usage", " ", "and", " ", "limit", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "Part", " ", "of", " ", "the", " ", "IMAP", "4", " ", "QUOTA", " ", "extensi", "on", " ", "defin", "ed", " ", "in", " ", "rfc", "208", "7", ".)", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "'", "QUOTA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "GET", "QUOTA", "'_", ",_", "root_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "quot", "aro", "ot_", "(_", "self_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Hm", "mm", ",", " ", "this", " ", "is", " ", "non", "-", "std", "!", " ", "Le", "ft", " ", "for", " ", "back", "ward", "s", "-", "compatibility", ",", " ", "sig", "h", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NB", ":", " ", "usage", " ", "shou", "ld", " ", "have", " ", "bee", "n", " ", "defin", "ed", " ", "as", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "(", "typ", ",", " ", "[", "QUOTA", "ROO", "T", " ", "response", "s", "...]", ")", " ", "=", " ", "get", "quot", "aro", "ot", "(", "mailbo", "x", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "(", "typ", ",", " ", "[", "QUOTA", " ", "response", "s", "...]", ")", " ", "=", " ", "response", "('", "QUOTA", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[[", "QUOTA", "ROO", "T", " ", "response", "s", "...]", ",", " ", "[", "QUOTA", " ", "response", "s", "...]", "])", " ", "=", " ", "get", "quot", "aro", "ot", "(", "mailbo", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "list", " ", "of", " ", "quot", "a", " ", "root", "s", " ", "for", " ", "the", " ", "named", " ", "mailbo", "x", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "GET", "QUOTA", "ROO", "T", "'_", ",_", "mailbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", ",_", "quota_", "=_", "self_", "._", "\\u", "unta", "gged", "\\u", "response_", "(_", "typ_", ",_", "dat_", ",_", "'", "QUOTA", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", ",_", "quot", "aro", "ot_", "=_", "self_", "._", "\\u", "unta", "gged", "\\u", "response_", "(_", "typ_", ",_", "dat_", ",_", "'", "QUOTA", "ROO", "T", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "deliver", "\\u", "dat_", "(_", "typ_", ",_", "[_", "quot", "aro", "ot_", ",_", "quota_", "]_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "id_", "(_", "self_", ",_", "*_", "kv", "\\u", "pairs_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "<", "instance", ">.", "id", "(", "kv", "\\u", "pair", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "'", "kv", "\\u", "pair", "s", "'", " ", "is", " ", "a", " ", "possib", "ly", " ", "empty", " ", "list", " ", "of", " ", "keys", " ", "and", " ", "values", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "data", "'", " ", "is", " ", "a", " ", "list", " ", "of", " ", "ID", " ", "key", " ", "value", " ", "pair", "s", " ", "or", " ", "NI", "L", ".", "\\", "10", ";", " ", " ", " ", " ", "NB", ":", " ", "a", " ", "single", " ", "argu", "ment", " ", "is", " ", "assume", "d", " ", "to", " ", "be", " ", "correct", "ly", " ", "format", "ted", " ", "and", " ", "is", " ", "pass", "ed", " ", "through", " ", "unchanged", "\\", "10", ";", " ", " ", " ", " ", "(", "for", " ", "back", "ward", " ", "compatibility", " ", "with", " ", "ear", "lie", "r", " ", "version", ").", "\\", "10", ";", " ", " ", " ", " ", "Exc", "hange", " ", "informati", "on", " ", "for", " ", "problem", " ", "analys", "is", " ", "and", " ", "determina", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "ID", " ", "extensi", "on", " ", "is", " ", "defin", "ed", " ", "in", " ", "RF", "C", " ", "297", "1", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "ID", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "kv", "\\u", "pairs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "'", "NI", "L", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "kv", "\\u", "pairs_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "kv", "\\u", "pairs_", "[_", "0_", "]_", "#", " ", "Assume", " ", "invoke", "r", " ", "passi", "ng", " ", "correct", "ly", " ", "format", "ted", " ", "string", " ", "(", "back", "-", "compa", "t", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "'(", "%", "s", ")'_", "%_", "'", " ", "'_", "._", "join_", "(_", "[_", "(_", "arg_", "and_", "self_", "._", "\\u", "quote_", "(_", "arg_", ")_", "or_", "'", "NI", "L", "'_", ")_", "for_", "arg_", "in_", "kv", "\\u", "pairs_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "data_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "idle_", "(_", "self_", ",_", "timeout_", "=_", "None_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "idle", "(", "timeo", "ut", "=", "Non", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Put", " ", "server", " ", "int", "o", " ", "IDLE", " ", "mode", " ", "unti", "l", " ", "server", " ", "notifi", "es", " ", "some", " ", "change", ",", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "'", "timeo", "ut", "'", " ", "(", "secs", ")", " ", "occur", "s", " ", "(", "default", ":", " ", "2", "9", " ", "minute", "s", "),", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "anot", "her", " ", "IMAP", "4", " ", "command", " ", "is", " ", "schedule", "d", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "IDLE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "literal_", "=_", "\\u", "Id", "le", "Cont", "_", "(_", "self_", ",_", "timeout_", ")_", "._", "process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "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_", "list_", "(_", "self_", ",_", "directory_", "=_", "'\"\"'_", ",_", "pattern_", "=_", "'*'_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "list", "(", "director", "y", "='", "\"\"", "',", " ", "pattern", "='", "*'", ")", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "mailbo", "x", " ", "names", " ", "in", " ", "director", "y", " ", "matchi", "ng", " ", "pattern", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "data", "'", " ", "is", " ", "list", " ", "of", " ", "LIST", " ", "response", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "NB", ":", " ", "for", " ", "'", "pattern", "':", "\\", "10", ";", " ", " ", " ", " ", "%", " ", "matche", "s", " ", "all", " ", "except", " ", "separator", " ", "(", " ", "so", " ", "LIST", " ", "\"\"", " ", "\"%", "\"", " ", "return", "s", " ", "names", " ", "at", " ", "root", ")", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "matche", "s", " ", "all", " ", "(", "so", " ", "LIST", " ", "\"\"", " ", "\"*", "\"", " ", "return", "s", " ", "whole", " ", "director", "y", " ", "tree", " ", "from", " ", "root", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "LIST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "directory_", ",_", "pattern_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "login_", "(_", "self_", ",_", "user_", ",_", "password_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "login", "(", "user", ",", " ", "password", ")", "\\", "10", ";", " ", " ", " ", " ", "Identif", "y", " ", "client", " ", "usi", "ng", " ", "plain", "text", " ", "password", ".", "\\", "10", ";", " ", " ", " ", " ", "NB", ":", " ", "'", "password", "'", " ", "will", " ", "be", " ", "quoted", ".\"\"\"_", "\\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 ", " _", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "LOGIN", "'_", ",_", "user_", ",_", "self_", "._", "\\u", "quote_", "(_", "password_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "!=_", "'", "OK", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "deliver", "\\u", "exc_", "(_", "self_", "._", "error_", ",_", "dat_", "[_", "-_", "1_", "]_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "state_", "=_", "AUTH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "state", " ", "=>", " ", "AUTH", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "deliver", "\\u", "dat_", "(_", "typ_", ",_", "dat_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "login", "\\u", "cra", "m", "\\u", "md5_", "(_", "self_", ",_", "user_", ",_", "password_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "login", "\\u", "cra", "m", "\\u", "md5", "(", "user", ",", " ", "password", ")", "\\", "10", ";", " ", " ", " ", " ", "Force", " ", "use", " ", "of", " ", "CRA", "M", "-", "MD", "5", " ", "authenticat", "ion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", ",_", "self_", "._", "password_", "=_", "user_", ",_", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "authenticate_", "(_", "'", "CRA", "M", "-", "MD", "5", "'_", ",_", "self_", "._", "\\u", "CRA", "M", "\\u", "MD", "5", "\\u", "AUTH_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "CRA", "M", "\\u", "MD", "5", "\\u", "AUTH_", "(_", "self_", ",_", "challenge_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Auth", "object", " ", "to", " ", "use", " ", "with", " ", "CRA", "M", "-", "MD", "5", " ", "authenticat", "ion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hmac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pwd_", "=_", "(_", "self_", "._", "password_", "._", "encode_", "(_", "'", "ASCII", "'_", ")_", "if_", "isinstance_", "(_", "self_", "._", "password_", ",_", "str_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "self_", "._", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "user_", "+_", "\"", " ", "\"_", "+_", "hmac_", "._", "HMAC", "_", "(_", "pwd_", ",_", "challenge_", ",_", "'", "md5", "'_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logout_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "logo", "ut", "()", "\\", "10", ";", " ", " ", " ", " ", "Shut", "down", " ", "connecti", "on", " ", "to", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "server", " ", "'", "BY", "E", "'", " ", "response", ".", "\\", "10", ";", " ", " ", " ", " ", "NB", ":", " ", "You", " ", "must", " ", "call", " ", "this", " ", "to", " ", "shut", " ", "down", " ", "thread", "s", " ", "bef", "ore", " ", "discard", "ing", " ", "an", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "state_", "=_", "LOGO", "UT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "state", " ", "=>", " ", "LOGO", "UT", "'_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "LOGO", "UT", "'_", ")_", "\\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 ", " _", "typ_", ",_", "dat_", "=_", "'", "NO", "'_", ",_", "[_", "'%", "s", ":", " ", "%", "s", "'_", "%_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "close", "\\u", "threads_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "connecti", "on", " ", "close", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bye", "_", "=_", "self_", "._", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "'", "BY", "E", "'_", ",_", "leave_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bye", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "dat_", "=_", "'", "BY", "E", "'_", ",_", "bye", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "deliver", "\\u", "dat_", "(_", "typ_", ",_", "dat_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ls", "ub_", "(_", "self_", ",_", "directory_", "=_", "'\"\"'_", ",_", "pattern_", "=_", "'*'_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", ",", " ", "...]", ")", " ", "=", " ", "ls", "ub", "(", "director", "y", "='", "\"\"", "',", " ", "pattern", "='", "*'", ")", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "'", "subscribed", "'", " ", "mailbo", "x", " ", "names", " ", "in", " ", "director", "y", " ", "matchi", "ng", " ", "pattern", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "data", "'", " ", "are", " ", "tuple", "s", " ", "of", " ", "message", " ", "part", " ", "envelop", "e", " ", "and", " ", "data", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "LS", "UB", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "directory_", ",_", "pattern_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "myr", "ight", "s_", "(_", "self_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "myr", "ight", "s", "(", "mailbo", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Show", " ", "my", " ", "ACL", "s", " ", "for", " ", "a", " ", "mailbo", "x", " ", "(", "i", ".", "e", ".", " ", "the", " ", "rights", " ", "tha", "t", " ", "I", " ", "have", " ", "on", " ", "mailbo", "x", ").\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "MY", "RIG", "HT", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "namespace_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", ",", " ", "...]", ")", " ", "=", " ", "namespace", "()", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "IMAP", " ", "namespace", "s", " ", "ala", " ", "rfc", "234", "2", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "NAMESPACE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "noop_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "noop", "()", "\\", "10", ";", " ", " ", " ", " ", "Sen", "d", " ", "NOO", "P", " ", "command", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "dump", "\\u", "ur_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "NOO", "P", "'_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "partial_", "(_", "self_", ",_", "message", "\\u", "num_", ",_", "message", "\\u", "part_", ",_", "start_", ",_", "length_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", ",", " ", "...]", ")", " ", "=", " ", "partial", "(", "message", "\\u", "num", ",", " ", "message", "\\u", "part", ",", " ", "start", ",", " ", "length", ")", "\\", "10", ";", " ", " ", " ", " ", "Fe", "tch", " ", "truncat", "ed", " ", "part", " ", "of", " ", "a", " ", "message", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "data", "'", " ", "is", " ", "tuple", " ", "of", " ", "message", " ", "part", " ", "envelop", "e", " ", "and", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "NB", ":", " ", "obsolete", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "PARTI", "AL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "'", "FETCH", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "message", "\\u", "num_", ",_", "message", "\\u", "part_", ",_", "start_", ",_", "length_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "proxy", "auth_", "(_", "self_", ",_", "user_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "proxy", "auth", "(", "user", ")", "\\", "10", ";", " ", " ", " ", " ", "Assume", " ", "authenticat", "ion", " ", "as", " ", "'", "user", "'.", "\\", "10", ";", " ", " ", " ", " ", "(", "All", "ow", "s", " ", "an", " ", "authori", "sed", " ", "administrat", "or", " ", "to", " ", "proxy", " ", "int", "o", " ", "any", " ", "user", "'", "s", " ", "mailbo", "x", ".)", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "PROX", "YA", "UTH", "'_", ",_", "user_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "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_", "rename_", "(_", "self_", ",_", "old", "mailbox_", ",_", "newm", "ail", "box_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "rename", "(", "old", "mailbo", "x", ",", " ", "newm", "ail", "box", ")", "\\", "10", ";", " ", " ", " ", " ", "Rename", " ", "old", " ", "mailbo", "x", " ", "name", " ", "to", " ", "new", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "RENA", "ME", "'_", ",_", "old", "mailbox_", ",_", "newm", "ail", "box_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "search_", "(_", "self_", ",_", "charset_", ",_", "*_", "criteria_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "search", "(", "charset", ",", " ", "criterio", "n", ",", " ", "...)", "\\", "10", ";", " ", " ", " ", " ", "Sear", "ch", " ", "mailbo", "x", " ", "for", " ", "matchi", "ng", " ", "message", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "data", "'", " ", "is", " ", "space", " ", "separate", "d", " ", "list", " ", "of", " ", "matchi", "ng", " ", "message", " ", "numbers", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "SEARCH", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "charset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "'", "CHARS", "ET", "'_", ",_", "charset_", ",_", "*_", "criteria_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "*_", "criteria_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "select_", "(_", "self_", ",_", "mailbox_", "=_", "'", "IN", "BO", "X", "'_", ",_", "readonly_", "=_", "False_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "select", "(", "mailbo", "x", "='", "IN", "BO", "X", "',", " ", "read", "only", "=", "Fal", "se", ")", "\\", "10", ";", " ", " ", " ", " ", "Select", " ", "a", " ", "mailbo", "x", ".", " ", "(", "Flu", "she", "s", " ", "all", " ", "unta", "gged", " ", "response", "s", ".)", "\\", "10", ";", " ", " ", " ", " ", "'", "data", "'", " ", "is", " ", "count", " ", "of", " ", "message", "s", " ", "in", " ", "mailbo", "x", " ", "('", "EXIST", "S", "'", " ", "response", ").", "\\", "10", ";", " ", " ", " ", " ", "Man", "date", "d", " ", "response", "s", " ", "are", " ", "('", "FLAG", "S", "',", " ", "'", "EXIST", "S", "',", " ", "'", "REC", "ENT", "',", " ", "'", "UI", "DV", "ALI", "DI", "TY", "')", ",", " ", "so", "\\", "10", ";", " ", " ", " ", " ", "other", " ", "response", "s", " ", "shou", "ld", " ", "be", " ", "obtain", "ed", " ", "via", " ", "\"", "response", "('", "FLAG", "S", "')", "\"", " ", "etc", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "mailbox_", "=_", "mailbox_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "is", "\\u", "readonly_", "=_", "bool_", "(_", "readonly_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "readonly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "EX", "AMI", "NE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "SELECT", "'_", "\\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 ", " _", "rq", "b_", "=_", "self_", "._", "\\u", "command_", "(_", "name_", ",_", "mailbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", ",_", "dat_", "=_", "rq", "b_", "._", "get", "\\u", "response_", "(_", "'", "command", ":", " ", "%", "s", " ", "=>", " ", "%%", "s", "'_", "%_", "rq", "b_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "!=_", "'", "OK", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "state_", "==_", "SELECTED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "state_", "=_", "AUTH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "state", " ", "=>", " ", "AUTH", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "==_", "'", "BAD", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "deliver", "\\u", "exc_", "(_", "self_", "._", "error_", ",_", "'%", "s", " ", "command", " ", "error", ":", " ", "%", "s", " ", "%", "s", ".", " ", "Data", ":", " ", "%", ".1", "00", "s", "'_", "%_", "(_", "name_", ",_", "typ_", ",_", "dat_", ",_", "mailbox_", ")_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "deliver", "\\u", "dat_", "(_", "typ_", ",_", "dat_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "state_", "=_", "SELECTED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "state", " ", "=>", " ", "SELECTED", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "'", "READ", "-", "ONL", "Y", "'_", ",_", "leave_", "=_", "True_", ")_", "and_", "not_", "readonly_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "dump", "\\u", "ur_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "deliver", "\\u", "exc_", "(_", "self_", "._", "readonly_", ",_", "'%", "s", " ", "is", " ", "not", " ", "writ", "able", "'_", "%_", "mailbox_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "unta", "gged", "\\u", "response_", "(_", "typ_", ",_", "[_", "None_", "]_", ",_", "'", "EXIST", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "deliver", "\\u", "dat_", "(_", "typ_", ",_", "dat_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "seta", "cl_", "(_", "self_", ",_", "mailbox_", ",_", "who_", ",_", "what_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "seta", "cl", "(", "mailbo", "x", ",", " ", "who", ",", " ", "what", ")", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "a", " ", "mailbo", "x", " ", "acl", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "SET", "ACL", "'_", ",_", "mailbox_", ",_", "who_", ",_", "what_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "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_", "seta", "nno", "tation", "_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "seta", "nno", "tation", "(", "mailbo", "x", "[", ",", " ", "entry", ",", " ", "attribute", "]+)", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "ANNOTAT", "ION", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "'", "ANNOTAT", "ION", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "SET", "ANNOTAT", "ION", "'_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "quota_", "(_", "self_", ",_", "root_", ",_", "limits_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "set", "quot", "a", "(", "root", ",", " ", "limit", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "the", " ", "quot", "a", " ", "root", "'", "s", " ", "resource", " ", "limit", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "'", "QUOTA", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "SET", "QUOTA", "'_", ",_", "root_", ",_", "limits_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "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_", "sort_", "(_", "self_", ",_", "sort", "\\u", "criteria_", ",_", "charset_", ",_", "*_", "search", "\\u", "criteria_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "sort", "(", "sort", "\\u", "crite", "ria", ",", " ", "charset", ",", " ", "search", "\\u", "crite", "ria", ",", " ", "...)", "\\", "10", ";", " ", " ", " ", " ", "IMAP", "4", "rev", "1", " ", "extensi", "on", " ", "SORT", " ", "command", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "SORT", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "sort", "\\u", "criteria_", "[_", "0_", "]_", ",_", "sort", "\\u", "criteria_", "[_", "-_", "1_", "]_", ")_", "!=_", "(_", "'('_", ",_", "')'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sort", "\\u", "criteria_", "=_", "'(", "%", "s", ")'_", "%_", "sort", "\\u", "criteria_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "sort", "\\u", "criteria_", ",_", "charset_", ",_", "*_", "search", "\\u", "criteria_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "startt", "ls_", "(_", "self_", ",_", "keyfile_", "=_", "None_", ",_", "certfile", "_", "=_", "None_", ",_", "ca", "\\u", "certs_", "=_", "None_", ",_", "cert", "\\u", "verify", "\\u", "cb_", "=_", "None_", ",_", "ssl", "\\u", "version_", "=_", "\"", "ssl", "23", "\"_", ",_", "tls", "\\u", "level_", "=_", "TLS", "\\u", "COMPA", "T_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "startt", "ls", "(", "keyfile", "=", "Non", "e", ",", " ", "certfile", "=", "Non", "e", ",", " ", "ca", "\\u", "cert", "s", "=", "Non", "e", ",", " ", "cert", "\\u", "verify", "\\u", "cb", "=", "Non", "e", ",", " ", "ssl", "\\u", "version", "=\"", "ssl", "23", "\",", " ", "tls", "\\u", "level", "=\"", "tls", "\\u", "compa", "t", "\")", "\\", "10", ";", " ", " ", " ", " ", "Start", " ", "TLS", " ", "negotiat", "ion", " ", "as", " ", "per", " ", "RF", "C", " ", "259", "5", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "START", "TLS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "name_", "not_", "in_", "self_", "._", "capabilities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "self_", "._", "abort_", "(_", "'", "TLS", " ", "not", " ", "support", "ed", " ", "by", " ", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "tls", "\\u", "establish", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "self_", "._", "abort_", "(_", "'", "TLS", " ", "session", " ", "alr", "ead", "y", " ", "establish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mus", "t", " ", "now", " ", "shut", "down", " ", "reader", " ", "thread", " ", "after", " ", "next", " ", "response", ",", " ", "and", " ", "restart", " ", "after", " ", "chang", "ing", " ", "read", "\\u", "fd_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "read", "\\u", "size_", "=_", "1_", "#", " ", "Don", "'", "t", " ", "consume", " ", "TLS", " ", "handshake", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Terminate", "Reader_", "=_", "True_", "\\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 ", " _", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rdt", "h_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Terminate", "Reader_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "read", "\\u", "size_", "=_", "READ", "\\u", "SIZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "typ_", "!=_", "'", "OK", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Restart", " ", "reader", " ", "thread", " ", "and", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rdt", "h_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "self_", "._", "\\u", "reader_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rdt", "h_", "._", "set", "Daemon_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rdt", "h_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "self_", "._", "error_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "establish", " ", "TLS", " ", "session", ":", " ", "%", "s", "\"_", "%_", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "keyfile_", "=_", "keyfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "certfile", "_", "=_", "certfile", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ca", "\\u", "certs_", "=_", "ca", "\\u", "certs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cert", "\\u", "verify", "\\u", "cb_", "=_", "cert", "\\u", "verify", "\\u", "cb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssl", "\\u", "version_", "=_", "ssl", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tls", "\\u", "level_", "=_", "tls", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ssl", "\\u", "wrap", "\\u", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Restart", " ", "reader", " ", "thread_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rdt", "h_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "self_", "._", "\\u", "reader_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rdt", "h_", "._", "set", "Daemon_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rdt", "h_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "get", "\\u", "capabilities_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "tls", "\\u", "establish", "ed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "unta", "gged", "\\u", "response_", "(_", "typ_", ",_", "dat_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "deliver", "\\u", "dat_", "(_", "typ_", ",_", "dat_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "status_", "(_", "self_", ",_", "mailbox_", ",_", "names_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "status", "(", "mailbo", "x", ",", " ", "names", ")", "\\", "10", ";", " ", " ", " ", " ", "Request", " ", "named", " ", "status", " ", "condition", "s", " ", "for", " ", "mailbo", "x", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "STATUS", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "mailbox_", ",_", "names_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "store_", "(_", "self_", ",_", "message", "\\u", "set_", ",_", "command_", ",_", "flags_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "store", "(", "message", "\\u", "set", ",", " ", "command", ",", " ", "flags", ")", "\\", "10", ";", " ", " ", " ", " ", "Alter", "s", " ", "flag", " ", "disposition", "s", " ", "for", " ", "message", "s", " ", "in", " ", "mailbo", "x", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "flags_", "[_", "0_", "]_", ",_", "flags_", "[_", "-_", "1_", "]_", ")_", "!=_", "(_", "'('_", ",_", "')'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "=_", "'(", "%", "s", ")'_", "%_", "flags_", "#", " ", "Av", "oid", " ", "quoting", " ", "the", " ", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "'", "FETCH", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "STORE", "'_", ",_", "message", "\\u", "set_", ",_", "command_", ",_", "flags_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "subscribe_", "(_", "self_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "subscribe", "(", "mailbo", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Subscrib", "e", " ", "to", " ", "new", " ", "mailbo", "x", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "SUBSCRI", "BE", "'_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "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_", "thread_", "(_", "self_", ",_", "thread", "ing", "\\u", "algorithm_", ",_", "charset_", ",_", "*_", "search", "\\u", "criteria_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "type", ",", " ", "[", "data", "])", " ", "=", " ", "thread", "(", "thread", "ing", "\\u", "alog", "rit", "hm", ",", " ", "charset", ",", " ", "search", "\\u", "crite", "ria", ",", " ", "...)", "\\", "10", ";", " ", " ", " ", " ", "IMAP", "rev", "1", " ", "extensi", "on", " ", "THREAD", " ", "command", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "THREAD", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "thread", "ing", "\\u", "algorithm_", ",_", "charset_", ",_", "*_", "search", "\\u", "criteria_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "uid_", "(_", "self_", ",_", "command_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "uid", "(", "command", ",", " ", "arg", ",", " ", "...)", "\\", "10", ";", " ", " ", " ", " ", "Execut", "e", " ", "\"", "command", " ", "arg", " ", "...\"", " ", "with", " ", "message", "s", " ", "identifi", "ed", " ", "by", " ", "UI", "D", ",", "\\", "10", ";", " ", " ", " ", " ", "rat", "her", " ", "than", " ", "message", " ", "number", ".", "\\", "10", ";", " ", " ", " ", " ", "Assume", "s", " ", "'", "command", "'", " ", "is", " ", "lega", "l", " ", "in", " ", "current", " ", "state", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "response", " ", "appropr", "iate", " ", "to", " ", "'", "command", "'.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "command_", "=_", "command_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "command_", "in_", "UI", "D", "\\u", "direct_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "'", "FETCH", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", "=_", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "UI", "D", "'_", ",_", "command_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unsubscribe_", "(_", "self_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "unsubscribe", "(", "mailbo", "x", ")", "\\", "10", ";", " ", " ", " ", " ", "Unsu", "bsc", "ribe", " ", "from", " ", "old", " ", "mailbo", "x", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "'", "UNSU", "BS", "CRI", "BE", "'_", ",_", "mailbox_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "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_", "xa", "tom", "_", "(_", "self_", ",_", "name_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "typ", ",", " ", "[", "data", "])", " ", "=", " ", "xa", "tom", "(", "name", ",", " ", "arg", ",", " ", "...)", "\\", "10", ";", " ", " ", " ", " ", "All", "ow", " ", "simple", " ", "extensi", "on", " ", "command", "s", " ", "notified", " ", "by", " ", "server", " ", "in", " ", "CAPA", "BILITY", " ", "response", ".", "\\", "10", ";", " ", " ", " ", " ", "Assume", "s", " ", "extensi", "on", " ", "command", " ", "'", "name", "'", " ", "is", " ", "lega", "l", " ", "in", " ", "current", " ", "state", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "response", " ", "appropr", "iate", " ", "to", " ", "extensi", "on", " ", "command", " ", "'", "name", "'.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "name_", "in_", "Commands_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Commands_", "[_", "name_", "]_", "=_", "(_", "(_", "self_", "._", "state_", ",_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "simple", "\\u", "command_", "(_", "name_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "append", "\\u", "unta", "gged", "_", "(_", "self_", ",_", "typ_", ",_", "dat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Append", " ", "new", " ", "'", "dat", "'", " ", "to", " ", "end", " ", "of", " ", "last", " ", "unta", "gged", " ", "response", " ", "if", " ", "same", " ", "'", "typ", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "else", " ", "append", " ", "new", " ", "response", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dat_", "is_", "None_", ":_", "dat_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "unta", "gged", "\\u", "responses_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urn_", ",_", "ur", "d_", "=_", "self_", "._", "unta", "gged", "\\u", "responses_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "urn_", "!=_", "typ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ur", "d_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ur", "d_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ur", "d_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ur", "d_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unta", "gged", "\\u", "responses_", "._", "append_", "(_", "[_", "typ_", ",_", "ur", "d_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ur", "d_", "._", "append_", "(_", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'", "unta", "gged", "\\u", "response", "s", "[", "%", "s", "]", " ", "%", "s", " ", "+=", " ", "[\"", "%", ".8", "0", "r", "\"]'_", "%_", "(_", "typ_", ",_", "len_", "(_", "ur", "d_", ")_", "-_", "1_", ",_", "dat_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "bye", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bye", "_", "=_", "self_", "._", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "'", "BY", "E", "'_", ",_", "leave_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bye", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "self_", "._", "abort_", "(_", "bye", "_", "[_", "-_", "1_", "]_", "._", "decode_", "(_", "'", "ASCII", "'_", ",_", "'", "replace", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "choose", "\\u", "non", "ull", "\\u", "or", "\\u", "dfl", "t_", "(_", "self_", ",_", "dfl", "t_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "dfl", "t_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dfl", "tt", "yp_", "=_", "str_", "#", " ", "All", "ow", " ", "any", " ", "string", " ", "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 ", " _", "dfl", "tt", "yp_", "=_", "type_", "(_", "dfl", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "arg_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "arg_", ",_", "dfl", "tt", "yp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "0_", ",_", "'", "bad", " ", "arg", " ", "is", " ", "%", "s", ",", " ", "expect", "ing", " ", "%", "s", "'_", "%_", "(_", "type_", "(_", "arg_", ")_", ",_", "dfl", "tt", "yp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dfl", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "command_", "(_", "self_", ",_", "name_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Commands_", "[_", "name_", "]_", "[_", "CMD", "\\u", "VAL", "\\u", "ASYN", "C_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "typ_", "=_", "'", "async", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "typ_", "=_", "'", "sync", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'[", "%", "s", "]", " ", "%", "s", " ", "%", "s", "'_", "%_", "(_", "cmd", "typ_", ",_", "name_", ",_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "3_", ",_", "'", "state", "\\u", "change", "\\u", "pend", "ing", ".", "acquir", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state", "\\u", "change", "\\u", "pending_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "end", "\\u", "idle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cmd", "typ_", "==_", "'", "async", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state", "\\u", "change", "\\u", "pending_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "3_", ",_", "'", "state", "\\u", "change", "\\u", "pend", "ing", ".", "release", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "wait", " ", "for", " ", "all", " ", "async", " ", "command", "s", " ", "to", " ", "complete_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "bye", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tagg", "ed", "\\u", "commands_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state", "\\u", "change", "\\u", "free_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "need", "\\u", "event_", "=_", "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 ", " _", "need", "\\u", "event_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "need", "\\u", "event_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "3_", ",_", "'", "sync", " ", "command", " ", "%", "s", " ", "wait", "ing", " ", "for", " ", "empty", " ", "command", "s", " ", "Q", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state", "\\u", "change", "\\u", "free_", "._", "wait_", "(_", "threading_", "._", "TIME", "OUT", "\\u", "MAX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "3_", ",_", "'", "sync", " ", "command", " ", "%", "s", " ", "proceed", "ing", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "state_", "not_", "in_", "Commands_", "[_", "name_", "]_", "[_", "CMD", "\\u", "VAL", "\\u", "STATES_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "literal_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "self_", "._", "error_", "(_", "'", "command", " ", "%", "s", " ", "ille", "gal", " ", "in", " ", "state", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "name_", ",_", "self_", "._", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "bye", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "name_", "in_", "(_", "'", "EX", "AMI", "NE", "'_", ",_", "'", "SELECT", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "command", "s", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unta", "gged", "\\u", "responses_", "=_", "[_", "]_", "#", " ", "Flu", "sh", " ", "all", " ", "unta", "gged", " ", "responses_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "typ_", "in_", "(_", "'", "OK", "'_", ",_", "'", "NO", "'_", ",_", "'", "BAD", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "self_", "._", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "typ_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "\\u", "readonly_", "and_", "self_", "._", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "'", "READ", "-", "ONL", "Y", "'_", ",_", "leave_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "literal_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "self_", "._", "readonly_", "(_", "'", "mailbo", "x", " ", "status", " ", "change", "d", " ", "to", " ", "READ", "-", "ONL", "Y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "self_", "._", "abort_", "(_", "'", "connecti", "on", " ", "close", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rq", "b_", "=_", "self_", "._", "\\u", "request", "\\u", "push_", "(_", "name_", "=_", "name_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "bytes_", "(_", "name_", ",_", "'", "ASCII", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "rq", "b_", "._", "tag_", "+_", "b", "'", " ", "'_", "+_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "is_", "None_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "arg_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg_", "=_", "bytes_", "(_", "arg_", ",_", "\"", "ASCII", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "data_", "+_", "b", "'", " ", "'_", "+_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "literal_", "=_", "self_", "._", "literal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "literal_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "literal_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "literal_", ")_", "is_", "type_", "(_", "self_", "._", "\\u", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "litera", "tor_", "=_", "literal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "litera", "tor_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "data_", "+_", "bytes_", "(_", "'", " ", "{%", "s", "}'_", "%_", "len_", "(_", "literal_", ")_", ",_", "'", "ASCII", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'", "data", "=", "%", "r", "'_", "%_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rq", "b_", "._", "data_", "=_", "data_", "+_", "CRL", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "literal_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ou", "q_", "._", "put_", "(_", "rq", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rq", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mus", "t", " ", "setup", " ", "continuation", " ", "expect", "ancy", " ", "*", "bef", "ore", "*", " ", "ou", "q", ".", "put", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cr", "qb", "_", "=_", "self_", "._", "\\u", "request", "\\u", "push_", "(_", "name_", "=_", "name_", ",_", "tag_", "=_", "'", "continuation", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ou", "q_", "._", "put_", "(_", "rq", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wait", " ", "for", " ", "continuation", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ok_", ",_", "data_", "=_", "cr", "qb", "_", "._", "get", "\\u", "response_", "(_", "'", "command", ":", " ", "%", "s", " ", "=>", " ", "%%", "s", "'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'", "continuation", " ", "=>", " ", "%", "s", ",", " ", "%", "r", "'_", "%_", "(_", "ok_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NO", "/", "BAD", " ", "response", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "ok_", ":_", "\\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_", "#", " ", "Sen", "d", " ", "literal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "litera", "tor_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "literal_", "=_", "litera", "tor_", "(_", "data_", ",_", "rq", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "literal_", "is_", "None_", ":_", "\\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_", "litera", "tor_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "new", " ", "request", " ", "for", " ", "next", " ", "continuation", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cr", "qb", "_", "=_", "self_", "._", "\\u", "request", "\\u", "push_", "(_", "name_", "=_", "name_", ",_", "tag_", "=_", "'", "continuation", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'", "write", " ", "literal", " ", "size", " ", "%", "s", "'_", "%_", "len_", "(_", "literal_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cr", "qb", "_", "._", "data_", "=_", "literal_", "+_", "CRL", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ou", "q_", "._", "put_", "(_", "cr", "qb", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "litera", "tor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rq", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "command", "\\u", "complete_", "(_", "self_", ",_", "rq", "b_", ",_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", "ed", " ", "for", " ", "non", "-", "callback", " ", "commands_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "bye", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", ",_", "dat_", "=_", "rq", "b_", "._", "get", "\\u", "response_", "(_", "'", "command", ":", " ", "%", "s", " ", "=>", " ", "%%", "s", "'_", "%_", "rq", "b_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "==_", "'", "BAD", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "print", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "self_", "._", "error_", "(_", "'%", "s", " ", "command", " ", "error", ":", " ", "%", "s", " ", "%", "s", ".", " ", "Data", ":", " ", "%", ".1", "00", "s", "'_", "%_", "(_", "rq", "b_", "._", "name_", ",_", "typ_", ",_", "dat_", ",_", "rq", "b_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "unta", "gged", "\\u", "response", "'_", "in_", "kw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "unta", "gged", "\\u", "response_", "(_", "typ_", ",_", "dat_", ",_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "typ_", ",_", "dat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "command", "\\u", "completer_", "(_", "self_", ",_", "cb", "\\u", "arg", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", "ed", " ", "for", " ", "callback", " ", "commands_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", ",_", "cb", "\\u", "arg_", ",_", "error_", "=_", "cb", "\\u", "arg", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rq", "b_", ",_", "kw_", "=_", "cb", "\\u", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rq", "b_", "._", "callback_", "=_", "kw_", "[_", "'", "callback", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rq", "b_", "._", "callback", "\\u", "arg_", "=_", "kw_", "._", "get_", "(_", "'", "cb", "\\u", "arg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "print", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", ",_", "val_", "=_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rq", "b_", "._", "abort_", "(_", "typ_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bye", "_", "=_", "self_", "._", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "'", "BY", "E", "'_", ",_", "leave_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bye", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rq", "b_", "._", "abort_", "(_", "self_", "._", "abort_", ",_", "bye", "_", "[_", "-_", "1_", "]_", "._", "decode_", "(_", "'", "ASCII", "'_", ",_", "'", "replace", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "typ_", ",_", "dat_", "=_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "==_", "'", "BAD", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "print", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rq", "b_", "._", "abort_", "(_", "self_", "._", "error_", ",_", "'%", "s", " ", "command", " ", "error", ":", " ", "%", "s", " ", "%", "s", ".", " ", "Data", ":", " ", "%", ".1", "00", "s", "'_", "%_", "(_", "rq", "b_", "._", "name_", ",_", "typ_", ",_", "dat_", ",_", "rq", "b_", "._", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'\\u", "command", "\\u", "completer", "(%", "s", ",", " ", "%", "s", ",", " ", "Non", "e", ")", " ", "=", " ", "%", "s", "'_", "%_", "(_", "response_", ",_", "cb", "\\u", "arg_", ",_", "rq", "b_", "._", "tag_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "unta", "gged", "\\u", "response", "'_", "in_", "kw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "\\u", "unta", "gged", "\\u", "response_", "(_", "typ_", ",_", "dat_", ",_", "kw_", "[_", "'", "unta", "gged", "\\u", "response", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rq", "b_", "._", "deliver", "_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "deliver", "\\u", "dat_", "(_", "self_", ",_", "typ_", ",_", "dat_", ",_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "callback", "'_", "in_", "kw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kw_", "[_", "'", "callback", "'_", "]_", "(_", "(_", "(_", "typ_", ",_", "dat_", ")_", ",_", "kw_", "._", "get_", "(_", "'", "cb", "\\u", "arg", "'_", ")_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "typ_", ",_", "dat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "deliver", "\\u", "exc_", "(_", "self_", ",_", "exc_", ",_", "dat_", ",_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "callback", "'_", "in_", "kw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kw_", "[_", "'", "callback", "'_", "]_", "(_", "(_", "None_", ",_", "kw_", "._", "get_", "(_", "'", "cb", "\\u", "arg", "'_", ")_", ",_", "(_", "exc_", ",_", "dat_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "exc_", "(_", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "end", "\\u", "idle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "idle", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "irq", "b_", "=_", "self_", "._", "idle", "\\u", "rq", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "irq", "b_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "idle", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "idle", "\\u", "rq", "b_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "idle", "\\u", "timeout_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "idle", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "irq", "b_", "._", "data_", "=_", "bytes_", "(_", "'", "DON", "E", "'_", ",_", "'", "ASCII", "'_", ")_", "+_", "CRL", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ou", "q_", "._", "put_", "(_", "irq", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "2_", ",_", "'", "server", " ", "IDLE", " ", "finish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "capabilities_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "dat_", "=_", "self_", "._", "capability_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dat_", "==_", "[_", "None_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "self_", "._", "error_", "(_", "'", "no", " ", "CAPA", "BILITY", " ", "response", " ", "from", " ", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dat_", "=_", "str_", "(_", "dat_", "[_", "-_", "1_", "]_", ",_", "\"", "ASCII", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dat_", "=_", "dat_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "capabilities_", "=_", "tuple_", "(_", "dat_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "self_", ",_", "name_", ",_", "leave_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "command", "s", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "(_", "typ_", ",_", "dat_", ")_", "in_", "enumerate_", "(_", "self_", "._", "unta", "gged", "\\u", "responses_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "typ_", "==_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "leave_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "self_", "._", "unta", "gged", "\\u", "responses_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'\\u", "get", "\\u", "unta", "gged", "\\u", "response", "(%", "s", ")", " ", "=>", " ", "%", ".8", "0", "r", "'_", "%_", "(_", "name_", ",_", "dat_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "match_", "(_", "self_", ",_", "cre", "_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "compile", "d", " ", "regular", " ", "express", "ion", " ", "'", "cre", "'", " ", "match", " ", "method", " ", "on", " ", "'", "s", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "result", ",", " ", "return", " ", "success", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mo_", "=_", "cre", "_", "._", "match_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "mo_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "put", "\\u", "response_", "(_", "self_", ",_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "expect", "ing", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rle", "n_", "=_", "len_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dle", "n_", "=_", "min_", "(_", "self_", "._", "\\u", "expect", "ing", "\\u", "data\\u", "len_", ",_", "rle", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'\\u", "put", "\\u", "response", " ", "expect", "ing", " ", "data", " ", "len", " ", "%", "s", ",", " ", "got", " ", "%", "s", "'_", "%_", "(_", "self_", "._", "\\u", "expect", "ing", "\\u", "data\\u", "len_", ",_", "rle", "n_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "expect", "ing", "\\u", "data\\u", "len_", "-=_", "dle", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "expect", "ing", "\\u", "data_", "=_", "(_", "self_", "._", "\\u", "expect", "ing", "\\u", "data\\u", "len_", "!=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rle", "n_", "<=_", "dle", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "accumulated", "\\u", "data_", "._", "append_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "accumulated", "\\u", "data_", "._", "append_", "(_", "resp_", "[_", ":_", "dle", "n_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "resp_", "[_", "dle", "n_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "accumulated", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "dat_", "=_", "self_", "._", "\\u", "literal", "\\u", "expected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "append", "\\u", "unta", "gged", "_", "(_", "typ_", ",_", "(_", "dat_", ",_", "b", "''_", "._", "join_", "(_", "self_", "._", "\\u", "accumulated", "\\u", "data_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "accumulated", "\\u", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Proto", "col", " ", "mandat", "es", " ", "all", " ", "lines", " ", "terminate", "d", " ", "by", " ", "CRL", "F_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "=_", "resp_", "[_", ":_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'\\u", "put", "\\u", "response", "(%", "r", ")'_", "%_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "continuation", "'_", "in_", "self_", "._", "tagg", "ed", "\\u", "commands_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continuation", "\\u", "expected_", "=_", "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 ", " _", "continuation", "\\u", "expected_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "literal", "\\u", "expected_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dat_", "=_", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "match_", "(_", "self_", "._", "literal", "\\u", "cre", "_", ",_", "dat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "literal", "\\u", "expected_", "[_", "1_", "]_", "=_", "dat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "expect", "ing", "\\u", "data_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "expect", "ing", "\\u", "data\\u", "len_", "=_", "int_", "(_", "self_", "._", "mo_", "._", "group_", "(_", "'", "size", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'", "expect", "ing", " ", "literal", " ", "size", " ", "%", "s", "'_", "%_", "self_", "._", "\\u", "expect", "ing", "\\u", "data\\u", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "typ_", "=_", "self_", "._", "\\u", "literal", "\\u", "expected_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "literal", "\\u", "expected_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dat_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "append", "\\u", "unta", "gged", "_", "(_", "typ_", ",_", "dat_", ")_", "#", " ", "Tail", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'", "literal", " ", "complete", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Command", " ", "completion", " ", "response", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "match_", "(_", "self_", "._", "tag", "re_", ",_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "self_", "._", "mo_", "._", "group_", "(_", "'", "tag", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", "=_", "str_", "(_", "self_", "._", "mo_", "._", "group_", "(_", "'", "type", "'_", ")_", ",_", "'", "ASCII", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dat_", "=_", "self_", "._", "mo_", "._", "group_", "(_", "'", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "in_", "(_", "'", "OK", "'_", ",_", "'", "NO", "'_", ",_", "'", "BAD", "'_", ")_", "and_", "self_", "._", "\\u", "match_", "(_", "self_", "._", "response", "\\u", "code", "\\u", "cre", "_", ",_", "dat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "append", "\\u", "unta", "gged", "_", "(_", "str_", "(_", "self_", "._", "mo_", "._", "group_", "(_", "'", "type", "'_", ")_", ",_", "'", "ASCII", "'_", ")_", ",_", "self_", "._", "mo_", "._", "group_", "(_", "'", "data", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "tag_", "in_", "self_", "._", "tagg", "ed", "\\u", "commands_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "unexpected", " ", "tagg", "ed", " ", "response", ":", " ", "%", "r", "'_", "%_", "resp_", ")_", "\\u\\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", "request", "\\u", "pop_", "(_", "tag_", ",_", "(_", "typ_", ",_", "[_", "dat_", "]_", ")_", ")_", "\\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 ", " _", "dat", "2_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'*", "'", " ", "(", "unta", "gged", ")", " ", "response", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "match_", "(_", "self_", "._", "unta", "gged", "\\u", "response", "\\u", "cre", "_", ",_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "\\u", "match_", "(_", "self_", "._", "unta", "gged", "\\u", "status", "\\u", "cre", "_", ",_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dat", "2_", "=_", "self_", "._", "mo_", "._", "group_", "(_", "'", "data", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "mo_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "other", " ", "possibilit", "y", " ", "is", " ", "'+", "'", " ", "(", "continuation", ")", " ", "response", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "\\u", "match_", "(_", "self_", "._", "continuation", "\\u", "cre", "_", ",_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "continuation", "\\u", "expected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "\"", "unexpected", " ", "continuation", " ", "response", ":", " ", "'%", "r", "'\"_", "%_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "request", "\\u", "pop_", "(_", "'", "continuation", "'_", ",_", "(_", "True_", ",_", "self_", "._", "mo_", "._", "group_", "(_", "'", "data", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "\"", "unexpected", " ", "response", ":", " ", "'%", "r", "'\"_", "%_", "resp_", ")_", "\\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_", "typ_", "=_", "str_", "(_", "self_", "._", "mo_", "._", "group_", "(_", "'", "type", "'_", ")_", ",_", "'", "ASCII", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dat_", "=_", "self_", "._", "mo_", "._", "group_", "(_", "'", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dat_", "is_", "None_", ":_", "dat_", "=_", "b", "''_", "#", " ", "Null", " ", "unta", "gged", " ", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dat", "2_", ":_", "dat_", "=_", "dat_", "+_", "b", "'", " ", "'_", "+_", "dat", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Is", " ", "there", " ", "a", " ", "literal", " ", "to", " ", "come", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "match_", "(_", "self_", "._", "literal", "\\u", "cre", "_", ",_", "dat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "expect", "ing", "\\u", "data_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "expect", "ing", "\\u", "data\\u", "len_", "=_", "int_", "(_", "self_", "._", "mo_", "._", "group_", "(_", "'", "size", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'", "read", " ", "literal", " ", "size", " ", "%", "s", "'_", "%_", "self_", "._", "\\u", "expect", "ing", "\\u", "data\\u", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "literal", "\\u", "expected_", "=_", "[_", "typ_", ",_", "dat_", "]_", "\\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_", "self_", "._", "\\u", "append", "\\u", "unta", "gged", "_", "(_", "typ_", ",_", "dat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "in_", "(_", "'", "OK", "'_", ",_", "'", "NO", "'_", ",_", "'", "BAD", "'_", ")_", "and_", "self_", "._", "\\u", "match_", "(_", "self_", "._", "response", "\\u", "code", "\\u", "cre", "_", ",_", "dat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "append", "\\u", "unta", "gged", "_", "(_", "str_", "(_", "self_", "._", "mo_", "._", "group_", "(_", "'", "type", "'_", ")_", ",_", "'", "ASCII", "'_", ")_", ",_", "self_", "._", "mo_", "._", "group_", "(_", "'", "data", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "typ_", "!=_", "'", "OK", "'_", ":_", "#", " ", "NO", ",", " ", "BY", "E", ",", " ", "IDLE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "end", "\\u", "idle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Command", " ", "wait", "ing", " ", "for", " ", "abort", "ed", " ", "continuation", " ", "response", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "continuation", "\\u", "expected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "request", "\\u", "pop_", "(_", "'", "continuation", "'_", ",_", "(_", "False_", ",_", "resp_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ba", "d", " ", "news", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "typ_", "in_", "(_", "'", "NO", "'_", ",_", "'", "BAD", "'_", ",_", "'", "BY", "E", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "typ_", "==_", "'", "BY", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Terminate", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'%", "s", " ", "response", ":", " ", "%", "r", "'_", "%_", "(_", "typ_", ",_", "dat_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "quote_", "(_", "self_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'\"", "%", "s", "\"'_", "%_", "arg_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'\\\\\\\\\\\\\\\\", "'_", ")_", "._", "replace_", "(_", "'\"'_", ",_", "'\\\\\\\\", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "release", "\\u", "state", "\\u", "change_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "state", "\\u", "change", "\\u", "pending_", "._", "locked_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state", "\\u", "change", "\\u", "pending_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "3_", ",_", "'", "state", "\\u", "change", "\\u", "pend", "ing", ".", "release", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "request", "\\u", "pop_", "(_", "self_", ",_", "name_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "command", "s", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rq", "b_", "=_", "self_", "._", "tagg", "ed", "\\u", "commands_", "._", "pop_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "tagg", "ed", "\\u", "commands_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "need", "\\u", "event_", "=_", "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 ", " _", "need", "\\u", "event_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'\\u", "request", "\\u", "pop", "(%", "s", ",", " ", "%", "r", ")", " ", "[", "%", "d", "]", " ", "=", " ", "%", "s", "'_", "%_", "(_", "name_", ",_", "data_", ",_", "len_", "(_", "self_", "._", "tagg", "ed", "\\u", "commands_", ")_", ",_", "rq", "b_", "._", "tag_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rq", "b_", "._", "deliver", "_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "need", "\\u", "event_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "3_", ",_", "'", "state", "\\u", "change", "\\u", "free", ".", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state", "\\u", "change", "\\u", "free_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "request", "\\u", "push_", "(_", "self_", ",_", "tag_", "=_", "None_", ",_", "name_", "=_", "None_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "command", "s", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rq", "b_", "=_", "Request_", "(_", "self_", ",_", "name_", "=_", "name_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "rq", "b_", "._", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "tagg", "ed", "\\u", "commands_", "[_", "tag_", "]_", "=_", "rq", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'\\u", "request", "\\u", "push", "(%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ")", " ", "=", " ", "%", "s", "'_", "%_", "(_", "tag_", ",_", "name_", ",_", "repr_", "(_", "kw_", ")_", ",_", "rq", "b_", "._", "tag_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rq", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "simple", "\\u", "command_", "(_", "self_", ",_", "name_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "callback", "'_", "in_", "kw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "old", " ", "calling", " ", "sequence", " ", "for", " ", "back", "-", "compa", "t", " ", "with", " ", "python", " ", "<", "2.6", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "command_", "(_", "name_", ",_", "callback_", "=_", "self_", "._", "\\u", "command", "\\u", "completer_", ",_", "cb", "\\u", "arg_", "=_", "kw_", ",_", "cb", "\\u", "self_", "=_", "True_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "command", "\\u", "complete_", "(_", "self_", "._", "\\u", "command_", "(_", "name_", ",_", "*_", "args_", ")_", ",_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "unta", "gged", "\\u", "response_", "(_", "self_", ",_", "typ_", ",_", "dat_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "typ_", "==_", "'", "NO", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "typ_", ",_", "dat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "self_", "._", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "typ_", ",_", "[_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dat_", "=_", "self_", "._", "\\u", "get", "\\u", "unta", "gged", "\\u", "response_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "dat_", ":_", "\\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_", "data_", "+=_", "dat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'\\u", "unta", "gged", "\\u", "response", "(%", "s", ",", " ", "?", ",", " ", "%", "s", ")", " ", "=>", " ", "%", ".8", "0", "r", "'_", "%_", "(_", "typ_", ",_", "name_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "typ_", ",_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "close", "\\u", "threads_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'\\u", "close", "\\u", "thread", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ou", "q_", "._", "put_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wrt", "h_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "call", " ", "shut", "down", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "rdt", "h_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "int", "h_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "handler_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp", "\\u", "timeout_", "=_", "self_", "._", "resp", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "set", "Name_", "(_", "self_", "._", "identifier_", "+_", "'", "handler", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "#", " ", "Don", "'", "t", " ", "start", " ", "handling", " ", "bef", "ore", " ", "main", " ", "thread", " ", "ready_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "startin", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "typ_", ",_", "val_", "=_", "self_", "._", "abort_", ",_", "'", "connecti", "on", " ", "terminate", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "self_", "._", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "idle", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "idle", "\\u", "timeout_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "self_", "._", "idle", "\\u", "timeout_", "-_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timeout_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "timeout_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "idle", "\\u", "rq", "b_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'", "server", " ", "ID", "LING", ",", " ", "timeo", "ut", "=", "%", ".2", "f", "'_", "%_", "timeout_", ")_", "\\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 ", " _", "timeout_", "=_", "resp", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "idle", "\\u", "lock_", "._", "release_", "(_", ")_", "\\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 ", " _", "line_", "=_", "self_", "._", "in", "q_", "._", "get_", "(_", "True_", ",_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "idle", "\\u", "rq", "b_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "resp", "\\u", "timeout_", "is_", "not_", "None_", "and_", "self_", "._", "tagg", "ed", "\\u", "commands_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "response", " ", "timeo", "ut", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", ",_", "val_", "=_", "self_", "._", "abort_", ",_", "'", "no", " ", "response", " ", "after", " ", "%", "s", " ", "secs", "'_", "%_", "resp", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "idle", "\\u", "timeout_", ">_", "time_", "._", "time_", "(_", ")_", ":_", "\\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_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "2_", ",_", "'", "server", " ", "IDLE", " ", "timed", "out", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "IDLE", "\\u", "TIME", "OUT", "\\u", "RESPONSE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "line_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "in", "q", " ", "Non", "e", " ", "-", " ", "termina", "ting", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "line_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "val_", "=_", "line_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "put", "\\u", "response_", "(_", "line_", ")_", "\\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 ", " _", "typ_", ",_", "val_", "=_", "self_", "._", "error_", ",_", "'", "program", " ", "error", ":", " ", "%", "s", " ", "-", " ", "%", "s", "'_", "%_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", "\\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_", "self_", "._", "Terminate", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "termina", "ting", ":", " ", "%", "s", "'_", "%_", "repr_", "(_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "self_", "._", "ou", "q_", "._", "empty_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qe", "l_", "=_", "self_", "._", "ou", "q_", "._", "get", "\\u", "nowait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "qe", "l_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "qe", "l_", "._", "abort_", "(_", "typ_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ou", "q_", "._", "put_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "list_", "(_", "self_", "._", "tagg", "ed", "\\u", "commands_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rq", "b_", "=_", "self_", "._", "tagg", "ed", "\\u", "commands_", "._", "pop_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rq", "b_", "._", "abort_", "(_", "typ_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "state", "\\u", "change", "\\u", "free_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "command", "s", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "3_", ",_", "'", "state", "\\u", "change", "\\u", "free", ".", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "finish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "reader_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "set", "Name_", "(_", "self_", "._", "identifier_", "+_", "'", "reader", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "startin", "g", " ", "usi", "ng", " ", "poll", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "poll", "\\u", "error_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Poll", "Errors_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "select_", "._", "POLL", "ERR_", ":_", "'", "Error", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "select_", "._", "POLL", "HU", "P_", ":_", "'", "Hang", " ", "up", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "select_", "._", "POLL", "NV", "AL_", ":_", "'", "Inva", "lid", " ", "request", ":", " ", "descrip", "tor", " ", "not", " ", "open", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'", " ", "'_", "._", "join_", "(_", "[_", "Poll", "Errors_", "[_", "s_", "]_", "for_", "s_", "in_", "Poll", "Errors_", "._", "keys_", "(_", ")_", "if_", "(_", "s_", "&_", "state_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line", "\\u", "part_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll_", "=_", "select_", "._", "poll_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "poll_", "._", "register_", "(_", "self_", "._", "read", "\\u", "fd_", ",_", "select_", "._", "POLL", "IN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rx", "zero_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "terminate_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "\\u", "poll", "\\u", "timeout_", "=_", "self_", "._", "read", "\\u", "poll", "\\u", "timeout_", "*_", "1000_", "#", " ", "poll", "()", " ", "timeo", "ut", " ", "is", " ", "in", " ", "millis", "ecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "(_", "terminate_", "or_", "self_", "._", "Terminate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "state_", "==_", "LOGO", "UT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "read", "\\u", "poll", "\\u", "timeout_", "\\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 ", " _", "r_", "=_", "poll_", "._", "poll_", "(_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'", "poll", " ", "=>", " ", "%", "s", "'_", "%_", "repr_", "(_", "r_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "#", " ", "Timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fd_", ",_", "state_", "=_", "r_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "state_", "&_", "select_", "._", "POLL", "IN_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data_", "=_", "self_", "._", "read_", "(_", "self_", "._", "read", "\\u", "size_", ")_", "#", " ", "Drain", " ", "ssl", " ", "buffer", " ", "if", " ", "present_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dle", "n_", "=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'", "rcv", "d", " ", "%", "s", "'_", "%_", "dle", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dle", "n_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "rx", "zero_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rx", "zero_", ">_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "IO", "Error_", "(_", "\"", "Too", " ", "many", " ", "read", " ", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "#", " ", "Tr", "y", " ", "again", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rx", "zero_", "=_", "0_", "\\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 ", " ", " _", "stop_", "=_", "data_", "._", "find_", "(_", "b", "'\\\\", "n", "'_", ",_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stop_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "line", "\\u", "part_", "+=_", "data_", "[_", "start_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stop_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "\\u", "part_", ",_", "start_", ",_", "line_", "=_", "b", "''_", ",_", "stop_", ",_", "line", "\\u", "part_", "+_", "data_", "[_", "start_", ":_", "stop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'<", " ", "%", "r", "'_", "%_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "in", "q_", "._", "put_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "Terminate", "Reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "terminate_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "&_", "~_", "(_", "select_", "._", "POLL", "IN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "IO", "Error_", "(_", "poll", "\\u", "error_", "(_", "state_", ")_", ")_", "\\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 ", " _", "reason_", "=_", "'", "socket", " ", "error", ":", " ", "%", "s", " ", "-", " ", "%", "s", "'_", "%_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "self_", "._", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "print", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "self_", "._", "debug_", "+=_", "4_", "#", " ", "Output", " ", "all_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "in", "q_", "._", "put_", "(_", "(_", "self_", "._", "abort_", ",_", "reason_", ")_", ")_", "\\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_", "poll_", "._", "unregister_", "(_", "self_", "._", "read", "\\u", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "finish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "reader_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "set", "Name_", "(_", "self_", "._", "identifier_", "+_", "'", "reader", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "startin", "g", " ", "usi", "ng", " ", "select", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line", "\\u", "part_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rx", "zero_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "terminate_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "(_", "terminate_", "or_", "self_", "._", "Terminate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "state_", "==_", "LOGO", "UT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "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 ", " _", "timeout_", "=_", "self_", "._", "read", "\\u", "poll", "\\u", "timeout_", "\\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 ", " _", "r_", ",_", "w_", ",_", "e_", "=_", "select_", "._", "select_", "(_", "[_", "self_", "._", "read", "\\u", "fd_", "]_", ",_", "[_", "]_", ",_", "[_", "]_", ",_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'", "select", " ", "=>", " ", "%", "s", ",", " ", "%", "s", ",", " ", "%", "s", "'_", "%_", "(_", "r_", ",_", "w_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "r_", ":_", "#", " ", "Timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "self_", "._", "read_", "(_", "self_", "._", "read", "\\u", "size_", ")_", "#", " ", "Drain", " ", "ssl", " ", "buffer", " ", "if", " ", "present_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dle", "n_", "=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "5_", ",_", "'", "rcv", "d", " ", "%", "s", "'_", "%_", "dle", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dle", "n_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rx", "zero_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rx", "zero_", ">_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "IO", "Error_", "(_", "\"", "Too", " ", "many", " ", "read", " ", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "#", " ", "Tr", "y", " ", "again", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rx", "zero_", "=_", "0_", "\\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 ", " ", "_", "stop_", "=_", "data_", "._", "find_", "(_", "b", "'\\\\", "n", "'_", ",_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stop_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "line", "\\u", "part_", "+=_", "data_", "[_", "start_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stop_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "\\u", "part_", ",_", "start_", ",_", "line_", "=_", "b", "''_", ",_", "stop_", ",_", "(_", "line", "\\u", "part_", "+_", "data_", "[_", "start_", ":_", "stop_", "]_", ")_", "._", "decode_", "(_", "errors_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'<", " ", "%", "r", "'_", "%_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "in", "q_", "._", "put_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "Terminate", "Reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "terminate_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reason_", "=_", "'", "socket", " ", "error", ":", " ", "%", "s", " ", "-", " ", "%", "s", "'_", "%_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "self_", "._", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "print", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "self_", "._", "debug_", "+=_", "4_", "#", " ", "Output", " ", "all_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "in", "q_", "._", "put_", "(_", "(_", "self_", "._", "abort_", ",_", "reason_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "finish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "writer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "set", "Name_", "(_", "self_", "._", "identifier_", "+_", "'", "writer", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "startin", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reason_", "=_", "'", "Terminate", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "not_", "self_", "._", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rq", "b_", "=_", "self_", "._", "ou", "q_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rq", "b_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "#", " ", "Out", "q", " ", "flush", "ed_", "\\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_", "._", "send_", "(_", "rq", "b_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "4_", ",_", "'>", " ", "%", "r", "'_", "%_", "rq", "b_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reason_", "=_", "'", "socket", " ", "error", ":", " ", "%", "s", " ", "-", " ", "%", "s", "'_", "%_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "self_", "._", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "print", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "self_", "._", "debug_", "+=_", "4_", "#", " ", "Output", " ", "all_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rq", "b_", "._", "abort_", "(_", "self_", "._", "abort_", ",_", "reason_", ")_", "\\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_", "self_", "._", "in", "q_", "._", "put_", "(_", "(_", "self_", "._", "abort_", ",_", "reason_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "finish", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "init", "\\u", "debug_", "(_", "self_", ",_", "debug_", "=_", "None_", ",_", "debug", "\\u", "file_", "=_", "None_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "debug", "\\u", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "debug_", "=_", "self_", "._", "\\u", "choose", "\\u", "non", "ull", "\\u", "or", "\\u", "dfl", "t_", "(_", "0_", ",_", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "debug", "\\u", "file_", "=_", "self_", "._", "\\u", "choose", "\\u", "non", "ull", "\\u", "or", "\\u", "dfl", "t_", "(_", "sys_", "._", "stderr_", ",_", "debug", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "self_", "._", "\\u", "choose", "\\u", "non", "ull", "\\u", "or", "\\u", "dfl", "t_", "(_", "DF", "LT", "\\u", "DEBU", "G", "\\u", "BUF", "\\u", "LV", "L_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "len_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "idx_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cmd", "\\u", "log_", "=_", "{_", "}_", "#", " ", "Las", "t", " ", "`\\u", "cmd", "\\u", "log", "\\u", "len", "'", " ", "interactions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mesg_", "(_", "'", "imap", "lib", "2", " ", "version", " ", "%", "s", "'_", "%_", "\\u\\u", "version\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mesg_", "(_", "'", "imap", "lib", "2", " ", "debug", " ", "level", " ", "%", "s", ",", " ", "buffer", " ", "level", " ", "%", "s", "'_", "%_", "(_", "self_", "._", "debug_", ",_", "self_", "._", "debug", "\\u", "buf", "\\u", "lvl_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "dump", "\\u", "ur_", "(_", "self_", ",_", "lvl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lvl_", ">_", "self_", "._", "debug_", ":_", "\\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_", "l_", "=_", "self_", "._", "unta", "gged", "\\u", "responses_", "#", " ", "NB", ":", " ", "bytes", " ", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "l_", ":_", "\\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_", "t_", "=_", "'\\\\", "n", "\\\\", "t", "\\\\", "t", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "[_", "'%", "s", ":", " ", "\"%", "s", "\"'_", "%_", "(_", "x_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", "[_", "0_", "]_", "and_", "b", "'\"", " ", "\"'_", "._", "join_", "(_", "x_", "[_", "1_", "]_", ")_", "or_", "''_", ")_", "for_", "x_", "in_", "l_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "debug", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mesg_", "(_", "'", "unta", "gged", " ", "response", "s", " ", "dump", ":", "%", "s", "%", "s", "'_", "%_", "(_", "t_", ",_", "t_", "._", "join_", "(_", "l_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "debug", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "log_", "(_", "self_", ",_", "lvl_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lvl_", ">_", "self_", "._", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "line_", "[_", "-_", "2_", ":_", "]_", "==_", "CRL", "F_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "line_", "[_", ":_", "-_", "2_", "]_", "+_", "'\\\\\\\\", "r", "\\\\\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tn_", "=_", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "get", "Name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lvl_", "<=_", "1_", "or_", "self_", "._", "debug_", ">_", "self_", "._", "debug", "\\u", "buf", "\\u", "lvl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "debug", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mesg_", "(_", "line_", ",_", "tn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "debug", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lvl_", "!=_", "1_", ":_", "\\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_", "#", " ", "Keep", " ", "log", " ", "of", " ", "last", " ", "`\\u", "cmd", "\\u", "log", "\\u", "len", "'", " ", "interacti", "ons", " ", "for", " ", "debugg", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "debug", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cmd", "\\u", "log_", "[_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "idx_", "]_", "=_", "(_", "line_", ",_", "tn_", ",_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "idx_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "idx_", ">=_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "len_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "idx_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "debug", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "mesg_", "(_", "self_", ",_", "s_", ",_", "tn_", "=_", "None_", ",_", "secs_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "secs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "secs_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tn_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tn_", "=_", "threading_", "._", "current", "Thread_", "(_", ")_", "._", "get", "Name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tm_", "=_", "time_", "._", "strftime_", "(_", "'%", "M", ":", "%", "S", "'_", ",_", "time_", "._", "localtime_", "(_", "secs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "debug", "\\u", "file_", "._", "write_", "(_", "'", " ", " ", "%", "s", ".", "%", "02", "d", " ", "%", "s", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "tm_", ",_", "(_", "secs_", "*_", "100_", ")_", "%_", "100_", ",_", "tn_", ",_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "debug", "\\u", "file_", "._", "flush_", "(_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "print", "\\u", "log_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "debug", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", ",_", "n_", "=_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "idx_", ",_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", ":_", "self_", "._", "\\u", "mesg_", "(_", "'", "last", " ", "%", "d", " ", "log", " ", "message", "s", ":'_", "%_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "mesg_", "(_", "*_", "self_", "._", "\\u", "cmd", "\\u", "log_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", ">=_", "self_", "._", "\\u", "cmd", "\\u", "log", "\\u", "len_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "debug", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "IMAP", "4", "\\u", "SSL_", "(_", "IMAP", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "IMAP", "4", " ", "client", " ", "class", " ", "over", " ", "SS", "L", " ", "connecti", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Instantiate", " ", "with", ":", "\\", "10", ";", " ", " ", " ", " ", "IMAP", "4", "\\u", "SS", "L", "(", "host", "=", "Non", "e", ",", " ", "port", "=", "Non", "e", ",", " ", "keyfile", "=", "Non", "e", ",", " ", "certfile", "=", "Non", "e", ",", " ", "ca", "\\u", "cert", "s", "=", "Non", "e", ",", " ", "cert", "\\u", "verify", "\\u", "cb", "=", "Non", "e", ",", " ", "ssl", "\\u", "version", "=\"", "ssl", "23", "\",", " ", "debug", "=", "Non", "e", ",", " ", "debug", "\\u", "file", "=", "Non", "e", ",", " ", "identifi", "er", "=", "Non", "e", ",", " ", "timeo", "ut", "=", "Non", "e", ",", " ", "debug", "\\u", "buf", "\\u", "lvl", "=", "Non", "e", ",", " ", "tls", "\\u", "level", "=\"", "tls", "\\u", "compa", "t", "\")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "host", " ", " ", " ", "-", " ", "host", "'", "s", " ", "name", " ", "(", "default", ":", " ", "local", "host", ");", "\\", "10", ";", " ", " ", " ", " ", "port", " ", " ", " ", "-", " ", "port", " ", "number", " ", "(", "default", ":", " ", "standard", " ", "IMAP", "4", " ", "SS", "L", " ", "port", ");", "\\", "10", ";", " ", " ", " ", " ", "keyfile", " ", " ", " ", " ", "-", " ", "PEM", " ", "format", "ted", " ", "file", " ", "tha", "t", " ", "contain", "s", " ", "your", " ", "private", " ", "key", " ", "(", "default", ":", " ", "Non", "e", ");", "\\", "10", ";", " ", " ", " ", " ", "certfile", " ", " ", " ", "-", " ", "PEM", " ", "format", "ted", " ", "certifica", "te", " ", "chain", " ", "file", " ", "(", "default", ":", " ", "Non", "e", ");", "\\", "10", ";", " ", " ", " ", " ", "ca", "\\u", "cert", "s", " ", " ", " ", "-", " ", "PEM", " ", "format", "ted", " ", "certifica", "te", " ", "chain", " ", "file", " ", "used", " ", "to", " ", "validat", "e", " ", "server", " ", "certificates", " ", "(", "default", ":", " ", "Non", "e", ");", "\\", "10", ";", " ", " ", " ", " ", "cert", "\\u", "verify", "\\u", "cb", " ", "-", " ", "function", " ", "to", " ", "verify", " ", "authe", "ntic", "it", "y", " ", "of", " ", "server", " ", "certificates", " ", "(", "default", ":", " ", "Non", "e", ");", "\\", "10", ";", " ", " ", " ", " ", "ssl", "\\u", "version", " ", " ", " ", " ", "-", " ", "SS", "L", " ", "version", " ", "to", " ", "use", " ", "(", "default", ":", " ", "\"", "ssl", "23", "\",", " ", "choose", " ", "from", ":", " ", "\"", "tls", "1", "\",\"", "ssl", "3", "\",\"", "ssl", "23", "\");", "\\", "10", ";", " ", " ", " ", " ", "debug", " ", " ", "-", " ", "debug", " ", "level", " ", "(", "default", ":", " ", "0", " ", "-", " ", "no", " ", "debug", ");", "\\", "10", ";", " ", " ", " ", " ", "debug", "\\u", "file", " ", "-", " ", "debug", " ", "stream", " ", "(", "default", ":", " ", "sys", ".", "std", "err", ");", "\\", "10", ";", " ", " ", " ", " ", "identifi", "er", " ", "-", " ", "thread", " ", "identifi", "er", " ", "prefix", " ", "(", "default", ":", " ", "host", ");", "\\", "10", ";", " ", " ", " ", " ", "timeo", "ut", " ", " ", " ", " ", "-", " ", "timeo", "ut", " ", "in", " ", "second", "s", " ", "whe", "n", " ", "expect", "ing", " ", "a", " ", "command", " ", "response", ".", "\\", "10", ";", " ", " ", " ", " ", "debug", "\\u", "buf", "\\u", "lvl", " ", " ", "-", " ", "debug", " ", "level", " ", "at", " ", "whi", "ch", " ", "bufferi", "ng", " ", "is", " ", "turn", "ed", " ", "off", ".", "\\", "10", ";", " ", " ", " ", " ", "tls", "\\u", "level", " ", " ", "-", " ", "TLS", " ", "security", " ", "level", " ", "(", "default", ":", " ", "\"", "tls", "\\u", "compa", "t", "\")", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "recognize", "d", " ", "values", " ", "for", " ", "tls", "\\u", "level", " ", "are", ":", "\\", "10", ";", " ", " ", " ", " ", "tls", "\\u", "secure", ":", " ", "accept", " ", "only", " ", "TLS", " ", "protoc", "ols", " ", "recognize", "d", " ", "as", " ", "\"", "secure", "\"", "\\", "10", ";", " ", " ", " ", " ", "tls", "\\u", "no", "\\u", "ssl", ":", " ", "disable", " ", "SS", "Lv", "2", " ", "and", " ", "SS", "Lv", "3", " ", "support", "\\", "10", ";", " ", " ", " ", " ", "tls", "\\u", "compa", "t", ":", " ", "accept", " ", "all", " ", "SS", "L", "/", "TLS", " ", "version", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "documentation", " ", "see", " ", "the", " ", "docstr", "ing", " ", "of", " ", "the", " ", "parent", " ", "class", " ", "IMAP", "4", ".", "\\", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "IMAP", "4", "\\u", "SSL_", "(_", "IMAP", "4_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "host_", "=_", "None_", ",_", "port_", "=_", "None_", ",_", "keyfile_", "=_", "None_", ",_", "certfile", "_", "=_", "None_", ",_", "ca", "\\u", "certs_", "=_", "None_", ",_", "cert", "\\u", "verify", "\\u", "cb_", "=_", "None_", ",_", "ssl", "\\u", "version_", "=_", "\"", "ssl", "23", "\"_", ",_", "debug_", "=_", "None_", ",_", "debug", "\\u", "file_", "=_", "None_", ",_", "identifier_", "=_", "None_", ",_", "timeout_", "=_", "None_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "None_", ",_", "tls", "\\u", "level_", "=_", "TLS", "\\u", "COMPA", "T_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "keyfile_", "=_", "keyfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "certfile", "_", "=_", "certfile", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ca", "\\u", "certs_", "=_", "ca", "\\u", "certs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cert", "\\u", "verify", "\\u", "cb_", "=_", "cert", "\\u", "verify", "\\u", "cb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssl", "\\u", "version_", "=_", "ssl", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tls", "\\u", "level_", "=_", "tls", "\\u", "level_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMAP", "4_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "host_", ",_", "port_", ",_", "debug_", ",_", "debug", "\\u", "file_", ",_", "identifier_", ",_", "timeout_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4", "\\u", "SSL_", "(_", "IMAP", "4_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open_", "(_", "self_", ",_", "host_", "=_", "None_", ",_", "port_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "open", "(", "host", "=", "Non", "e", ",", " ", "port", "=", "Non", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Set", "up", " ", "secure", " ", "connecti", "on", " ", "to", " ", "remote", " ", "server", " ", "on", " ", "\"", "host", ":", "port", "\"", "\\", "10", ";", " ", " ", " ", " ", "(", "default", ":", " ", "local", "host", ":", "standard", " ", "IMAP", "4", " ", "SS", "L", " ", "port", ").", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "connecti", "on", " ", "will", " ", "be", " ", "used", " ", "by", " ", "the", " ", "routin", "es", ":", "\\", "10", ";", " ", " ", " ", " ", "read", ",", " ", "send", ",", " ", "shut", "down", ",", " ", "socket", ",", " ", "ssl", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "host_", "=_", "self_", "._", "\\u", "choose", "\\u", "non", "ull", "\\u", "or", "\\u", "dfl", "t_", "(_", "''_", ",_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port_", "=_", "self_", "._", "\\u", "choose", "\\u", "non", "ull", "\\u", "or", "\\u", "dfl", "t_", "(_", "IMAP", "4", "\\u", "SS", "L", "\\u", "PORT_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "=_", "self_", "._", "open", "\\u", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ssl", "\\u", "wrap", "\\u", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4", "\\u", "SSL_", "(_", "IMAP", "4_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "data", " ", "=", " ", "read", "(", "size", ")", "\\", "10", ";", " ", " ", " ", " ", "Read", " ", "at", " ", "most", " ", "'", "size", "'", " ", "bytes", " ", "from", " ", "remote", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "decompress", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "sock_", "._", "read_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "decompress", "or_", "._", "uncon", "sum", "ed", "\\u", "tail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "decompress", "or_", "._", "uncon", "sum", "ed", "\\u", "tail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "sock_", "._", "read_", "(_", "READ", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "decompress", "or_", "._", "decompress_", "(_", "data_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4", "\\u", "SSL_", "(_", "IMAP", "4_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "send", "(", "data", ")", "\\", "10", ";", " ", " ", " ", " ", "Sen", "d", " ", "'", "data", "'", " ", "to", " ", "remote", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "compressor", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "compressor", "_", "._", "compress_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "+=_", "self_", "._", "compressor", "_", "._", "flush_", "(_", "zlib_", "._", "Z", "\\u", "SYNC", "\\u", "FLU", "SH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "sock_", ",_", "\"", "send", "all", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sock_", "._", "sendall_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dle", "n_", "=_", "len_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "dle", "n_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sent_", "=_", "self_", "._", "sock_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sent_", "==_", "dle", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "#", " ", "avoid", " ", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "data_", "[_", "sent_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dle", "n_", "=_", "dle", "n_", "-_", "sent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4", "\\u", "SSL_", "(_", "IMAP", "4_", ")_", ":_", "\\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_", "ssl_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "ssl", " ", "=", " ", "ssl", "()", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "ssl", " ", "instance", " ", "used", " ", "to", " ", "communi", "cate", " ", "with", " ", "the", " ", "IMAP", "4", " ", "server", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "sock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "IMAP", "4", "\\u", "stream_", "(_", "IMAP", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "IMAP", "4", " ", "client", " ", "class", " ", "over", " ", "a", " ", "stream", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Instantiate", " ", "with", ":", "\\", "10", ";", " ", " ", " ", " ", "IMAP", "4", "\\u", "stream", "(", "command", ",", " ", "debug", "=", "Non", "e", ",", " ", "debug", "\\u", "file", "=", "Non", "e", ",", " ", "identifi", "er", "=", "Non", "e", ",", " ", "timeo", "ut", "=", "Non", "e", ",", " ", "debug", "\\u", "buf", "\\u", "lvl", "=", "Non", "e", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "command", " ", " ", " ", " ", "-", " ", "string", " ", "tha", "t", " ", "can", " ", "be", " ", "pass", "ed", " ", "to", " ", "subproc", "ess", ".", "Pop", "en", "();", "\\", "10", ";", " ", " ", " ", " ", "debug", " ", " ", "-", " ", "debug", " ", "level", " ", "(", "default", ":", " ", "0", " ", "-", " ", "no", " ", "debug", ");", "\\", "10", ";", " ", " ", " ", " ", "debug", "\\u", "file", " ", "-", " ", "debug", " ", "stream", " ", "(", "default", ":", " ", "sys", ".", "std", "err", ");", "\\", "10", ";", " ", " ", " ", " ", "identifi", "er", " ", "-", " ", "thread", " ", "identifi", "er", " ", "prefix", " ", "(", "default", ":", " ", "host", ");", "\\", "10", ";", " ", " ", " ", " ", "timeo", "ut", " ", " ", " ", " ", "-", " ", "timeo", "ut", " ", "in", " ", "second", "s", " ", "whe", "n", " ", "expect", "ing", " ", "a", " ", "command", " ", "response", ".", "\\", "10", ";", " ", " ", " ", " ", "debug", "\\u", "buf", "\\u", "lvl", " ", " ", "-", " ", "debug", " ", "level", " ", "at", " ", "whi", "ch", " ", "bufferi", "ng", " ", "is", " ", "turn", "ed", " ", "off", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "documentation", " ", "see", " ", "the", " ", "docstr", "ing", " ", "of", " ", "the", " ", "parent", " ", "class", " ", "IMAP", "4", ".", "\\", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "IMAP", "4", "\\u", "stream_", "(_", "IMAP", "4_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "command_", ",_", "debug_", "=_", "None_", ",_", "debug", "\\u", "file_", "=_", "None_", ",_", "identifier_", "=_", "None_", ",_", "timeout_", "=_", "None_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "command_", "=_", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "host_", "=_", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "port_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "file_", ",_", "self_", "._", "readf", "ile_", "=_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "read", "\\u", "fd_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IMAP", "4_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "None_", ",_", "None_", ",_", "debug_", ",_", "debug", "\\u", "file_", ",_", "identifier_", ",_", "timeout_", ",_", "debug", "\\u", "buf", "\\u", "lvl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4", "\\u", "stream_", "(_", "IMAP", "4_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open_", "(_", "self_", ",_", "host_", "=_", "None_", ",_", "port_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "open", "(", "host", "=", "Non", "e", ",", " ", "port", "=", "Non", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "Set", "up", " ", "a", " ", "stream", " ", "connecti", "on", " ", "via", " ", "'", "self", ".", "command", "'.", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "connecti", "on", " ", "will", " ", "be", " ", "used", " ", "by", " ", "the", " ", "routin", "es", ":", "\\", "10", ";", " ", " ", " ", " ", "read", ",", " ", "send", ",", " ", "shut", "down", ",", " ", "socket", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "subprocess_", "import_", "Popen_", ",_", "PIPE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "DEF", "AUL", "T", "\\u", "BUFF", "ER", "\\u", "SIZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "\\u", "log_", "(_", "0_", ",_", "'", "opening", " ", "stream", " ", "from", " ", "command", " ", "\"%", "s", "\"'_", "%_", "self_", "._", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "P_", "=_", "Popen_", "(_", "self_", "._", "command_", ",_", "shell_", "=_", "True_", ",_", "stdin_", "=_", "PIPE_", ",_", "stdout_", "=_", "PIPE_", ",_", "close", "\\u", "fds_", "=_", "True_", ",_", "bufsize_", "=_", "DEF", "AUL", "T", "\\u", "BUFF", "ER", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "file_", ",_", "self_", "._", "readf", "ile_", "=_", "self_", "._", "\\u", "P_", "._", "stdin_", ",_", "self_", "._", "\\u", "P_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "read", "\\u", "fd_", "=_", "self_", "._", "readf", "ile_", "._", "fileno_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4", "\\u", "stream_", "(_", "IMAP", "4_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", " ", "'", "size", "'", " ", "bytes", " ", "from", " ", "remote", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "decompress", "or_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "read_", "(_", "self_", "._", "read", "\\u", "fd_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "decompress", "or_", "._", "uncon", "sum", "ed", "\\u", "tail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "decompress", "or_", "._", "uncon", "sum", "ed", "\\u", "tail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "os_", "._", "read_", "(_", "self_", "._", "read", "\\u", "fd_", ",_", "READ", "\\u", "SIZE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "decompress", "or_", "._", "decompress_", "(_", "data_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4", "\\u", "stream_", "(_", "IMAP", "4_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sen", "d", " ", "data", " ", "to", " ", "remote", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "compressor", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "compressor", "_", "._", "compress_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "+=_", "self_", "._", "compressor", "_", "._", "flush_", "(_", "zlib_", "._", "Z", "\\u", "SYNC", "\\u", "FLU", "SH_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "write", "file_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "file_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "IMAP", "4", "\\u", "stream_", "(_", "IMAP", "4_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shutdown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Clos", "e", " ", "I", "/", "O", " ", "establish", "ed", " ", "in", " ", "\"", "open", "\".", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "readf", "ile_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "P_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Authenticator", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Priva", "te", " ", "class", " ", "to", " ", "provide", " ", "en", "/", "de", "-", "codi", "ng", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "base64", " ", "authenticat", "ion", " ", "conversation", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Authenticator", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "mech", "inst_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mech", "_", "=_", "mech", "inst_", "#", " ", "Call", "able", " ", "object", " ", "to", " ", "provide", "/", "process", " ", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Authenticator", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process_", "(_", "self_", ",_", "data_", ",_", "rq", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "self_", "._", "mech", "_", "(_", "self_", "._", "decode_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "b", "'*'_", "#", " ", "Abo", "rt", " ", "conversation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "encode_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Authenticator", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "encode_", "(_", "self_", ",_", "inp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Invok", "e", " ", "bin", "ascii", ".", "b2", "a", "\\u", "base64", " ", "iterative", "ly", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "short", " ", "even", " ", "length", " ", "buffer", "s", ",", " ", "strip", " ", "the", " ", "trail", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "line", " ", "feed", " ", "from", " ", "the", " ", "result", " ", "and", " ", "append", ".", " ", " ", "\"", "Even", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "means", " ", "a", " ", "number", " ", "tha", "t", " ", "factor", "s", " ", "to", " ", "bot", "h", " ", "6", " ", "and", " ", "8", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "so", " ", "whe", "n", " ", "it", " ", "gets", " ", "to", " ", "the", " ", "end", " ", "of", " ", "the", " ", "8", "-", "bit", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "there", "'", "s", " ", "no", " ", "partial", " ", "6", "-", "bit", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oup_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "inp_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inp_", "=_", "inp_", "._", "encode_", "(_", "'", "ASCII", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "inp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "inp_", ")_", ">_", "48_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "inp_", "[_", ":_", "48_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inp_", "=_", "inp_", "[_", "48_", ":_", "]_", "\\u\\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_", "=_", "inp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inp_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "e_", "=_", "binascii_", "._", "b2", "a", "\\u", "base64_", "(_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oup_", "=_", "oup_", "+_", "e_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "oup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Authenticator", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decode_", "(_", "self_", ",_", "inp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "inp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "binascii_", "._", "a2", "b", "\\u", "base64_", "(_", "inp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "Id", "le", "Cont", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Whe", "n", " ", "process", " ", "is", " ", "call", "ed", ",", " ", "server", " ", "is", " ", "in", " ", "IDLE", " ", "state", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "will", " ", "send", " ", "async", "hronous", " ", "change", "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_", "[SEP]_", "class_", "\\u", "Id", "le", "Cont", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", ",_", "timeout_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timeout_", "=_", "parent_", "._", "\\u", "choose", "\\u", "non", "ull", "\\u", "or", "\\u", "dfl", "t_", "(_", "IDLE", "\\u", "TIMEOUT_", ",_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "idle", "\\u", "timeout_", "=_", "self_", "._", "timeout_", "+_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Id", "le", "Cont", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process_", "(_", "self_", ",_", "data_", ",_", "rq", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "idle", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "idle", "\\u", "rq", "b_", "=_", "rq", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "idle", "\\u", "timeout_", "=_", "self_", "._", "timeout_", "+_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "idle", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "self_", "._", "parent_", "._", "\\u", "log_", "(_", "2_", ",_", "'", "server", " ", "IDLE", " ", "start", "ed", ",", " ", "timeo", "ut", " ", "in", " ", "%", ".2", "f", " ", "secs", "'_", "%_", "self_", "._", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Intern", "ald", "ate", "2", "Time_", "(_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "time", "\\u", "tuple", " ", "=", " ", "Intern", "ald", "ate", "2", "Time", "(", "resp", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "an", " ", "IMAP", "4", " ", "INTERN", "AL", "DAT", "E", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "correspond", "ing", " ", "local", " ", "time", ".", " ", " ", "The", " ", "return", " ", "value", " ", "is", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "time", ".", "struct", "\\u", "time", " ", "instance", " ", "or", " ", "Non", "e", " ", "if", " ", "the", " ", "string", " ", "has", " ", "wrong", " ", "format", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mo_", "=_", "Intern", "al", "Date_", "._", "match_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "mo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mon_", "=_", "Mon", "2n", "um_", "[_", "mo_", "._", "group_", "(_", "'", "mon", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "n_", "=_", "mo_", "._", "group_", "(_", "'", "zone", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "day_", "=_", "int_", "(_", "mo_", "._", "group_", "(_", "'", "day", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "year_", "=_", "int_", "(_", "mo_", "._", "group_", "(_", "'", "year", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hour_", "=_", "int_", "(_", "mo_", "._", "group_", "(_", "'", "hour", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min_", "=_", "int_", "(_", "mo_", "._", "group_", "(_", "'", "min", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sec_", "=_", "int_", "(_", "mo_", "._", "group_", "(_", "'", "sec", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "h_", "=_", "int_", "(_", "mo_", "._", "group_", "(_", "'", "zone", "h", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zone", "m_", "=_", "int_", "(_", "mo_", "._", "group_", "(_", "'", "zone", "m", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INTERN", "AL", "DAT", "E", " ", "timezon", "e", " ", "must", " ", "be", " ", "subtract", "ed", " ", "to", " ", "get", " ", "UT_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zone_", "=_", "(_", "zone", "h_", "*_", "60_", "+_", "zone", "m_", ")_", "*_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "zone", "n_", "==_", "b", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zone_", "=_", "-_", "zone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tt_", "=_", "(_", "year_", ",_", "mon_", ",_", "day_", ",_", "hour_", ",_", "min_", ",_", "sec_", ",_", "-_", "1_", ",_", "-_", "1_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "time_", "._", "localtime_", "(_", "calendar_", "._", "time", "gm_", "(_", "tt_", ")_", "-_", "zone_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Time", "2", "Intern", "ald", "ate_", "(_", "date", "\\u", "time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"'", "\"", "DD", "-", "Mm", "m", "-", "YYY", "Y", " ", "HH", ":", "MM", ":", "SS", " ", "+", "HH", "MM", "\"'", " ", "=", " ", "Time", "2", "Intern", "ald", "ate", "(", "date", "\\u", "time", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Convert", " ", "'", "date", "\\u", "time", "'", " ", "to", " ", "IMAP", "4", " ", "INTERN", "AL", "DAT", "E", " ", "represent", "ation", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "date", "\\u", "time", " ", "argu", "ment", " ", "can", " ", "be", " ", "a", " ", "number", " ", "(", "int", " ", "or", " ", "float", ")", " ", "represent", "ing", "\\", "10", ";", " ", " ", " ", " ", "second", "s", " ", "sinc", "e", " ", "epoch", " ", "(", "as", " ", "return", "ed", " ", "by", " ", "time", ".", "time", "())", ",", " ", "a", " ", "9", "-", "tuple", "\\", "10", ";", " ", " ", " ", " ", "represent", "ing", " ", "local", " ", "time", ",", " ", "an", " ", "instance", " ", "of", " ", "time", ".", "struct", "\\u", "time", " ", "(", "as", "\\", "10", ";", " ", " ", " ", " ", "return", "ed", " ", "by", " ", "time", ".", "localt", "ime", "())", ",", " ", "an", " ", "awa", "re", " ", "datetime", " ", "instance", " ", "or", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "double", "-", "quoted", " ", "string", ".", " ", " ", "In", " ", "the", " ", "last", " ", "case", ",", " ", "it", " ", "is", " ", "assume", "d", " ", "to", " ", "alr", "ead", "y", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "in", " ", "the", " ", "correct", " ", "format", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timezone_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "date", "\\u", "time_", ",_", "(_", "int_", ",_", "float_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tt_", "=_", "time_", "._", "localtime_", "(_", "date", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "date", "\\u", "time_", ",_", "tuple_", ")_", ":_", "\\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 ", " _", "gmt", "off_", "=_", "date", "\\u", "time_", "._", "tm", "\\u", "gmt", "off_", "\\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 ", " _", "if_", "time_", "._", "day", "light_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dst_", "=_", "date", "\\u", "time_", "[_", "8_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dst_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dst_", "=_", "time_", "._", "localtime_", "(_", "time_", "._", "mktime_", "(_", "date", "\\u", "time_", ")_", ")_", "[_", "8_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gmt", "off_", "=_", "-_", "(_", "time_", "._", "timezone_", ",_", "time_", "._", "alt", "zone_", ")_", "[_", "dst_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gmt", "off_", "=_", "-_", "time_", "._", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delta_", "=_", "timedelta_", "(_", "seconds_", "=_", "gmt", "off_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt_", "=_", "datetime_", "(_", "*_", "date", "\\u", "time_", "[_", ":_", "6_", "]_", ",_", "tzinfo_", "=_", "timezone_", "(_", "delta_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "date", "\\u", "time_", ",_", "datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "date", "\\u", "time_", "._", "tzinfo_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "date", "\\u", "time", " ", "must", " ", "be", " ", "awa", "re", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dt_", "=_", "date", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "date", "\\u", "time_", ",_", "str_", ")_", "and_", "(_", "date", "\\u", "time_", "[_", "0_", "]_", ",_", "date", "\\u", "time_", "[_", "-_", "1_", "]_", ")_", "==_", "(_", "'\"'_", ",_", "'\"'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "date", "\\u", "time_", "#", " ", "Assume", " ", "in", " ", "correct", " ", "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 ", " _", "raise_", "Value", "Error_", "(_", "\"", "date", "\\u", "time", " ", "not", " ", "of", " ", "a", " ", "know", "n", " ", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fmt_", "=_", "'\"", "%", "d", "-{}", "-%", "Y", " ", "%", "H", ":", "%", "M", ":", "%", "S", " ", "%", "z", "\"'_", "._", "format_", "(_", "Mont", "h", "Names_", "[_", "dt_", "._", "month_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dt_", "._", "strftime_", "(_", "fmt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Pars", "e", "Flags_", "(_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"(", "'", "flag", "',", " ", "...)", " ", "=", " ", "Pars", "e", "Fla", "gs", "(", "line", ")", "\\", "10", ";", " ", " ", " ", " ", "Convert", " ", "IMAP", "4", " ", "flags", " ", "response", " ", "to", " ", "python", " ", "tuple", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mo_", "=_", "FLAG", "S", "\\u", "cre", "_", "._", "match_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "mo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tuple_", "(_", "mo_", "._", "group_", "(_", "'", "flags", "'_", ")_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "responder", "_", "(_", "cb", "\\u", "arg", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", ",_", "cb", "\\u", "arg_", ",_", "error_", "=_", "cb", "\\u", "arg", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "Async", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", ",_", "args_", "=_", "cb", "\\u", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Async", "Error_", "=_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "log_", "(_", "0_", ",_", "'[", "cb", "]", " ", "ERROR", " ", "%", "s", " ", "%", ".1", "00", "s", " ", "=>", " ", "%", "s", "'_", "%_", "(_", "cmd_", ",_", "args_", ",_", "error_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "typ_", ",_", "dat_", "=_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "log_", "(_", "0_", ",_", "'[", "cb", "]", " ", "%", "s", " ", "%", ".1", "00", "s", " ", "=>", " ", "%", "s", " ", "%", ".1", "00", "s", "'_", "%_", "(_", "cmd_", ",_", "args_", ",_", "typ_", ",_", "dat_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "typ_", "==_", "'", "NO", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Async", "Error_", "=_", "(_", "Exception_", ",_", "dat_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "cmd_", ",_", "args_", ",_", "cb_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "Async", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "Async", "Error", " ", "%", "s", "'_", "%_", "repr_", "(_", "Async", "Error_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "logout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "typ_", ",_", "val_", "=_", "Async", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "typ_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "M_", "._", "debug_", ":_", "M_", "._", "\\u", "log_", "(_", "0_", ",_", "'%", "s", " ", "%", ".1", "00", "s", "'_", "%_", "(_", "cmd_", ",_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "dat_", "=_", "getattr_", "(_", "M_", ",_", "cmd_", ")_", "(_", "callback_", "=_", "responder", "_", ",_", "cb", "\\u", "arg_", "=_", "(_", "cmd_", ",_", "args_", ")_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "log_", "(_", "1_", ",_", "'%", "s", " ", "%", ".1", "00", "s", " ", "=>", " ", "%", "s", " ", "%", ".1", "00", "s", "'_", "%_", "(_", "cmd_", ",_", "args_", ",_", "typ_", ",_", "dat_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "typ_", ",_", "dat_", "=_", "getattr_", "(_", "M_", ",_", "cmd_", ")_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "\\u", "log_", "(_", "1_", ",_", "'%", "s", " ", "%", ".1", "00", "s", " ", "=>", " ", "%", "s", " ", "%", ".1", "00", "s", "'_", "%_", "(_", "cmd_", ",_", "args_", ",_", "typ_", ",_", "dat_", ")_", ")_", "\\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 ", " _", "M_", "._", "\\u", "log_", "(_", "1_", ",_", "'%", "s", " ", "-", " ", "%", "s", "'_", "%_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", ":_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "logout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "typ_", "==_", "'", "NO", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "M_", "._", "\\u", "log_", "(_", "1_", ",_", "'", "NO", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "M_", "._", "logout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "dat_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dat_", "\\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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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 ]
Except block handles 'BaseException'
QuantSoftware/QuantSoftwareToolkit/QSTK/qstkutil/qsdateutil.py
[ { "content": "def _cache_dates():\n ''' Caches dates '''\n try:\n # filename = os.environ['QS'] + \"/qstkutil/NYSE_dates.txt\"\n filename = os.path.join(os.path.dirname(__file__), 'NYSE_dates.txt')\n except KeyError:\n print \"Please be sure you have NYSE_dates.txt in the qstkutil directory\"\n\n datestxt = np.loadtxt(filename, dtype=str)\n dates = []\n for i in datestxt:\n dates.append(dt.datetime.strptime(i, \"%m/%d/%Y\"))\n return pd.TimeSeries(index=dates, data=dates)", "metadata": "root._cache_dates", "header": "['module', '___EOS___']", "index": 23 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "cache", "\\u", "dates_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Cache", "s", " ", "dates", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "filename", " ", "=", " ", "os", ".", "environ", "['", "QS", "']", " ", "+", " ", "\"/", "qst", "ku", "til", "/", "NY", "SE", "\\u", "dates", ".", "txt", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "NY", "SE", "\\u", "dates", ".", "txt", "'_", ")_", "\\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 ", " _", "print_", "\"", "Ple", "ase", " ", "be", " ", "sure", " ", "you", " ", "have", " ", "NY", "SE", "\\u", "dates", ".", "txt", " ", "in", " ", "the", " ", "qst", "ku", "til", " ", "director", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dates", "txt_", "=_", "np_", "._", "loadtxt_", "(_", "filename_", ",_", "dtype_", "=_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dates_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "dates", "txt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dates_", "._", "append_", "(_", "dt_", "._", "datetime_", "._", "strptime_", "(_", "i_", ",_", "\"%", "m", "/", "%", "d", "/", "%", "Y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pd_", "._", "Time", "Series_", "(_", "index_", "=_", "dates_", ",_", "data_", "=_", "dates_", ")_", "\\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 ]
Unused import
adieu/allbuttonspressed/urls.py
[ { "content": "from django.conf import settings\nfrom django.conf.urls.defaults import *\nfrom blog.models import PostsSitemap\nfrom minicms.models import PagesSitemap\n\nhandler500 = 'djangotoolbox.errorviews.server_error'\n\nsitemaps = {\n 'posts': PostsSitemap,\n 'pages': PagesSitemap,\n}\n\nurlpatterns = patterns('',\n (r'^admin/', include('urlsadmin')),\n (r'^blog/', include('blog.urls')),\n (r'^sitemap\\.xml$', 'django.contrib.sitemaps.views.sitemap',\n {'sitemaps': sitemaps}),\n (r'^search$', 'google_cse.views.search'),\n (r'^robots\\.txt$', 'robots.views.robots'),\n)\n\nif 'djangoappengine' in settings.INSTALLED_APPS:\n urlpatterns = patterns('',\n ('^_ah/warmup$', 'djangoappengine.views.warmup'),\n ) + urlpatterns\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_", "._", "defaults_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blog_", "._", "models_", "import_", "Posts", "Site", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mini", "cms_", "._", "models_", "import_", "Page", "s", "Site", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handler", "500_", "=_", "'", "django", "toolb", "ox", ".", "error", "views", ".", "server", "\\u", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sitemap", "s_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "posts", "'_", ":_", "Posts", "Site", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "page", "s", "'_", ":_", "Page", "s", "Site", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urlpatterns_", "=_", "patterns_", "(_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'", "^", "admin", "/'_", ",_", "include_", "(_", "'", "urls", "admin", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'", "^", "blog", "/'_", ",_", "include_", "(_", "'", "blog", ".", "urls", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'", "^", "sitemap", "\\\\.", "xml", "$'_", ",_", "'", "django", ".", "contrib", ".", "sitemap", "s", ".", "views", ".", "sitemap", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "sitemap", "s", "'_", ":_", "sitemap", "s_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'", "^", "search", "$'_", ",_", "'", "google", "\\u", "cse", ".", "views", ".", "search", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'", "^", "robots", "\\\\.", "txt", "$'_", ",_", "'", "robots", ".", "views", ".", "robots", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "django", "appengine", "'_", "in_", "settings_", "._", "INSTALLE", "D", "\\u", "APPS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urlpatterns_", "=_", "patterns_", "(_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "^", "\\u", "ah", "/", "warmup", "$'_", ",_", "'", "django", "appengine", ".", "views", ".", "warmup", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "+_", "urlpatterns_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
matrix-org/synapse/synapse/push/baserules.py
[ { "content": "# Copyright 2015, 2016 OpenMarket Ltd\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 synapse.push.rulekinds import PRIORITY_CLASS_MAP, PRIORITY_CLASS_INVERSE_MAP\nimport copy\n\n\n\n\n\n\n\n\nBASE_APPEND_CONTENT_RULES = [\n {\n 'rule_id': 'global/content/.m.rule.contains_user_name',\n 'conditions': [\n {\n 'kind': 'event_match',\n 'key': 'content.body',\n 'pattern_type': 'user_localpart'\n }\n ],\n 'actions': [\n 'notify',\n {\n 'set_tweak': 'sound',\n 'value': 'default',\n }, {\n 'set_tweak': 'highlight'\n }\n ]\n },\n]\n\n\nBASE_PREPEND_OVERRIDE_RULES = [\n {\n 'rule_id': 'global/override/.m.rule.master',\n 'enabled': False,\n 'conditions': [],\n 'actions': [\n \"dont_notify\"\n ]\n }\n]\n\n\nBASE_APPEND_OVRRIDE_RULES = [\n {\n 'rule_id': 'global/override/.m.rule.suppress_notices',\n 'conditions': [\n {\n 'kind': 'event_match',\n 'key': 'content.msgtype',\n 'pattern': 'm.notice',\n '_id': '_suppress_notices',\n }\n ],\n 'actions': [\n 'dont_notify',\n ]\n }\n]\n\n\nBASE_APPEND_UNDERRIDE_RULES = [\n {\n 'rule_id': 'global/underride/.m.rule.call',\n 'conditions': [\n {\n 'kind': 'event_match',\n 'key': 'type',\n 'pattern': 'm.call.invite',\n '_id': '_call',\n }\n ],\n 'actions': [\n 'notify',\n {\n 'set_tweak': 'sound',\n 'value': 'ring'\n }, {\n 'set_tweak': 'highlight',\n 'value': False\n }\n ]\n },\n {\n 'rule_id': 'global/underride/.m.rule.contains_display_name',\n 'conditions': [\n {\n 'kind': 'contains_display_name'\n }\n ],\n 'actions': [\n 'notify',\n {\n 'set_tweak': 'sound',\n 'value': 'default'\n }, {\n 'set_tweak': 'highlight'\n }\n ]\n },\n {\n 'rule_id': 'global/underride/.m.rule.room_one_to_one',\n 'conditions': [\n {\n 'kind': 'room_member_count',\n 'is': '2',\n '_id': 'member_count',\n },\n {\n 'kind': 'event_match',\n 'key': 'type',\n 'pattern': 'm.room.message',\n '_id': '_message',\n }\n ],\n 'actions': [\n 'notify',\n {\n 'set_tweak': 'sound',\n 'value': 'default'\n }, {\n 'set_tweak': 'highlight',\n 'value': False\n }\n ]\n },\n {\n 'rule_id': 'global/underride/.m.rule.invite_for_me',\n 'conditions': [\n {\n 'kind': 'event_match',\n 'key': 'type',\n 'pattern': 'm.room.member',\n '_id': '_member',\n },\n {\n 'kind': 'event_match',\n 'key': 'content.membership',\n 'pattern': 'invite',\n '_id': '_invite_member',\n },\n {\n 'kind': 'event_match',\n 'key': 'state_key',\n 'pattern_type': 'user_id'\n },\n ],\n 'actions': [\n 'notify',\n {\n 'set_tweak': 'sound',\n 'value': 'default'\n }, {\n 'set_tweak': 'highlight',\n 'value': False\n }\n ]\n },\n # This is too simple: https://matrix.org/jira/browse/SYN-607\n # Removing for now\n # {\n # 'rule_id': 'global/underride/.m.rule.member_event',\n # 'conditions': [\n # {\n # 'kind': 'event_match',\n # 'key': 'type',\n # 'pattern': 'm.room.member',\n # '_id': '_member',\n # }\n # ],\n # 'actions': [\n # 'notify', {\n # 'set_tweak': 'highlight',\n # 'value': False\n # }\n # ]\n # },\n {\n 'rule_id': 'global/underride/.m.rule.message',\n 'conditions': [\n {\n 'kind': 'event_match',\n 'key': 'type',\n 'pattern': 'm.room.message',\n '_id': '_message',\n }\n ],\n 'actions': [\n 'notify', {\n 'set_tweak': 'highlight',\n 'value': False\n }\n ]\n }\n]\n\n\nBASE_RULE_IDS = set()\n\nfor r in BASE_APPEND_CONTENT_RULES:\n r['priority_class'] = PRIORITY_CLASS_MAP['content']\n r['default'] = True\n BASE_RULE_IDS.add(r['rule_id'])\n\nfor r in BASE_PREPEND_OVERRIDE_RULES:\n r['priority_class'] = PRIORITY_CLASS_MAP['override']\n r['default'] = True\n BASE_RULE_IDS.add(r['rule_id'])\n\nfor r in BASE_APPEND_OVRRIDE_RULES:\n r['priority_class'] = PRIORITY_CLASS_MAP['override']\n r['default'] = True\n BASE_RULE_IDS.add(r['rule_id'])\n\nfor r in BASE_APPEND_UNDERRIDE_RULES:\n r['priority_class'] = PRIORITY_CLASS_MAP['underride']\n r['default'] = True\n BASE_RULE_IDS.add(r['rule_id'])\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def list_with_base_rules(rawrules):\n \"\"\"Combine the list of rules set by the user with the default push rules\n\n :param list rawrules: The rules the user has modified or set.\n :returns: A new list with the rules set by the user combined with the\n defaults.\n \"\"\"\n ruleslist = []\n\n # Grab the base rules that the user has modified.\n # The modified base rules have a priority_class of -1.\n modified_base_rules = {\n r['rule_id']: r for r in rawrules if r['priority_class'] < 0\n }\n\n # Remove the modified base rules from the list, They'll be added back\n # in the default postions in the list.\n rawrules = [r for r in rawrules if r['priority_class'] >= 0]\n\n # shove the server default rules for each kind onto the end of each\n current_prio_class = PRIORITY_CLASS_INVERSE_MAP.keys()[-1]\n\n ruleslist.extend(make_base_prepend_rules(\n PRIORITY_CLASS_INVERSE_MAP[current_prio_class], modified_base_rules\n ))\n\n for r in rawrules:\n if r['priority_class'] < current_prio_class:\n while r['priority_class'] < current_prio_class:\n ruleslist.extend(make_base_append_rules(\n PRIORITY_CLASS_INVERSE_MAP[current_prio_class],\n modified_base_rules,\n ))\n current_prio_class -= 1\n if current_prio_class > 0:\n ruleslist.extend(make_base_prepend_rules(\n PRIORITY_CLASS_INVERSE_MAP[current_prio_class],\n modified_base_rules,\n ))\n\n ruleslist.append(r)\n\n while current_prio_class > 0:\n ruleslist.extend(make_base_append_rules(\n PRIORITY_CLASS_INVERSE_MAP[current_prio_class],\n modified_base_rules,\n ))\n current_prio_class -= 1\n if current_prio_class > 0:\n ruleslist.extend(make_base_prepend_rules(\n PRIORITY_CLASS_INVERSE_MAP[current_prio_class],\n modified_base_rules,\n ))\n\n return ruleslist", "metadata": "root.list_with_base_rules", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def make_base_append_rules(kind, modified_base_rules):\n rules = []\n\n if kind == 'override':\n rules = BASE_APPEND_OVRRIDE_RULES\n elif kind == 'underride':\n rules = BASE_APPEND_UNDERRIDE_RULES\n elif kind == 'content':\n rules = BASE_APPEND_CONTENT_RULES\n\n # Copy the rules before modifying them\n rules = copy.deepcopy(rules)\n for r in rules:\n # Only modify the actions, keep the conditions the same.\n modified = modified_base_rules.get(r['rule_id'])\n if modified:\n r['actions'] = modified['actions']\n\n return rules", "metadata": "root.make_base_append_rules", "header": "['module', '___EOS___']", "index": 75 }, { "content": "def make_base_prepend_rules(kind, modified_base_rules):\n rules = []\n\n if kind == 'override':\n rules = BASE_PREPEND_OVERRIDE_RULES\n\n # Copy the rules before modifying them\n rules = copy.deepcopy(rules)\n for r in rules:\n # Only modify the actions, keep the conditions the same.\n modified = modified_base_rules.get(r['rule_id'])\n if modified:\n r['actions'] = modified['actions']\n\n return rules", "metadata": "root.make_base_prepend_rules", "header": "['module', '___EOS___']", "index": 96 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", ",", " ", "2016", " ", "Open", "Market", " ", "Lt", "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_", "synapse_", "._", "push_", "._", "rule", "kinds", "_", "import_", "PRIORITY", "\\u", "CLASS", "\\u", "MAP_", ",_", "PRIORITY", "\\u", "CLASS", "\\u", "INVE", "RSE", "\\u", "MAP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "BASE", "\\u", "APPEN", "D", "\\u", "CONTE", "NT", "\\u", "RULES", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rule", "\\u", "id", "'_", ":_", "'", "global", "/", "content", "/.", "m", ".", "rule", ".", "contain", "s", "\\u", "user", "\\u", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "condition", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "event", "\\u", "match", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "'", "content", ".", "body", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pattern", "\\u", "type", "'_", ":_", "'", "user", "\\u", "localpa", "rt", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "notif", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "tweak", "'_", ":_", "'", "sound", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "'", "default", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "tweak", "'_", ":_", "'", "highlight", "'_", "\\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_", "BASE", "\\u", "PREP", "END", "\\u", "OVERRIDE", "\\u", "RULES", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rule", "\\u", "id", "'_", ":_", "'", "global", "/", "override", "/.", "m", ".", "rule", ".", "master", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "enable", "d", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "condition", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "don", "t", "\\u", "notif", "y", "\"_", "\\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_", "BASE", "\\u", "APPEN", "D", "\\u", "OV", "RR", "IDE", "\\u", "RULES", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rule", "\\u", "id", "'_", ":_", "'", "global", "/", "override", "/.", "m", ".", "rule", ".", "suppress", "\\u", "notice", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "condition", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "event", "\\u", "match", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "'", "content", ".", "msgt", "ype", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pattern", "'_", ":_", "'", "m", ".", "notice", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "id", "'_", ":_", "'\\u", "suppress", "\\u", "notice", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "don", "t", "\\u", "notif", "y", "'_", ",_", "\\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_", "BASE", "\\u", "APPEN", "D", "\\u", "UNDER", "RID", "E", "\\u", "RULES", "_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rule", "\\u", "id", "'_", ":_", "'", "global", "/", "under", "ride", "/.", "m", ".", "rule", ".", "call", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "condition", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "event", "\\u", "match", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "'", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pattern", "'_", ":_", "'", "m", ".", "call", ".", "invite", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "id", "'_", ":_", "'\\u", "call", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "notif", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "tweak", "'_", ":_", "'", "sound", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "'", "ring", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "tweak", "'_", ":_", "'", "highlight", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "False_", "\\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_", "'", "rule", "\\u", "id", "'_", ":_", "'", "global", "/", "under", "ride", "/.", "m", ".", "rule", ".", "contain", "s", "\\u", "display", "\\u", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "condition", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "contain", "s", "\\u", "display", "\\u", "name", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "notif", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "tweak", "'_", ":_", "'", "sound", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "'", "default", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "tweak", "'_", ":_", "'", "highlight", "'_", "\\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_", "'", "rule", "\\u", "id", "'_", ":_", "'", "global", "/", "under", "ride", "/.", "m", ".", "rule", ".", "room", "\\u", "one", "\\u", "to", "\\u", "one", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "condition", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "room", "\\u", "member", "\\u", "count", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "'_", ":_", "'", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "id", "'_", ":_", "'", "member", "\\u", "count", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "event", "\\u", "match", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "'", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pattern", "'_", ":_", "'", "m", ".", "room", ".", "message", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "id", "'_", ":_", "'\\u", "message", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "notif", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "tweak", "'_", ":_", "'", "sound", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "'", "default", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "tweak", "'_", ":_", "'", "highlight", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "False_", "\\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_", "'", "rule", "\\u", "id", "'_", ":_", "'", "global", "/", "under", "ride", "/.", "m", ".", "rule", ".", "invite", "\\u", "for", "\\u", "me", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "condition", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "event", "\\u", "match", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "'", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pattern", "'_", ":_", "'", "m", ".", "room", ".", "member", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "id", "'_", ":_", "'\\u", "member", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "event", "\\u", "match", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "'", "content", ".", "member", "ship", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pattern", "'_", ":_", "'", "invite", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "id", "'_", ":_", "'\\u", "invite", "\\u", "member", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "event", "\\u", "match", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "'", "state", "\\u", "key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pattern", "\\u", "type", "'_", ":_", "'", "user", "\\u", "id", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "notif", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "tweak", "'_", ":_", "'", "sound", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "'", "default", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "tweak", "'_", ":_", "'", "highlight", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "False_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "too", " ", "simple", ":", " ", "https", "://", "matrix", ".", "org", "/", "jira", "/", "browse", "/", "SYN", "-", "607", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remo", "ving", " ", "for", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "rule", "\\u", "id", "':", " ", "'", "global", "/", "under", "ride", "/.", "m", ".", "rule", ".", "member", "\\u", "event", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "condition", "s", "':", " ", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "kind", "':", " ", "'", "event", "\\u", "match", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "key", "':", " ", "'", "type", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "pattern", "':", " ", "'", "m", ".", "room", ".", "member", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'\\u", "id", "':", " ", "'\\u", "member", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "}_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "],", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "action", "s", "':", " ", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "notif", "y", "',", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "set\\u", "tweak", "':", " ", "'", "highlight", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "value", "':", " ", "False_", "\\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_", "'", "rule", "\\u", "id", "'_", ":_", "'", "global", "/", "under", "ride", "/.", "m", ".", "rule", ".", "message", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "condition", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "'", "event", "\\u", "match", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "'", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pattern", "'_", ":_", "'", "m", ".", "room", ".", "message", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "id", "'_", ":_", "'\\u", "message", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "notif", "y", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "set\\u", "tweak", "'_", ":_", "'", "highlight", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "False_", "\\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_", "BASE", "\\u", "RULE", "\\u", "IDS_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "r_", "in_", "BASE", "\\u", "APPEN", "D", "\\u", "CONTE", "NT", "\\u", "RULES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "[_", "'", "priorit", "y", "\\u", "class", "'_", "]_", "=_", "PRIORITY", "\\u", "CLASS", "\\u", "MAP_", "[_", "'", "content", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "[_", "'", "default", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BASE", "\\u", "RULE", "\\u", "IDS_", "._", "add_", "(_", "r_", "[_", "'", "rule", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "r_", "in_", "BASE", "\\u", "PREP", "END", "\\u", "OVERRIDE", "\\u", "RULES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "[_", "'", "priorit", "y", "\\u", "class", "'_", "]_", "=_", "PRIORITY", "\\u", "CLASS", "\\u", "MAP_", "[_", "'", "override", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "[_", "'", "default", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BASE", "\\u", "RULE", "\\u", "IDS_", "._", "add_", "(_", "r_", "[_", "'", "rule", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "r_", "in_", "BASE", "\\u", "APPEN", "D", "\\u", "OV", "RR", "IDE", "\\u", "RULES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "[_", "'", "priorit", "y", "\\u", "class", "'_", "]_", "=_", "PRIORITY", "\\u", "CLASS", "\\u", "MAP_", "[_", "'", "override", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "[_", "'", "default", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BASE", "\\u", "RULE", "\\u", "IDS_", "._", "add_", "(_", "r_", "[_", "'", "rule", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "r_", "in_", "BASE", "\\u", "APPEN", "D", "\\u", "UNDER", "RID", "E", "\\u", "RULES", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "[_", "'", "priorit", "y", "\\u", "class", "'_", "]_", "=_", "PRIORITY", "\\u", "CLASS", "\\u", "MAP_", "[_", "'", "under", "ride", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "[_", "'", "default", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BASE", "\\u", "RULE", "\\u", "IDS_", "._", "add_", "(_", "r_", "[_", "'", "rule", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "list", "\\u", "with", "\\u", "base", "\\u", "rules_", "(_", "raw", "rules_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Combine", " ", "the", " ", "list", " ", "of", " ", "rule", "s", " ", "set", " ", "by", " ", "the", " ", "user", " ", "with", " ", "the", " ", "default", " ", "push", " ", "rule", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "list", " ", "raw", "rule", "s", ":", " ", "The", " ", "rule", "s", " ", "the", " ", "user", " ", "has", " ", "modifi", "ed", " ", "or", " ", "set", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "A", " ", "new", " ", "list", " ", "with", " ", "the", " ", "rule", "s", " ", "set", " ", "by", " ", "the", " ", "user", " ", "combin", "ed", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "default", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "slist_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "the", " ", "base", " ", "rule", "s", " ", "tha", "t", " ", "the", " ", "user", " ", "has", " ", "modifi", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "modifi", "ed", " ", "base", " ", "rule", "s", " ", "have", " ", "a", " ", "priorit", "y", "\\u", "class", " ", "of", " ", "-1", "._", "\\u\\u\\uNL\\u\\u\\u_", "modifi", "ed", "\\u", "base", "\\u", "rules_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "r_", "[_", "'", "rule", "\\u", "id", "'_", "]_", ":_", "r_", "for_", "r_", "in_", "raw", "rules_", "if_", "r_", "[_", "'", "priorit", "y", "\\u", "class", "'_", "]_", "<_", "0_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "the", " ", "modifi", "ed", " ", "base", " ", "rule", "s", " ", "from", " ", "the", " ", "list", ",", " ", "The", "y", "'", "ll", " ", "be", " ", "adde", "d", " ", "back_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "default", " ", "posti", "ons", " ", "in", " ", "the", " ", "list", "._", "\\u\\u\\uNL\\u\\u\\u_", "raw", "rules_", "=_", "[_", "r_", "for_", "r_", "in_", "raw", "rules_", "if_", "r_", "[_", "'", "priorit", "y", "\\u", "class", "'_", "]_", ">=_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sho", "ve", " ", "the", " ", "server", " ", "default", " ", "rule", "s", " ", "for", " ", "each", " ", "kind", " ", "onto", " ", "the", " ", "end", " ", "of", " ", "each_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "prio", "\\u", "class_", "=_", "PRIORITY", "\\u", "CLASS", "\\u", "INVE", "RSE", "\\u", "MAP_", "._", "keys_", "(_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rule", "slist_", "._", "extend_", "(_", "make", "\\u", "base", "\\u", "prepend", "\\u", "rules_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "PRIORITY", "\\u", "CLASS", "\\u", "INVE", "RSE", "\\u", "MAP_", "[_", "current", "\\u", "prio", "\\u", "class_", "]_", ",_", "modifi", "ed", "\\u", "base", "\\u", "rules_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "r_", "in_", "raw", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "r_", "[_", "'", "priorit", "y", "\\u", "class", "'_", "]_", "<_", "current", "\\u", "prio", "\\u", "class_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "r_", "[_", "'", "priorit", "y", "\\u", "class", "'_", "]_", "<_", "current", "\\u", "prio", "\\u", "class_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule", "slist_", "._", "extend_", "(_", "make", "\\u", "base", "\\u", "append", "\\u", "rules_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "PRIORITY", "\\u", "CLASS", "\\u", "INVE", "RSE", "\\u", "MAP_", "[_", "current", "\\u", "prio", "\\u", "class_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "modifi", "ed", "\\u", "base", "\\u", "rules_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "prio", "\\u", "class_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "prio", "\\u", "class_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rule", "slist_", "._", "extend_", "(_", "make", "\\u", "base", "\\u", "prepend", "\\u", "rules_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "PRIORITY", "\\u", "CLASS", "\\u", "INVE", "RSE", "\\u", "MAP_", "[_", "current", "\\u", "prio", "\\u", "class_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "modifi", "ed", "\\u", "base", "\\u", "rules_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rule", "slist_", "._", "append_", "(_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "current", "\\u", "prio", "\\u", "class_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule", "slist_", "._", "extend_", "(_", "make", "\\u", "base", "\\u", "append", "\\u", "rules_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "PRIORITY", "\\u", "CLASS", "\\u", "INVE", "RSE", "\\u", "MAP_", "[_", "current", "\\u", "prio", "\\u", "class_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "modifi", "ed", "\\u", "base", "\\u", "rules_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "prio", "\\u", "class_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "prio", "\\u", "class_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule", "slist_", "._", "extend_", "(_", "make", "\\u", "base", "\\u", "prepend", "\\u", "rules_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "PRIORITY", "\\u", "CLASS", "\\u", "INVE", "RSE", "\\u", "MAP_", "[_", "current", "\\u", "prio", "\\u", "class_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "modifi", "ed", "\\u", "base", "\\u", "rules_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rule", "slist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "base", "\\u", "append", "\\u", "rules_", "(_", "kind_", ",_", "modifi", "ed", "\\u", "base", "\\u", "rules_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rules_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "kind_", "==_", "'", "override", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rules_", "=_", "BASE", "\\u", "APPEN", "D", "\\u", "OV", "RR", "IDE", "\\u", "RULES", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "kind_", "==_", "'", "under", "ride", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rules_", "=_", "BASE", "\\u", "APPEN", "D", "\\u", "UNDER", "RID", "E", "\\u", "RULES", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "kind_", "==_", "'", "content", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rules_", "=_", "BASE", "\\u", "APPEN", "D", "\\u", "CONTE", "NT", "\\u", "RULES", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "the", " ", "rule", "s", " ", "bef", "ore", " ", "modif", "ying", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rules_", "=_", "copy_", "._", "deepcopy_", "(_", "rules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "modif", "y", " ", "the", " ", "action", "s", ",", " ", "keep", " ", "the", " ", "condition", "s", " ", "the", " ", "same", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modified_", "=_", "modifi", "ed", "\\u", "base", "\\u", "rules_", "._", "get_", "(_", "r_", "[_", "'", "rule", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "modified_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "[_", "'", "action", "s", "'_", "]_", "=_", "modified_", "[_", "'", "action", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "base", "\\u", "prepend", "\\u", "rules_", "(_", "kind_", ",_", "modifi", "ed", "\\u", "base", "\\u", "rules_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rules_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "kind_", "==_", "'", "override", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rules_", "=_", "BASE", "\\u", "PREP", "END", "\\u", "OVERRIDE", "\\u", "RULES", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", " ", "the", " ", "rule", "s", " ", "bef", "ore", " ", "modif", "ying", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rules_", "=_", "copy_", "._", "deepcopy_", "(_", "rules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "r_", "in_", "rules_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "modif", "y", " ", "the", " ", "action", "s", ",", " ", "keep", " ", "the", " ", "condition", "s", " ", "the", " ", "same", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modified_", "=_", "modifi", "ed", "\\u", "base", "\\u", "rules_", "._", "get_", "(_", "r_", "[_", "'", "rule", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "modified_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "[_", "'", "action", "s", "'_", "]_", "=_", "modified_", "[_", "'", "action", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rules_", "\\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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
openstack/horizon/openstack_dashboard/test/api_tests/base_tests.py
[ { "content": "# Copyright 2012 United States Government as represented by the\n# Administrator of the National Aeronautics and Space Administration.\n# All Rights Reserved.\n#\n# Copyright 2012 Nebula, Inc.\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 __future__ import absolute_import\n\nfrom django.conf import settings\n\nfrom horizon import exceptions\n\nfrom openstack_dashboard.api import base as api_base\nfrom openstack_dashboard.api import cinder\nfrom openstack_dashboard.api import glance\nfrom openstack_dashboard.api import keystone\nfrom openstack_dashboard.test import helpers as test\n\n\n\n\n\n\n# Wrapper classes that only define _attrs don't need extra testing.\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class APIResource(api_base.APIResourceWrapper):\n \"\"\"Simple APIResource for testing.\"\"\"\n _attrs = ['foo', 'bar', 'baz']\n", "metadata": "root.APIResource", "header": "['module', '___EOS___']", "index": 31 }, { "content": " @staticmethod\n def get_instance(innerObject=None):\n if innerObject is None:\n\n class InnerAPIResource(object):\n pass\n\n innerObject = InnerAPIResource()\n innerObject.foo = 'foo'\n innerObject.bar = 'bar'\n return APIResource(innerObject)", "metadata": "root.APIResource.get_instance", "header": "['class', 'APIResource', '(', 'api_base', '.', 'APIResourceWrapper', ')', ':', '___EOS___']", "index": 35 }, { "content": "class APIDict(api_base.APIDictWrapper):\n \"\"\"Simple APIDict for testing.\"\"\"\n _attrs = ['foo', 'bar', 'baz']\n", "metadata": "root.APIDict", "header": "['module', '___EOS___']", "index": 48 }, { "content": " @staticmethod\n def get_instance(innerDict=None):\n if innerDict is None:\n innerDict = {'foo': 'foo',\n 'bar': 'bar'}\n return APIDict(innerDict)", "metadata": "root.APIDict.get_instance", "header": "['class', 'APIDict', '(', 'api_base', '.', 'APIDictWrapper', ')', ':', '___EOS___']", "index": 52 }, { "content": "class APIResourceWrapperTests(test.TestCase):\n\n\n", "metadata": "root.APIResourceWrapperTests", "header": "['module', '___EOS___']", "index": 61 }, { "content": " def test_get_attribute(self):\n resource = APIResource.get_instance()\n self.assertEqual('foo', resource.foo)", "metadata": "root.APIResourceWrapperTests.test_get_attribute", "header": "['class', 'APIResourceWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def test_get_invalid_attribute(self):\n resource = APIResource.get_instance()\n self.assertNotIn(\n 'missing', resource._attrs,\n msg=\"Test assumption broken. Find new missing attribute\")\n with self.assertRaises(AttributeError):\n resource.missing", "metadata": "root.APIResourceWrapperTests.test_get_invalid_attribute", "header": "['class', 'APIResourceWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 66 }, { "content": " def test_get_inner_missing_attribute(self):\n resource = APIResource.get_instance()\n with self.assertRaises(AttributeError):\n resource.baz", "metadata": "root.APIResourceWrapperTests.test_get_inner_missing_attribute", "header": "['class', 'APIResourceWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 74 }, { "content": " def test_repr(self):\n resource = APIResource.get_instance()\n resource_str = resource.__repr__()\n self.assertIn('foo', resource_str)\n self.assertIn('bar', resource_str)\n self.assertNotIn('baz', resource_str)", "metadata": "root.APIResourceWrapperTests.test_repr", "header": "['class', 'APIResourceWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": "class APIDictWrapperTests(test.TestCase):\n # APIDict allows for both attribute access and dictionary style [element]\n # style access. Test both\n\n\n\n\n\n\n", "metadata": "root.APIDictWrapperTests", "header": "['module', '___EOS___']", "index": 87 }, { "content": " def test_get_item(self):\n resource = APIDict.get_instance()\n self.assertEqual('foo', resource.foo)\n self.assertEqual('foo', resource['foo'])", "metadata": "root.APIDictWrapperTests.test_get_item", "header": "['class', 'APIDictWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___NEWLINE___', '# APIDict allows for both attribute access and dictionary style [element]', '___NL___', '# style access. Test both', '___NL___', '___EOS___']", "index": 90 }, { "content": " def test_get_invalid_item(self):\n resource = APIDict.get_instance()\n self.assertNotIn(\n 'missing', resource._attrs,\n msg=\"Test assumption broken. Find new missing attribute\")\n with self.assertRaises(AttributeError):\n resource.missing\n with self.assertRaises(KeyError):\n resource['missing']", "metadata": "root.APIDictWrapperTests.test_get_invalid_item", "header": "['class', 'APIDictWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___NEWLINE___', '# APIDict allows for both attribute access and dictionary style [element]', '___NL___', '# style access. Test both', '___NL___', '___EOS___']", "index": 95 }, { "content": " def test_get_inner_missing_attribute(self):\n resource = APIDict.get_instance()\n with self.assertRaises(AttributeError):\n resource.baz\n with self.assertRaises(KeyError):\n resource['baz']", "metadata": "root.APIDictWrapperTests.test_get_inner_missing_attribute", "header": "['class', 'APIDictWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___NEWLINE___', '# APIDict allows for both attribute access and dictionary style [element]', '___NL___', '# style access. Test both', '___NL___', '___EOS___']", "index": 105 }, { "content": " def test_get_with_default(self):\n resource = APIDict.get_instance()\n\n self.assertEqual('foo', resource.get('foo'))\n\n self.assertIsNone(resource.get('baz'))\n\n self.assertEqual('retValue', resource.get('baz', 'retValue'))", "metadata": "root.APIDictWrapperTests.test_get_with_default", "header": "['class', 'APIDictWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___NEWLINE___', '# APIDict allows for both attribute access and dictionary style [element]', '___NL___', '# style access. Test both', '___NL___', '___EOS___']", "index": 112 }, { "content": " def test_get_with_non_str(self):\n resource = APIDict.get_instance()\n self.assertNotIn(0, resource._attrs,\n msg=\"Test assumption broken. \"\n \"Find new missing attribute.\")\n self.assertIsNone(resource.get(0))\n self.assertEqual('retValue', resource.get(0, 'retValue'))", "metadata": "root.APIDictWrapperTests.test_get_with_non_str", "header": "['class', 'APIDictWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___NEWLINE___', '# APIDict allows for both attribute access and dictionary style [element]', '___NL___', '# style access. Test both', '___NL___', '___EOS___']", "index": 121 }, { "content": " def test_get_item_non_str(self):\n resource = APIDict.get_instance()\n self.assertNotIn(0, resource._attrs,\n msg=\"Test assumption broken. \"\n \"Find new missing attribute.\")\n with self.assertRaises(KeyError):\n resource[0]", "metadata": "root.APIDictWrapperTests.test_get_item_non_str", "header": "['class', 'APIDictWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___NEWLINE___', '# APIDict allows for both attribute access and dictionary style [element]', '___NL___', '# style access. Test both', '___NL___', '___EOS___']", "index": 129 }, { "content": " def test_in_not_there_str(self):\n resource = APIDict.get_instance()\n self.assertNotIn('missing', resource._attrs,\n msg=\"Test assumption broken. \"\n \"Find new missing attribute.\")\n # We're primarily interested in this test NOT raising a TypeError.\n self.assertFalse('missing' in resource)", "metadata": "root.APIDictWrapperTests.test_in_not_there_str", "header": "['class', 'APIDictWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___NEWLINE___', '# APIDict allows for both attribute access and dictionary style [element]', '___NL___', '# style access. Test both', '___NL___', '___EOS___']", "index": 137 }, { "content": " def test_in_not_there_non_str(self):\n resource = APIDict.get_instance()\n self.assertNotIn(0, resource._attrs,\n msg=\"Test assumption broken. \"\n \"Find new missing attribute.\")\n # We're primarily interested in this test NOT raising a TypeError.\n self.assertFalse(0 in resource)", "metadata": "root.APIDictWrapperTests.test_in_not_there_non_str", "header": "['class', 'APIDictWrapperTests', '(', 'test', '.', 'TestCase', ')', ':', '___NEWLINE___', '# APIDict allows for both attribute access and dictionary style [element]', '___NL___', '# style access. Test both', '___NL___', '___EOS___']", "index": 145 }, { "content": "class ApiVersionTests(test.TestCase):\n\n", "metadata": "root.ApiVersionTests", "header": "['module', '___EOS___']", "index": 154 }, { "content": " def setUp(self):\n super(ApiVersionTests, self).setUp()\n self.previous_settings = settings.OPENSTACK_API_VERSIONS\n settings.OPENSTACK_API_VERSIONS = {\n \"data-processing\": 1.1,\n \"identity\": \"2.0\",\n \"volume\": 1\n }\n # Make sure cached data from other tests doesn't interfere\n cinder.VERSIONS.clear_active_cache()\n keystone.VERSIONS.clear_active_cache()\n glance.VERSIONS.clear_active_cache()", "metadata": "root.ApiVersionTests.setUp", "header": "['class', 'ApiVersionTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 155 }, { "content": " def tearDown(self):\n super(ApiVersionTests, self).tearDown()\n settings.OPENSTACK_API_VERSIONS = self.previous_settings\n # Clear out our bogus data so it doesn't interfere\n cinder.VERSIONS.clear_active_cache()\n keystone.VERSIONS.clear_active_cache()\n glance.VERSIONS.clear_active_cache()", "metadata": "root.ApiVersionTests.tearDown", "header": "['class', 'ApiVersionTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 168 }, { "content": " def test_invalid_versions(self):\n with self.assertRaises(exceptions.ConfigurationError):\n getattr(keystone.VERSIONS, 'active')\n with self.assertRaises(exceptions.ConfigurationError):\n getattr(cinder.VERSIONS, 'active')\n try:\n getattr(glance.VERSIONS, 'active')\n except exceptions.ConfigurationError:\n self.fail(\"ConfigurationError raised inappropriately.\")", "metadata": "root.ApiVersionTests.test_invalid_versions", "header": "['class', 'ApiVersionTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 176 }, { "content": "class ApiHelperTests(test.TestCase):\n \"\"\"Tests for functions that don't use one of the api objects.\"\"\"\n", "metadata": "root.ApiHelperTests", "header": "['module', '___EOS___']", "index": 187 }, { "content": " def test_url_for(self):\n url = api_base.url_for(self.request, 'image')\n self.assertEqual('http://public.glance.example.com:9292/v1', url)\n\n url = api_base.url_for(self.request, 'image', endpoint_type='adminURL')\n self.assertEqual('http://admin.glance.example.com:9292/v1', url)\n\n url = api_base.url_for(self.request, 'compute')\n self.assertEqual('http://public.nova.example.com:8774/v2', url)\n\n url = api_base.url_for(self.request, 'compute',\n endpoint_type='adminURL')\n self.assertEqual('http://admin.nova.example.com:8774/v2', url)\n\n url = api_base.url_for(self.request, 'volumev2')\n self.assertEqual('http://public.nova.example.com:8776/v2', url)\n\n url = api_base.url_for(self.request, 'volumev2',\n endpoint_type=\"internalURL\")\n self.assertEqual('http://int.nova.example.com:8776/v2', url)\n\n url = api_base.url_for(self.request, 'volumev2',\n endpoint_type='adminURL')\n self.assertEqual('http://admin.nova.example.com:8776/v2', url)\n\n self.assertNotIn('notAnApi', self.request.user.service_catalog,\n 'Select a new nonexistent service catalog key')\n with self.assertRaises(exceptions.ServiceCatalogException):\n url = api_base.url_for(self.request, 'notAnApi')\n\n self.request.user.services_region = \"RegionTwo\"\n url = api_base.url_for(self.request, 'compute')\n self.assertEqual('http://public.nova2.example.com:8774/v2', url)\n\n self.request.user.services_region = \"RegionTwo\"\n url = api_base.url_for(self.request, 'compute',\n endpoint_type='adminURL')\n self.assertEqual('http://admin.nova2.example.com:8774/v2', url)\n\n self.request.user.services_region = \"RegionTwo\"\n with self.assertRaises(exceptions.ServiceCatalogException):\n url = api_base.url_for(self.request, 'image')\n\n self.request.user.services_region = \"bogus_value\"\n url = api_base.url_for(self.request, 'identity',\n endpoint_type='adminURL')\n self.assertEqual('http://admin.keystone.example.com:35357/v2.0', url)\n\n self.request.user.services_region = \"bogus_value\"\n with self.assertRaises(exceptions.ServiceCatalogException):\n url = api_base.url_for(self.request, 'image')", "metadata": "root.ApiHelperTests.test_url_for", "header": "['class', 'ApiHelperTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 190 }, { "content": "class QuotaSetTests(test.TestCase):\n\n\n\n", "metadata": "root.QuotaSetTests", "header": "['module', '___EOS___']", "index": 243 }, { "content": " def test_quotaset_add_with_plus(self):\n quota_dict = {'foo': 1, 'bar': 10}\n other_quota_dict = {'my_test': 12}\n quota_set = api_base.QuotaSet(quota_dict)\n other_quota_set = api_base.QuotaSet(other_quota_dict)\n\n quota_set += other_quota_set\n self.assertEqual(3, len(quota_set))\n\n quota_dict.update(other_quota_dict)\n for q in quota_set:\n self.assertEqual(quota_dict[q.name], q.limit)", "metadata": "root.QuotaSetTests.test_quotaset_add_with_plus", "header": "['class', 'QuotaSetTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 245 }, { "content": " def test_quotaset_add_doesnt_override_existing_quota(self):\n quota_dict = {'foo': 1, 'bar': 10}\n quota_set = api_base.QuotaSet(quota_dict)\n other_quota_set = api_base.QuotaSet({'foo': 12})\n\n quota_set += other_quota_set\n self.assertEqual(2, len(quota_set))\n\n for q in quota_set:\n self.assertEqual(quota_dict[q.name], q.limit)", "metadata": "root.QuotaSetTests.test_quotaset_add_doesnt_override_existing_quota", "header": "['class', 'QuotaSetTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 258 }, { "content": " def test_quotaset_add_method(self):\n quota_dict = {'foo': 1, 'bar': 10}\n other_quota_dict = {'my_test': 12}\n quota_set = api_base.QuotaSet(quota_dict)\n other_quota_set = api_base.QuotaSet(other_quota_dict)\n\n quota_set.add(other_quota_set)\n self.assertEqual(3, len(quota_set))\n\n quota_dict.update(other_quota_dict)\n for q in quota_set:\n self.assertEqual(quota_dict[q.name], q.limit)", "metadata": "root.QuotaSetTests.test_quotaset_add_method", "header": "['class', 'QuotaSetTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 269 }, { "content": " def test_quotaset_add_with_wrong_type(self):\n quota_set = api_base.QuotaSet({'foo': 1, 'bar': 10})\n self.assertRaises(ValueError, quota_set.add, {'test': 7})", "metadata": "root.QuotaSetTests.test_quotaset_add_with_wrong_type", "header": "['class', 'QuotaSetTests', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 282 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "Unit", "ed", " ", "State", "s", " ", "Gov", "ern", "ment", " ", "as", " ", "represent", "ed", " ", "by", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Administra", "tor", " ", "of", " ", "the", " ", "Nat", "ional", " ", "Aer", "ona", "uti", "cs", " ", "and", " ", "Spac", "e", " ", "Administrati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "Ne", "bul", "a", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "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_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "horizon_", "import_", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "openst", "ack", "\\u", "dashboard_", "._", "api_", "import_", "base_", "as_", "api", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openst", "ack", "\\u", "dashboard_", "._", "api_", "import_", "cinder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openst", "ack", "\\u", "dashboard_", "._", "api_", "import_", "glance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openst", "ack", "\\u", "dashboard_", "._", "api_", "import_", "keystone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "openst", "ack", "\\u", "dashboard_", "._", "test_", "import_", "helpers_", "as_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wrapper", " ", "classe", "s", " ", "tha", "t", " ", "only", " ", "defin", "e", " ", "\\u", "attr", "s", " ", "don", "'", "t", " ", "need", " ", "extra", " ", "testi", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "API", "Resource_", "(_", "api", "\\u", "base_", "._", "API", "Reso", "urc", "e", "Wrapper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Simple", " ", "API", "Reso", "urc", "e", " ", "for", " ", "testi", "ng", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "attrs_", "=_", "[_", "'", "foo", "'_", ",_", "'", "bar", "'_", ",_", "'", "ba", "z", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "API", "Resource_", "(_", "api", "\\u", "base_", "._", "API", "Reso", "urc", "e", "Wrapper_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "instance_", "(_", "inner", "Object_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "inner", "Object_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "In", "ner", "API", "Resource_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inner", "Object_", "=_", "In", "ner", "API", "Resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inner", "Object_", "._", "foo_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inner", "Object_", "._", "bar_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "API", "Resource_", "(_", "inner", "Object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "API", "Dict_", "(_", "api", "\\u", "base_", "._", "API", "Dict", "Wrapper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Simple", " ", "API", "Dict", " ", "for", " ", "testi", "ng", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "attrs_", "=_", "[_", "'", "foo", "'_", ",_", "'", "bar", "'_", ",_", "'", "ba", "z", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "API", "Dict_", "(_", "api", "\\u", "base_", "._", "API", "Dict", "Wrapper_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "instance_", "(_", "inner", "Dict_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "inner", "Dict_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inner", "Dict_", "=_", "{_", "'", "foo", "'_", ":_", "'", "foo", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bar", "'_", ":_", "'", "bar", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "API", "Dict_", "(_", "inner", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "Reso", "urc", "e", "Wrapper", "Tests_", "(_", "test_", "._", "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_", "API", "Reso", "urc", "e", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "get", "\\u", "attribute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Resource_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "foo", "'_", ",_", "resource_", "._", "foo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Reso", "urc", "e", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "invalid", "\\u", "attribute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Resource_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "missi", "ng", "'_", ",_", "resource_", "._", "\\u", "attrs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Test", " ", "assumption", " ", "broken", ".", " ", " ", "Fin", "d", " ", "new", " ", "missi", "ng", " ", "attribute", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Attribute", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "._", "missing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Reso", "urc", "e", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "inner", "\\u", "missi", "ng", "\\u", "attribute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Resource_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Attribute", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "._", "baz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Reso", "urc", "e", "Wrapper", "Tests_", "(_", "test_", "._", "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", "repr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Resource_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resource", "\\u", "str_", "=_", "resource_", "._", "\\u\\u", "repr\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "foo", "'_", ",_", "resource", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "bar", "'_", ",_", "resource", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "'", "ba", "z", "'_", ",_", "resource", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "Dict", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "API", "Dict", " ", "allow", "s", " ", "for", " ", "bot", "h", " ", "attribute", " ", "access", " ", "and", " ", "dictionar", "y", " ", "style", " ", "[", "element", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "style", " ", "access", ".", " ", " ", "Test", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "API", "Dict", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "API", "Dict", " ", "allow", "s", " ", "for", " ", "bot", "h", " ", "attribute", " ", "access", " ", "and", " ", "dictionar", "y", " ", "style", " ", "[", "element", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "style", " ", "access", ".", " ", " ", "Test", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "get", "\\u", "item_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Dict_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "foo", "'_", ",_", "resource_", "._", "foo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "foo", "'_", ",_", "resource_", "[_", "'", "foo", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Dict", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "API", "Dict", " ", "allow", "s", " ", "for", " ", "bot", "h", " ", "attribute", " ", "access", " ", "and", " ", "dictionar", "y", " ", "style", " ", "[", "element", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "style", " ", "access", ".", " ", " ", "Test", " ", "both_", "\\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_", "test\\u", "get", "\\u", "invalid", "\\u", "item_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Dict_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "missi", "ng", "'_", ",_", "resource_", "._", "\\u", "attrs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Test", " ", "assumption", " ", "broken", ".", " ", " ", "Fin", "d", " ", "new", " ", "missi", "ng", " ", "attribute", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Attribute", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "._", "missing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "[_", "'", "missi", "ng", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Dict", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "API", "Dict", " ", "allow", "s", " ", "for", " ", "bot", "h", " ", "attribute", " ", "access", " ", "and", " ", "dictionar", "y", " ", "style", " ", "[", "element", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "style", " ", "access", ".", " ", " ", "Test", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "inner", "\\u", "missi", "ng", "\\u", "attribute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Dict_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Attribute", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "._", "baz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "[_", "'", "ba", "z", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Dict", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "API", "Dict", " ", "allow", "s", " ", "for", " ", "bot", "h", " ", "attribute", " ", "access", " ", "and", " ", "dictionar", "y", " ", "style", " ", "[", "element", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "style", " ", "access", ".", " ", " ", "Test", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "with", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Dict_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "foo", "'_", ",_", "resource_", "._", "get_", "(_", "'", "foo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "resource_", "._", "get_", "(_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "ret", "Value", "'_", ",_", "resource_", "._", "get_", "(_", "'", "ba", "z", "'_", ",_", "'", "ret", "Value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Dict", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "API", "Dict", " ", "allow", "s", " ", "for", " ", "bot", "h", " ", "attribute", " ", "access", " ", "and", " ", "dictionar", "y", " ", "style", " ", "[", "element", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "style", " ", "access", ".", " ", " ", "Test", " ", "both_", "\\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_", "test\\u", "get", "\\u", "with", "\\u", "non", "\\u", "str_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Dict_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "0_", ",_", "resource_", "._", "\\u", "attrs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Test", " ", "assumption", " ", "broken", ".", " ", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Fin", "d", " ", "new", " ", "missi", "ng", " ", "attribute", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "resource_", "._", "get_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "ret", "Value", "'_", ",_", "resource_", "._", "get_", "(_", "0_", ",_", "'", "ret", "Value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Dict", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "API", "Dict", " ", "allow", "s", " ", "for", " ", "bot", "h", " ", "attribute", " ", "access", " ", "and", " ", "dictionar", "y", " ", "style", " ", "[", "element", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "style", " ", "access", ".", " ", " ", "Test", " ", "both_", "\\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_", "test\\u", "get", "\\u", "item", "\\u", "non", "\\u", "str_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Dict_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "0_", ",_", "resource_", "._", "\\u", "attrs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Test", " ", "assumption", " ", "broken", ".", " ", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Fin", "d", " ", "new", " ", "missi", "ng", " ", "attribute", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Key", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Dict", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "API", "Dict", " ", "allow", "s", " ", "for", " ", "bot", "h", " ", "attribute", " ", "access", " ", "and", " ", "dictionar", "y", " ", "style", " ", "[", "element", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "style", " ", "access", ".", " ", " ", "Test", " ", "both_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "in", "\\u", "not", "\\u", "there", "\\u", "str_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Dict_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "'", "missi", "ng", "'_", ",_", "resource_", "._", "\\u", "attrs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Test", " ", "assumption", " ", "broken", ".", " ", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Fin", "d", " ", "new", " ", "missi", "ng", " ", "attribute", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "prima", "ri", "ly", " ", "interest", "ed", " ", "in", " ", "this", " ", "test", " ", "NOT", " ", "rais", "ing", " ", "a", " ", "Type", "Error", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "missi", "ng", "'_", "in_", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "Dict", "Wrapper", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "API", "Dict", " ", "allow", "s", " ", "for", " ", "bot", "h", " ", "attribute", " ", "access", " ", "and", " ", "dictionar", "y", " ", "style", " ", "[", "element", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "style", " ", "access", ".", " ", " ", "Test", " ", "both_", "\\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_", "test\\u", "in", "\\u", "not", "\\u", "there", "\\u", "non", "\\u", "str_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resource_", "=_", "API", "Dict_", "._", "get", "\\u", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "0_", ",_", "resource_", "._", "\\u", "attrs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "Test", " ", "assumption", " ", "broken", ".", " ", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Fin", "d", " ", "new", " ", "missi", "ng", " ", "attribute", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "prima", "ri", "ly", " ", "interest", "ed", " ", "in", " ", "this", " ", "test", " ", "NOT", " ", "rais", "ing", " ", "a", " ", "Type", "Error", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "0_", "in_", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Ap", "i", "Version", "Tests_", "(_", "test_", "._", "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_", "Ap", "i", "Version", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Ap", "i", "Version", "Tests_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "previ", "ous", "\\u", "settings_", "=_", "settings_", "._", "OPENS", "TACK", "\\u", "API", "\\u", "VERSIONS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "OPENS", "TACK", "\\u", "API", "\\u", "VERSIONS", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "data", "-", "process", "ing", "\"_", ":_", "1.1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "identi", "ty", "\"_", ":_", "\"", "2.0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "volume", "\"_", ":_", "1_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "cache", "d", " ", "data", " ", "from", " ", "other", " ", "tests", " ", "doe", "sn", "'", "t", " ", "interf", "ere", "_", "\\u\\u\\uNL\\u\\u\\u_", "cinder_", "._", "VERSIONS", "_", "._", "clear", "\\u", "active", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keystone_", "._", "VERSIONS", "_", "._", "clear", "\\u", "active", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glance_", "._", "VERSIONS", "_", "._", "clear", "\\u", "active", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ap", "i", "Version", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Ap", "i", "Version", "Tests_", ",_", "self_", ")_", "._", "tear", "Down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "OPENS", "TACK", "\\u", "API", "\\u", "VERSIONS", "_", "=_", "self_", "._", "previ", "ous", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Clear", " ", "out", " ", "our", " ", "bog", "us", " ", "data", " ", "so", " ", "it", " ", "doe", "sn", "'", "t", " ", "interf", "ere", "_", "\\u\\u\\uNL\\u\\u\\u_", "cinder_", "._", "VERSIONS", "_", "._", "clear", "\\u", "active", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keystone_", "._", "VERSIONS", "_", "._", "clear", "\\u", "active", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "glance_", "._", "VERSIONS", "_", "._", "clear", "\\u", "active", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ap", "i", "Version", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "versions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Configura", "tion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getattr_", "(_", "keystone_", "._", "VERSIONS", "_", ",_", "'", "active", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Configura", "tion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getattr_", "(_", "cinder_", "._", "VERSIONS", "_", ",_", "'", "active", "'_", ")_", "\\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 ", " _", "getattr_", "(_", "glance_", "._", "VERSIONS", "_", ",_", "'", "active", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exceptions_", "._", "Configura", "tion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Configura", "tion", "Error", " ", "raise", "d", " ", "ina", "ppro", "pri", "ate", "ly", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Ap", "i", "Help", "er", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "for", " ", "function", "s", " ", "tha", "t", " ", "don", "'", "t", " ", "use", " ", "one", " ", "of", " ", "the", " ", "api", " ", "object", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ap", "i", "Help", "er", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "url", "\\u", "for_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "image", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "http", "://", "public", ".", "gla", "nce", ".", "example", ".", "com", ":", "929", "2", "/", "v1", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "image", "'_", ",_", "endpoint", "\\u", "type_", "=_", "'", "admin", "URL", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "http", "://", "admin", ".", "gla", "nce", ".", "example", ".", "com", ":", "929", "2", "/", "v1", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "compute", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "http", "://", "public", ".", "nova", ".", "example", ".", "com", ":", "877", "4", "/", "v2", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "compute", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint", "\\u", "type_", "=_", "'", "admin", "URL", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "http", "://", "admin", ".", "nova", ".", "example", ".", "com", ":", "877", "4", "/", "v2", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "volume", "v2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "http", "://", "public", ".", "nova", ".", "example", ".", "com", ":", "877", "6", "/", "v2", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "volume", "v2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint", "\\u", "type_", "=_", "\"", "internal", "URL", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "http", "://", "int", ".", "nova", ".", "example", ".", "com", ":", "877", "6", "/", "v2", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "volume", "v2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint", "\\u", "type_", "=_", "'", "admin", "URL", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "http", "://", "admin", ".", "nova", ".", "example", ".", "com", ":", "877", "6", "/", "v2", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "'", "not", "An", "Ap", "i", "'_", ",_", "self_", "._", "request_", "._", "user_", "._", "service", "\\u", "catalog_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Select", " ", "a", " ", "new", " ", "nonexist", "ent", " ", "service", " ", "catal", "og", " ", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Service", "Catalog", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "not", "An", "Ap", "i", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "request_", "._", "user_", "._", "service", "s", "\\u", "region_", "=_", "\"", "Region", "Tw", "o", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "compute", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "http", "://", "public", ".", "nova", "2", ".", "example", ".", "com", ":", "877", "4", "/", "v2", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", "._", "user_", "._", "service", "s", "\\u", "region_", "=_", "\"", "Region", "Tw", "o", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "compute", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint", "\\u", "type_", "=_", "'", "admin", "URL", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "http", "://", "admin", ".", "nova", "2", ".", "example", ".", "com", ":", "877", "4", "/", "v2", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", "._", "user_", "._", "service", "s", "\\u", "region_", "=_", "\"", "Region", "Tw", "o", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Service", "Catalog", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "image", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "request_", "._", "user_", "._", "service", "s", "\\u", "region_", "=_", "\"", "bog", "us", "\\u", "value", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "identi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "endpoint", "\\u", "type_", "=_", "'", "admin", "URL", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "http", "://", "admin", ".", "keystone", ".", "example", ".", "com", ":", "353", "5", "7", "/", "v2", ".0", "'_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", "._", "user_", "._", "service", "s", "\\u", "region_", "=_", "\"", "bog", "us", "\\u", "value", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Service", "Catalog", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "api", "\\u", "base_", "._", "url", "\\u", "for_", "(_", "self_", "._", "request_", ",_", "'", "image", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Quota", "Set", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Quota", "Set", "Tests_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "quotas", "et", "\\u", "add", "\\u", "with", "\\u", "plus_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quot", "a", "\\u", "dict_", "=_", "{_", "'", "foo", "'_", ":_", "1_", ",_", "'", "bar", "'_", ":_", "10_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "quot", "a", "\\u", "dict_", "=_", "{_", "'", "my", "\\u", "test", "'_", ":_", "12_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quot", "a", "\\u", "set_", "=_", "api", "\\u", "base_", "._", "Quota", "Set_", "(_", "quot", "a", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "quot", "a", "\\u", "set_", "=_", "api", "\\u", "base_", "._", "Quota", "Set_", "(_", "other", "\\u", "quot", "a", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quot", "a", "\\u", "set_", "+=_", "other", "\\u", "quot", "a", "\\u", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "quot", "a", "\\u", "set_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quot", "a", "\\u", "dict_", "._", "update_", "(_", "other", "\\u", "quot", "a", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "q_", "in_", "quot", "a", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "quot", "a", "\\u", "dict_", "[_", "q_", "._", "name_", "]_", ",_", "q_", "._", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quota", "Set", "Tests_", "(_", "test_", "._", "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", "quotas", "et", "\\u", "add", "\\u", "doesnt", "\\u", "override", "\\u", "exist", "ing", "\\u", "quota_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quot", "a", "\\u", "dict_", "=_", "{_", "'", "foo", "'_", ":_", "1_", ",_", "'", "bar", "'_", ":_", "10_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quot", "a", "\\u", "set_", "=_", "api", "\\u", "base_", "._", "Quota", "Set_", "(_", "quot", "a", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "quot", "a", "\\u", "set_", "=_", "api", "\\u", "base_", "._", "Quota", "Set_", "(_", "{_", "'", "foo", "'_", ":_", "12_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quot", "a", "\\u", "set_", "+=_", "other", "\\u", "quot", "a", "\\u", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "len_", "(_", "quot", "a", "\\u", "set_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "q_", "in_", "quot", "a", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "quot", "a", "\\u", "dict_", "[_", "q_", "._", "name_", "]_", ",_", "q_", "._", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quota", "Set", "Tests_", "(_", "test_", "._", "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", "quotas", "et", "\\u", "add", "\\u", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quot", "a", "\\u", "dict_", "=_", "{_", "'", "foo", "'_", ":_", "1_", ",_", "'", "bar", "'_", ":_", "10_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "quot", "a", "\\u", "dict_", "=_", "{_", "'", "my", "\\u", "test", "'_", ":_", "12_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quot", "a", "\\u", "set_", "=_", "api", "\\u", "base_", "._", "Quota", "Set_", "(_", "quot", "a", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "quot", "a", "\\u", "set_", "=_", "api", "\\u", "base_", "._", "Quota", "Set_", "(_", "other", "\\u", "quot", "a", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quot", "a", "\\u", "set_", "._", "add_", "(_", "other", "\\u", "quot", "a", "\\u", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "quot", "a", "\\u", "set_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quot", "a", "\\u", "dict_", "._", "update_", "(_", "other", "\\u", "quot", "a", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "q_", "in_", "quot", "a", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "quot", "a", "\\u", "dict_", "[_", "q_", "._", "name_", "]_", ",_", "q_", "._", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Quota", "Set", "Tests_", "(_", "test_", "._", "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", "quotas", "et", "\\u", "add", "\\u", "with", "\\u", "wrong", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "quot", "a", "\\u", "set_", "=_", "api", "\\u", "base_", "._", "Quota", "Set_", "(_", "{_", "'", "foo", "'_", ":_", "1_", ",_", "'", "bar", "'_", ":_", "10_", "}_", ")_", "\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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
st4lk/django-rest-social-auth/tests/test_social.py
[ { "content": " @modify_settings(**jwt_modify_settings)\n def _check_login_social_jwt_user(self, url, data):\n try:\n from rest_framework_jwt.settings import api_settings\n except ImportError:\n return\n jwt_decode_handler = api_settings.JWT_DECODE_HANDLER\n resp = self.client.post(url, data)\n self.assertEqual(resp.status_code, 200)\n self.assertEqual(resp.data['email'], self.email)\n # check token valid\n jwt_data = jwt_decode_handler(resp.data['token'])\n self.assertEqual(jwt_data['email'], self.email)", "metadata": "root.TestSocialAuth2._check_login_social_jwt_user", "header": "['class', 'TestSocialAuth2', '(', 'APITestCase', ',', 'BaseFacebookAPITestCase', ')', ':', '___EOS___']", "index": 222 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Soci", "al", "Auth", "2_", "(_", "API", "Test", "Case_", ",_", "Base", "Face", "book", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "modif", "y", "\\u", "settings_", "(_", "**_", "jw", "t", "\\u", "modif", "y", "\\u", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "check", "\\u", "login", "\\u", "social", "\\u", "jw", "t", "\\u", "user_", "(_", "self_", ",_", "url_", ",_", "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 ", " _", "from_", "rest", "\\u", "frame", "work", "\\u", "jwt_", "._", "settings_", "import_", "api", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "jw", "t", "\\u", "decode", "\\u", "handler_", "=_", "api", "\\u", "settings_", "._", "JW", "T", "\\u", "DECO", "DE", "\\u", "HANDLER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "url_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "data_", "[_", "'", "email", "'_", "]_", ",_", "self_", "._", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "token", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "jw", "t", "\\u", "data_", "=_", "jw", "t", "\\u", "decode", "\\u", "handler_", "(_", "resp_", "._", "data_", "[_", "'", "token", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "jw", "t", "\\u", "data_", "[_", "'", "email", "'_", "]_", ",_", "self_", "._", "email_", ")_", "\\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 ]
Implicit string concatenation in a list
StackStorm/st2/contrib/packs/tests/test_action_check_auto_deploy_repo.py
[ { "content": "import yaml\n\nfrom st2tests.base import BaseActionTestCase\n\nfrom check_auto_deploy_repo import CheckAutoDeployRepo\n\n__all__ = [\n 'CheckAutoDeployRepoActionTestCase'\n]\n\nMOCK_DATA_1 = { \"deployment_branch\": \"master\", \"notify_channel\": \"community\" }\n\nMOCK_CONFIG_BLANK = \"\"\n\nMOCK_CONFIG_BLANK_REPOSITORIES = \"repositories:\"\n\nMOCK_CONFIG_FULL= \"\"\"\nrepositories:\n st2contrib:\n repo: \"https://github.com/StackStorm/st2contrib.git\"\n subtree: true\n auto_deployment:\n branch: \"master\"\n notify_channel: \"community\"\n\n st2incubator:\n repo: \"https://github.com/StackStorm/st2incubator.git\"\n subtree: true\n auto_deployment:\n branch: \"master\"\n notify_channel: \"community\"\n\"\"\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Implicit", "_", "string_", "concate", "nation_", "in_", "a_", "list_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "yaml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "st2", "tests_", "._", "base_", "import_", "Base", "Action", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "check", "\\u", "auto", "\\u", "deploy", "\\u", "repo_", "import_", "Check", "Auto", "Deploy", "Repo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Check", "Auto", "Deploy", "Rep", "o", "Action", "Test", "Case", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MOC", "K", "\\u", "DATA", "\\u", "1_", "=_", "{_", "\"", "deploy", "ment", "\\u", "branch", "\"_", ":_", "\"", "master", "\"_", ",_", "\"", "notif", "y", "\\u", "channel", "\"_", ":_", "\"", "communi", "ty", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MOC", "K", "\\u", "CONFIG", "\\u", "BLANK", "_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MOC", "K", "\\u", "CONFIG", "\\u", "BLANK", "\\u", "REPOS", "ITOR", "IES_", "=_", "\"", "repos", "itori", "es", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MOC", "K", "\\u", "CONFIG", "\\u", "FULL", "_", "=_", "\"\"\"", "\\", "10", ";", "repos", "itori", "es", ":", "\\", "10", ";", " ", " ", "st2", "contrib", ":", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "\"", "https", "://", "git", "hub", ".", "com", "/", "Stack", "Stor", "m", "/", "st2", "contrib", ".", "git", "\"", "\\", "10", ";", " ", " ", " ", " ", "subtree", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "auto", "\\u", "deploy", "ment", ":", "\\", "10", ";", " ", " ", "branch", ":", " ", "\"", "master", "\"", "\\", "10", ";", " ", " ", "notif", "y", "\\u", "channel", ":", " ", "\"", "communi", "ty", "\"", "\\", "10", ";", "\\", "10", ";", " ", " ", "st2", "inc", "uba", "tor", ":", "\\", "10", ";", " ", " ", " ", " ", "repo", ":", " ", "\"", "https", "://", "git", "hub", ".", "com", "/", "Stack", "Stor", "m", "/", "st2", "inc", "uba", "tor", ".", "git", "\"", "\\", "10", ";", " ", " ", " ", " ", "subtree", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "auto", "\\u", "deploy", "ment", ":", "\\", "10", ";", " ", " ", "branch", ":", " ", "\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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 ]
Variable defined multiple times
jjhelmus/nmrglue/nmrglue/analysis/tests/test_analysis_integration.py
[ { "content": "def test_1d_integrate():\n \"\"\" Test integration of synthetic 1D data with two peaks.\"\"\"\n # generate test scale\n ppm_scale = _build_1d_ppm_scale()\n uc = ng.fileio.fileiobase.uc_from_freqscale(ppm_scale, 100)\n\n # generate test data\n data = (multivariate_normal.pdf(ppm_scale, mean=5, cov=0.01) +\n multivariate_normal.pdf(ppm_scale, mean=8, cov=0.01) * 2.)\n\n # import matplotlib.pyplot as plt\n # plt.figure()\n # plt.plot(ppm_scale, data)\n # plt.show()\n\n # Test with a single integral region\n assert integrate(data, uc, (4, 6)) - 1.0 <= np.finfo(float).eps\n assert integrate(data, uc, (7, 9)) - 2.0 <= np.finfo(float).eps\n\n # Test with multiple integral regions:\n limits = [(4, 6), (7, 9)]\n values_1 = integrate(data, uc, limits)\n assert_array_almost_equal(values_1, [1., 2.])\n\n # Test with multiple integral regions and re-normalization of the values\n # to the value of the range between 7 ppm and 9 ppm\n values_2 = integrate(data, uc, limits, norm_to_range=1)\n assert_array_almost_equal(values_2, [0.5, 1.])\n\n # Test with multiple integral regions and re-normalization of the values\n # to the value of the range between 7 ppm and 9 ppm and re-calibration\n # of the the value to 3.\n values_2 = integrate(data, uc, limits, norm_to_range=1, calibrate=3)\n assert_array_almost_equal(values_2, [0.5 * 3, 3.])", "metadata": "root.test_1d_integrate", "header": "['module', '___EOS___']", "index": 24 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "1d", "\\u", "integrate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Test", " ", "integrati", "on", " ", "of", " ", "synthetic", " ", "1", "D", " ", "data", " ", "with", " ", "two", " ", "peaks", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "generat", "e", " ", "test", " ", "scale_", "\\u\\u\\uNL\\u\\u\\u_", "ppm", "\\u", "scale_", "=_", "\\u", "build", "\\u", "1d", "\\u", "ppm", "\\u", "scale_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uc_", "=_", "ng_", "._", "file", "io_", "._", "file", "iob", "ase_", "._", "uc", "\\u", "from", "\\u", "freqs", "cale_", "(_", "ppm", "\\u", "scale_", ",_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "e", " ", "test", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "(_", "multivariate", "\\u", "normal_", "._", "pdf_", "(_", "ppm", "\\u", "scale_", ",_", "mean_", "=_", "5_", ",_", "cov_", "=_", "0.01_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "multivariate", "\\u", "normal_", "._", "pdf_", "(_", "ppm", "\\u", "scale_", ",_", "mean_", "=_", "8_", ",_", "cov_", "=_", "0.01_", ")_", "*_", "2._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", " ", "mat", "plotlib", ".", "pypl", "ot", " ", "as", " ", "plt_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "figure", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "plot", "(", "ppm", "\\u", "scale", ",", " ", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plt", ".", "show", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "a", " ", "single", " ", "integral", " ", "region_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "integrate_", "(_", "data_", ",_", "uc_", ",_", "(_", "4_", ",_", "6_", ")_", ")_", "-_", "1.0_", "<=_", "np_", "._", "finfo", "_", "(_", "float_", ")_", "._", "eps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "integrate_", "(_", "data_", ",_", "uc_", ",_", "(_", "7_", ",_", "9_", ")_", ")_", "-_", "2.0_", "<=_", "np_", "._", "finfo", "_", "(_", "float_", ")_", "._", "eps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "multiple", " ", "integral", " ", "regions", ":_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "=_", "[_", "(_", "4_", ",_", "6_", ")_", ",_", "(_", "7_", ",_", "9_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values", "\\u", "1_", "=_", "integrate_", "(_", "data_", ",_", "uc_", ",_", "limits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "values", "\\u", "1_", ",_", "[_", "1._", ",_", "2._", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "multiple", " ", "integral", " ", "regions", " ", "and", " ", "re", "-", "normaliza", "tion", " ", "of", " ", "the", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "value", " ", "of", " ", "the", " ", "range", " ", "bet", "ween", " ", "7", " ", "ppm", " ", "and", " ", "9", " ", "ppm", "_", "\\u\\u\\uNL\\u\\u\\u_", "values", "\\u", "2_", "=_", "integrate_", "(_", "data_", ",_", "uc_", ",_", "limits_", ",_", "norm", "\\u", "to", "\\u", "range_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "values", "\\u", "2_", ",_", "[_", "0.5_", ",_", "1._", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "multiple", " ", "integral", " ", "regions", " ", "and", " ", "re", "-", "normaliza", "tion", " ", "of", " ", "the", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "value", " ", "of", " ", "the", " ", "range", " ", "bet", "ween", " ", "7", " ", "ppm", " ", "and", " ", "9", " ", "ppm", " ", "and", " ", "re", "-", "calibration_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "the", " ", "value", " ", "to", " ", "3._", "\\u\\u\\uNL\\u\\u\\u_", "values", "\\u", "2_", "=_", "integrate_", "(_", "data_", ",_", "uc_", ",_", "limits_", ",_", "norm", "\\u", "to", "\\u", "range_", "=_", "1_", ",_", "calibrate", "_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "array", "\\u", "alm", "ost", "\\u", "equal_", "(_", "values", "\\u", "2_", ",_", "[_", "0.5_", "*_", "3_", ",_", "3._", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused import
pytest-dev/pytest-bdd/tests/library/test_parent.py
[ { "content": "\"\"\"Test givens declared in the parent conftest and plugin files.\n\nCheck the parent givens are collected and overriden in the local conftest.\n\"\"\"\nfrom pytest_bdd.steps import get_step_fixture_name, WHEN\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_parent(parent, overridable):\n \"\"\"Test parent given is collected.\n\n Both fixtures come from the parent conftest.\n \"\"\"\n assert parent == 'parent'\n assert overridable == 'parent'", "metadata": "root.test_parent", "header": "['module', '___EOS___']", "index": 7 }, { "content": "def test_global_when_step(request):\n \"\"\"Test when step defined in the parent conftest.\"\"\"\n request.getfuncargvalue(get_step_fixture_name('I use a when step from the parent conftest', WHEN))", "metadata": "root.test_global_when_step", "header": "['module', '___EOS___']", "index": 16 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Test", " ", "give", "ns", " ", "declared", " ", "in", " ", "the", " ", "parent", " ", "conftest", " ", "and", " ", "plugin", " ", "files", ".", "\\", "10", ";", "\\", "10", ";", "Check", " ", "the", " ", "parent", " ", "give", "ns", " ", "are", " ", "collected", " ", "and", " ", "override", "n", " ", "in", " ", "the", " ", "local", " ", "conftest", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pytest", "\\u", "bdd", "_", "._", "steps_", "import_", "get", "\\u", "step", "\\u", "fixture", "\\u", "name_", ",_", "WHE", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "parent_", "(_", "parent_", ",_", "overrid", "able_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "parent", " ", "give", "n", " ", "is", " ", "collected", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Bot", "h", " ", "fixture", "s", " ", "come", " ", "from", " ", "the", " ", "parent", " ", "conftest", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parent_", "==_", "'", "parent", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "overrid", "able_", "==_", "'", "parent", "'_", "\\u\\u\\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", "global", "\\u", "whe", "n", "\\u", "step_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "whe", "n", " ", "step", " ", "defin", "ed", " ", "in", " ", "the", " ", "parent", " ", "conftest", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "getf", "unca", "rg", "value_", "(_", "get", "\\u", "step", "\\u", "fixture", "\\u", "name_", "(_", "'", "I", " ", "use", " ", "a", " ", "whe", "n", " ", "step", " ", "from", " ", "the", " ", "parent", " ", "conftest", "'_", ",_", "WHE", "N_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
openstack/nova/nova/tests/functional/libvirt/test_rt_servers.py
[ { "content": " @mock.patch('nova.virt.libvirt.LibvirtDriver._create_image')\n def test_success(self, img_mock):\n host_info = NumaHostInfo(cpu_nodes=2, cpu_sockets=1, cpu_cores=2,\n cpu_threads=2, kB_mem=15740000)\n fake_connection = fakelibvirt.Connection('qemu:///system',\n version=1002013,\n hv_version=2001000,\n host_info=host_info)\n with mock.patch('nova.virt.libvirt.host.Host.get_connection',\n return_value=fake_connection):\n self.compute = self.start_service('compute', host='test_compute0')\n fake_network.set_stub_network_methods(self)\n\n flavor = self._create_flavor(extra_spec={\n 'hw:cpu_realtime': 'yes',\n 'hw:cpu_policy': 'dedicated',\n 'hw:cpu_realtime_mask': '^1'})\n server = self._build_server(flavor)\n created = self.api.post_server({'server': server})\n\n instance = self.api.get_server(created['id'])\n instance = self._wait_for_state_change(instance, 'BUILD')\n\n self.assertEqual('ACTIVE', instance['status'])\n self._delete_server(instance['id'])", "metadata": "root.RealTimeServersTest.test_success", "header": "['class', 'RealTimeServersTest', '(', 'ServersTestBase', ')', ':', '___EOS___']", "index": 122 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Real", "Time", "Server", "s", "Test_", "(_", "Server", "s", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "(_", "'", "nova", ".", "virt", ".", "libvi", "rt", ".", "Lib", "virt", "Drive", "r", ".\\u", "create", "\\u", "image", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "success_", "(_", "self_", ",_", "img", "\\u", "mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "info_", "=_", "Num", "a", "Host", "Info_", "(_", "cpu", "\\u", "nodes_", "=_", "2_", ",_", "cpu", "\\u", "sockets_", "=_", "1_", ",_", "cpu", "\\u", "cores_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cpu", "\\u", "threads_", "=_", "2_", ",_", "k", "B", "\\u", "mem_", "=_", "157", "40000", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "connection_", "=_", "fake", "libvirt_", "._", "Connection_", "(_", "'", "qe", "mu", ":///", "system", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "1002", "013", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hv", "\\u", "version_", "=_", "200", "1000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "info_", "=_", "host", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "mock_", "._", "patch_", "(_", "'", "nova", ".", "virt", ".", "libvi", "rt", ".", "host", ".", "Host", ".", "get", "\\u", "connecti", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "fake", "\\u", "connection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "compute_", "=_", "self_", "._", "start", "\\u", "service_", "(_", "'", "compute", "'_", ",_", "host_", "=_", "'", "test\\u", "compute", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "network_", "._", "set\\u", "stub", "\\u", "network", "\\u", "methods_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "flavor_", "=_", "self_", "._", "\\u", "create", "\\u", "flavor_", "(_", "extra", "\\u", "spec_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hw", ":", "cpu", "\\u", "realtime", "'_", ":_", "'", "ye", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hw", ":", "cpu", "\\u", "policy", "'_", ":_", "'", "dedicated", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hw", ":", "cpu", "\\u", "realtime", "\\u", "mask", "'_", ":_", "'", "^", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "=_", "self_", "._", "\\u", "build", "\\u", "server_", "(_", "flavor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "self_", "._", "api_", "._", "post", "\\u", "server_", "(_", "{_", "'", "server", "'_", ":_", "server_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", "=_", "self_", "._", "api_", "._", "get", "\\u", "server_", "(_", "created_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "self_", "._", "\\u", "wait", "\\u", "for", "\\u", "state", "\\u", "change_", "(_", "instance_", ",_", "'", "BUILD", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "ACTI", "VE", "'_", ",_", "instance_", "[_", "'", "status", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "delete", "\\u", "server_", "(_", "instance_", "[_", "'", "id", "'_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
AppScale/appscale/AppServer/lib/django-1.2/django/utils/datastructures.py
[ { "content": " def has_key(self, key):\n for dict_ in self.dicts:\n if key in dict_:\n return True\n return False", "metadata": "root.MergeDict.has_key", "header": "['class', 'MergeDict', '(', 'object', ')', ':', '___EOS___']", "index": 66 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "class_", "Merge", "Dict_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "key_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "dict\\u_", "in_", "self_", "._", "dicts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "in_", "dict\\u_", ":_", "\\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_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
pystruct/pystruct/pystruct/tests/test_learners/test_frankwolfe_svm.py
[ { "content": "def test_svm_as_crf_pickling_batch():\n\n iris = load_iris()\n X, y = iris.data, iris.target\n\n X_ = [(np.atleast_2d(x), np.empty((0, 2), dtype=np.int)) for x in X]\n Y = y.reshape(-1, 1)\n\n X_train, X_test, y_train, y_test = train_test_split(X_, Y, random_state=1)\n _, file_name = mkstemp()\n\n pbl = GraphCRF(n_features=4, n_states=3, inference_method='unary')\n logger = SaveLogger(file_name)\n svm = FrankWolfeSSVM(pbl, C=10, logger=logger, max_iter=50, batch_mode=False)\n svm.fit(X_train, y_train)\n\n assert_less(.97, svm.score(X_test, y_test))\n assert_less(.97, logger.load().score(X_test, y_test))", "metadata": "root.test_svm_as_crf_pickling_batch", "header": "['module', '___EOS___']", "index": 53 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "svm", "\\u", "as", "\\u", "cr", "f", "\\u", "pick", "ling", "\\u", "batch_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iris_", "=_", "load", "\\u", "iris_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", ",_", "y_", "=_", "iris_", "._", "data_", ",_", "iris_", "._", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X", "\\u_", "=_", "[_", "(_", "np_", "._", "atl", "east", "\\u", "2d_", "(_", "x_", ")_", ",_", "np_", "._", "empty_", "(_", "(_", "0_", ",_", "2_", ")_", ",_", "dtype_", "=_", "np_", "._", "int_", ")_", ")_", "for_", "x_", "in_", "X_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "y_", "._", "reshape_", "(_", "-_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X", "\\u", "train_", ",_", "X", "\\u", "test_", ",_", "y", "\\u", "train_", ",_", "y", "\\u", "test_", "=_", "train", "\\u", "test\\u", "split_", "(_", "X", "\\u_", ",_", "Y_", ",_", "random", "\\u", "state_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "file", "\\u", "name_", "=_", "mkstemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pb", "l_", "=_", "Graph", "CR", "F_", "(_", "n", "\\u", "features_", "=_", "4_", ",_", "n", "\\u", "states_", "=_", "3_", ",_", "infer", "ence", "\\u", "method_", "=_", "'", "una", "ry", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "Save", "Logger_", "(_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svm_", "=_", "Fran", "k", "Wolf", "e", "SS", "VM_", "(_", "pb", "l_", ",_", "C_", "=_", "10_", ",_", "logger_", "=_", "logger_", ",_", "max", "\\u", "iter_", "=_", "50_", ",_", "batch", "\\u", "mode_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "svm_", "._", "fit_", "(_", "X", "\\u", "train_", ",_", "y", "\\u", "train_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "less_", "(_", ".9", "7_", ",_", "svm_", "._", "score_", "(_", "X", "\\u", "test_", ",_", "y", "\\u", "test_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "less_", "(_", ".9", "7_", ",_", "logger_", "._", "load_", "(_", ")_", "._", "score_", "(_", "X", "\\u", "test_", ",_", "y", "\\u", "test_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
tomerfiliba/rpyc/tests/test_custom_service.py
[ { "content": " def test_safeattrs(self):\n x = self.conn.root.getlist()\n #self.require(x == [1, 2, 3]) -- can't compare remote objects, sorry\n #self.require(x * 2 == [1, 2, 3, 1, 2, 3])\n self.assertEqual([y*2 for y in x], [2, 4, 6])", "metadata": "root.TestCustomService.test_safeattrs", "header": "['class', 'TestCustomService', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 77 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Custom", "Service_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "safe", "attrs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "self_", "._", "conn_", "._", "root_", "._", "getlist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "require", "(", "x", " ", "==", " ", "[", "1", ",", " ", "2", ",", " ", "3", "])", " ", "--", " ", "can", "'", "t", " ", "compare", " ", "remote", " ", "object", "s", ",", " ", "sorr", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "require", "(", "x", " ", "*", " ", "2", " ", "==", " ", "[", "1", ",", " ", "2", ",", " ", "3", ",", " ", "1", ",", " ", "2", ",", " ", "3", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "y_", "*_", "2_", "for_", "y_", "in_", "x_", "]_", ",_", "[_", "2_", ",_", "4_", ",_", "6_", "]_", ")_", "\\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 ]
Unused import
newhook/gomode/common.py
[ { "content": "import sublime\nimport os\nimport subprocess\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_settings():\n return sublime.load_settings(\"GoMode.sublime-settings\")", "metadata": "root.get_settings", "header": "['module', '___EOS___']", "index": 4 }, { "content": "def get_setting(key, default=None, view=None):\n try:\n if view == None:\n view = sublime.active_window().active_view()\n s = view.settings()\n if s.has(\"go_%s\" % key):\n return s.get(\"go_%s\" % key)\n except:\n pass\n return get_settings().get(key, default)", "metadata": "root.get_setting", "header": "['module', '___EOS___']", "index": 7 }, { "content": "def getenv():\n env = os.environ.copy()\n userenv = get_setting(\"env\")\n for k in userenv:\n env[k] = os.path.expandvars(userenv[k])\n return env", "metadata": "root.getenv", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def openProcess(args,env=None,cwd=None,stdin=None,stdout=None,stderr=None, shell=False):\n startupinfo = None\n\n if os.name == 'nt':\n startupinfo = subprocess.STARTUPINFO()\n startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW\n proc = subprocess.Popen(args,bufsize=-1,env=env,cwd=cwd,stdin=stdin,stdout=stdout,stderr=stderr,startupinfo=startupinfo, shell=shell)\n return proc", "metadata": "root.openProcess", "header": "['module', '___EOS___']", "index": 25 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sublime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "settings_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sublime_", "._", "load", "\\u", "settings_", "(_", "\"", "Go", "Mode", ".", "sublim", "e-", "settings", "\"_", ")_", "\\u\\u\\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", "setting_", "(_", "key_", ",_", "default_", "=_", "None_", ",_", "view_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "view_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "=_", "sublime_", "._", "active", "\\u", "window_", "(_", ")_", "._", "active", "\\u", "view_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "view_", "._", "settings_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "._", "has_", "(_", "\"", "go", "\\u", "%", "s", "\"_", "%_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "._", "get_", "(_", "\"", "go", "\\u", "%", "s", "\"_", "%_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "get", "\\u", "settings_", "(_", ")_", "._", "get_", "(_", "key_", ",_", "default_", ")_", "\\u\\u\\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_", "getenv_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "os_", "._", "environ_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "env_", "=_", "get", "\\u", "setting_", "(_", "\"", "env", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "user", "env_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "[_", "k_", "]_", "=_", "os_", "._", "path_", "._", "expand", "vars_", "(_", "user", "env_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "env_", "\\u\\u\\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_", "open", "Process_", "(_", "args_", ",_", "env_", "=_", "None_", ",_", "cwd_", "=_", "None_", ",_", "stdin_", "=_", "None_", ",_", "stdout_", "=_", "None_", ",_", "stderr_", "=_", "None_", ",_", "shell_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "upi", "nfo_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "name_", "==_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "upi", "nfo_", "=_", "subprocess_", "._", "START", "UP", "INFO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "upi", "nfo_", "._", "dw", "Flags_", "|=_", "subprocess_", "._", "START", "F", "\\u", "USE", "SHOW", "WINDOW_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "args_", ",_", "bufsize_", "=_", "-_", "1_", ",_", "env_", "=_", "env_", ",_", "cwd_", "=_", "cwd_", ",_", "stdin_", "=_", "stdin_", ",_", "stdout_", "=_", "stdout_", ",_", "stderr_", "=_", "stderr_", ",_", "start", "upi", "nfo_", "=_", "start", "upi", "nfo_", ",_", "shell_", "=_", "shell_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "proc_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
saltstack/salt/salt/modules/redismod.py
[ { "content": "def shutdown(host=None, port=None, db=None, password=None):\n '''\n Synchronously save the dataset to disk and then shut down the server\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' redis.shutdown\n '''\n server = _connect(host, port, db, password)\n try:\n # Return false if unable to ping server\n server.ping()\n except redis.ConnectionError:\n return False\n\n server.shutdown()\n try:\n # This should fail now if the server is shutdown, which we want\n server.ping()\n except redis.ConnectionError:\n return True\n return False", "metadata": "root.shutdown", "header": "['module', '___EOS___']", "index": 404 } ]
[]
[]
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_", "shutdown_", "(_", "host_", "=_", "None_", ",_", "port_", "=_", "None_", ",_", "db_", "=_", "None_", ",_", "password_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Synchro", "nous", "ly", " ", "save", " ", "the", " ", "dataset", " ", "to", " ", "disk", " ", "and", " ", "then", " ", "shut", " ", "down", " ", "the", " ", "server", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "redis", ".", "shut", "down", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "=_", "\\u", "connect_", "(_", "host_", ",_", "port_", ",_", "db_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Return", " ", "fal", "se", " ", "if", " ", "una", "ble", " ", "to", " ", "ping", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "ping_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "redis_", "._", "Connect", "ion", "Error_", ":_", "\\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_", "server_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "fail", " ", "now", " ", "if", " ", "the", " ", "server", " ", "is", " ", "shut", "down", ",", " ", "whi", "ch", " ", "we", " ", "want_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "._", "ping_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "redis_", "._", "Connect", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
tmm1/graphite/contrib/demo-collector.py
[ { "content": " def fetch_disk_usage(self):\n data = []\n now = int(time())\n (status, raw_data) = getstatusoutput(\"mount\")\n if status != 0: return data\n for line in raw_data.split(\"\\n\"):\n if not (line.startswith(\"/\") or line.find(\"@o2ib\") >= 0): continue\n device = line.split()[2]\n device_name = line.split()[0].split('/')[-1]\n (status, device_data) = getstatusoutput(\"stat -c '%s %a %b %c %d %f' -f \" + device)\n if status != 0: continue\n block_size, free_blocks_nonsu, total_blocks, total_file_nodes, free_file_nodes, free_blocks = [a.isdigit() and int(a) or 0 for a in device_data.split()]\n data.append(\"disk.%s.available %d %d\" % (device_name, free_blocks*block_size, now))\n data.append(\"disk.%s.free_inodes %d %d\" % (device_name, free_file_nodes, now))\n data.append(\"disk.%s.available_percent %f %d\" % (device_name, float(free_blocks)/total_blocks*100, now))\n return data", "metadata": "root.Host.fetch_disk_usage", "header": "['class', 'Host', ':', '___EOS___']", "index": 93 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Host_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fetch", "\\u", "disk", "\\u", "usage_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "int_", "(_", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "status_", ",_", "raw", "\\u", "data_", ")_", "=_", "getstatus", "output_", "(_", "\"", "mount", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", "!=_", "0_", ":_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "raw", "\\u", "data_", "._", "split_", "(_", "\"\\\\", "n", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "(_", "line_", "._", "startswith_", "(_", "\"/\"_", ")_", "or_", "line_", "._", "find_", "(_", "\"@", "o", "2i", "b", "\"_", ")_", ">=_", "0_", ")_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device_", "=_", "line_", "._", "split_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "\\u", "name_", "=_", "line_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "status_", ",_", "device", "\\u", "data_", ")_", "=_", "getstatus", "output_", "(_", "\"", "stat", " ", "-", "c", " ", "'%", "s", " ", "%", "a", " ", "%", "b", " ", "%", "c", " ", "%", "d", " ", "%", "f", "'", " ", "-", "f", " ", "\"_", "+_", "device_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", "!=_", "0_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "\\u", "size_", ",_", "free", "\\u", "blocks", "\\u", "nons", "u_", ",_", "total", "\\u", "blocks_", ",_", "total", "\\u", "file", "\\u", "nodes_", ",_", "free", "\\u", "file", "\\u", "nodes_", ",_", "free", "\\u", "blocks_", "=_", "[_", "a_", "._", "isdigit_", "(_", ")_", "and_", "int_", "(_", "a_", ")_", "or_", "0_", "for_", "a_", "in_", "device", "\\u", "data_", "._", "split_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "append_", "(_", "\"", "disk", ".", "%", "s", ".", "avail", "able", " ", "%", "d", " ", "%", "d", "\"_", "%_", "(_", "device", "\\u", "name_", ",_", "free", "\\u", "blocks_", "*_", "block", "\\u", "size_", ",_", "now_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "append_", "(_", "\"", "disk", ".", "%", "s", ".", "free", "\\u", "inode", "s", " ", "%", "d", " ", "%", "d", "\"_", "%_", "(_", "device", "\\u", "name_", ",_", "free", "\\u", "file", "\\u", "nodes_", ",_", "now_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "append_", "(_", "\"", "disk", ".", "%", "s", ".", "avail", "able", "\\u", "percent", " ", "%", "f", " ", "%", "d", "\"_", "%_", "(_", "device", "\\u", "name_", ",_", "float_", "(_", "free", "\\u", "blocks_", ")_", "/_", "total", "\\u", "blocks_", "*_", "100_", ",_", "now_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
dimagi/commcare-hq/corehq/apps/cloudcare/models.py
[ { "content": "class ApplicationAccess(Document):\n \"\"\"\n This is used to control which users/groups can access which applications on cloudcare.\n \"\"\"\n domain = StringProperty()\n app_groups = SchemaListProperty(AppGroup, default=[])\n restrict = BooleanProperty(default=False)\n\n\n\n", "metadata": "root.ApplicationAccess", "header": "['module', '___EOS___']", "index": 55 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Applica", "tion", "Access_", "(_", "Document_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "to", " ", "control", " ", "whi", "ch", " ", "users", "/", "group", "s", " ", "can", " ", "access", " ", "whi", "ch", " ", "applica", "tion", "s", " ", "on", " ", "cloud", "care", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain_", "=_", "String", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "groups_", "=_", "Schema", "List", "Property_", "(_", "App", "Group_", ",_", "default_", "=_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restrict", "_", "=_", "Boo", "lean", "Property_", "(_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ]
Except block handles 'BaseException'
tomerfiliba/rpyc/rpyc/experimental/retunnel.py
[ { "content": " def _safeio(self, callback):\n if self.closed:\n raise ValueError(\"I/O operation on closed file\")\n for i in range(self.retries):\n try:\n if not self.stream:\n self.stream = self._reconnect()\n return callback(self.stream)\n except (EOFError, IOError, OSError, socket.error):\n if i >= self.retries - 1:\n raise\n if self.stream:\n self.stream.close()\n self.stream = None\n time.sleep(0.5)", "metadata": "root.ReconnectingTunnelStream._safeio", "header": "['class', 'ReconnectingTunnelStream', '(', 'Stream', ')', ':', '___EOS___']", "index": 46 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Recon", "necti", "ng", "Tun", "nel", "Stream_", "(_", "Stream_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "safe", "io_", "(_", "self_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "closed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "I", "/", "O", " ", "operati", "on", " ", "on", " ", "close", "d", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "self_", "._", "retries_", ")_", ":_", "\\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_", "not_", "self_", "._", "stream_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "stream_", "=_", "self_", "._", "\\u", "reconnect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "callback_", "(_", "self_", "._", "stream_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "EO", "FE", "rror_", ",_", "IO", "Error_", ",_", "OSE", "rror_", ",_", "socket_", "._", "error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", ">=_", "self_", "._", "retries_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "stream_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "stream_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "stream_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.5_", ")_", "\\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 ]
Testing equality to None
PublicMapping/DistrictBuilder/django/publicmapping/redistricting/config.py
[ { "content": " def import_scoring(self, force):\n \"\"\"\n Create the Scoring models.\n\n @param force: Should the Scoring settings be written if the model already exist?\n @returns: A flag indicating if the import was successful.\n \"\"\"\n result = True\n if not self.store.has_scoring():\n logger.debug('Scoring not configured')\n \n admin = User.objects.filter(is_superuser=True)\n if admin.count() == 0:\n logger.debug('There was no superuser installed; ScoreDisplays need to be assigned ownership to a superuser.')\n return False\n else:\n admin = admin[0]\n\n # Import score displays.\n for sd in self.store.filter_scoredisplays():\n lb = LegislativeBody.objects.get(name=sd.get('legislativebodyref'))\n \n sd_obj, created = ScoreDisplay.objects.get_or_create(\n name=sd.get('id')[:50],\n title=sd.get('title')[:50],\n legislative_body=lb,\n is_page=sd.get('type') == 'leaderboard',\n cssclass=(sd.get('cssclass') or '')[:50],\n owner=admin\n )\n\n for locale in [l[0] for l in settings.LANGUAGES]:\n po = self.poutils[locale]\n po.add_or_update(\n msgid=u'%s short label' % sd.get('id'),\n msgstr=sd.get('title') or '',\n occurs=[(os.path.abspath(self.store.datafile), sd.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s label' % sd.get('id'),\n msgstr=sd.get('title') or '',\n occurs=[(os.path.abspath(self.store.datafile), sd.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s long description' % sd.get('id'),\n msgstr='',\n occurs=[(os.path.abspath(self.store.datafile), sd.sourceline,)]\n )\n\n\n if created:\n logger.debug('Created ScoreDisplay \"%s\"', sd.get('title'))\n else:\n logger.debug('ScoreDisplay \"%s\" already exists', sd.get('title'))\n\n # Import score panels for this score display.\n for spref in self.store.filter_displayed_score_panels(sd):\n sp = self.store.get_score_panel(spref.get('ref'))\n name = sp.get('id')[:50]\n position = int(sp.get('position'))\n template = sp.get('template')[:500]\n cssclass = (sp.get('cssclass') or '')[:50]\n pnltype = sp.get('type')[:20]\n\n is_ascending = sp.get('is_ascending')\n if is_ascending is None:\n is_ascending = True\n \n ascending = sp.get('is_ascending')\n sp_obj, created = ScorePanel.objects.get_or_create(\n type=pnltype,\n position=position,\n name=name,\n template=template,\n cssclass=cssclass,\n is_ascending=(ascending is None or ascending=='true'), \n )\n\n if created:\n sd_obj.scorepanel_set.add(sp_obj)\n\n logger.debug('Created ScorePanel \"%s\"', name)\n else:\n attached = sd_obj.scorepanel_set.filter(id=sp_obj.id).count() == 1\n if not attached:\n sd_obj.scorepanel_set.add(sp_obj)\n\n logger.debug('ScorePanel \"%s\" already exists', name)\n\n for locale in[l[0] for l in settings.LANGUAGES]:\n po = self.poutils[locale]\n po.add_or_update(\n msgid=u'%s short label' % sp_obj.name,\n msgstr=sp.get('title') or '',\n occurs=[(os.path.abspath(self.store.datafile), sp.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s label' % sp_obj.name,\n msgstr=sp.get('title') or '',\n occurs=[(os.path.abspath(self.store.datafile), sp.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s long description' % sp_obj.name,\n msgstr='',\n occurs=[(os.path.abspath(self.store.datafile), sp.sourceline,)]\n )\n\n # Import score functions for this score panel\n for sfref in self.store.filter_paneled_score_functions(sp):\n sf_node = self.store.get_score_function(sfref.get('ref'))\n sf_obj = self.import_function(sf_node, force)\n\n # Add ScoreFunction reference to ScorePanel\n sp_obj.score_functions.add(sf_obj)\n\n # It's possible to define ScoreFunctions that are not part of any ScorePanels, yet\n # still need to be added to allow for user selection. Find and import these functions.\n for sf_node in self.store.filter_score_functions():\n self.import_function(sf_node, force)\n\n # Import validation criteria.\n if not self.store.has_validation():\n logger.debug('Validation not configured')\n return False;\n\n for vc in self.store.filter_criteria():\n lb = LegislativeBody.objects.get(name=vc.get('legislativebodyref'))\n\n for crit in self.store.filter_criteria_criterion(vc):\n # Import the score function for this validation criterion\n sfref = self.store.get_criterion_score(crit)\n try:\n sf = self.store.get_score_function(sfref.get('ref'))\n except:\n logger.info(\"Couldn't import ScoreFunction for Criteria %s\", crit.get('name'))\n result = False\n\n sf_obj = self.import_function(sf, force)\n\n # Import this validation criterion\n attributes = {\n 'name': crit.get('id')[0:50],\n 'function': sf_obj,\n 'legislative_body': lb\n }\n crit_obj, created, changed, message = check_and_update(ValidationCriteria, overwrite=force, **attributes)\n\n for locale in [l[0] for l in settings.LANGUAGES]:\n po = self.poutils[locale]\n po.add_or_update(\n msgid=u'%s short label' % attributes['name'],\n msgstr=crit.get('name') or '',\n occurs=[(os.path.abspath(self.store.datafile), crit.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s label' % attributes['name'],\n msgstr=crit.get('name') or '',\n occurs=[(os.path.abspath(self.store.datafile), crit.sourceline,)]\n )\n po.add_or_update(\n msgid=u'%s long description' % attributes['name'],\n msgstr=crit.get('description') or '',\n occurs=[(os.path.abspath(self.store.datafile), crit.sourceline,)]\n )\n\n if changed and not force:\n logger.info(message)\n else:\n logger.debug(message)\n\n return result", "metadata": "root.ConfigImporter.import_scoring", "header": "['class', 'ConfigImporter', ':', '___EOS___']", "index": 515 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Config", "Importer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "scoring_", "(_", "self_", ",_", "force_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "the", " ", "Sco", "ring", " ", "model", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "force", ":", " ", "Sho", "ul", "d", " ", "the", " ", "Sco", "ring", " ", "settings", " ", "be", " ", "writt", "en", " ", "if", " ", "the", " ", "model", " ", "alr", "ead", "y", " ", "exist", "?", "\\", "10", ";", " ", " ", " ", " ", "@", "return", "s", ":", " ", "A", " ", "flag", " ", "indicati", "ng", " ", "if", " ", "the", " ", "import", " ", "was", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "store_", "._", "has", "\\u", "scoring_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Sco", "ring", " ", "not", " ", "configur", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "admin_", "=_", "User_", "._", "objects_", "._", "filter_", "(_", "is", "\\u", "superuser_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "admin_", "._", "count_", "(_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "There", " ", "was", " ", "no", " ", "super", "user", " ", "install", "ed", ";", " ", "Score", "Display", "s", " ", "need", " ", "to", " ", "be", " ", "assign", "ed", " ", "owner", "ship", " ", "to", " ", "a", " ", "super", "user", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin_", "=_", "admin_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "score", " ", "display", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sd_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "scored", "isp", "lay", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb_", "=_", "Legi", "slat", "ive", "Body_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "sd_", "._", "get_", "(_", "'", "legislat", "ive", "body", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sd", "\\u", "obj_", ",_", "created_", "=_", "Score", "Display_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "sd_", "._", "get_", "(_", "'", "id", "'_", ")_", "[_", ":_", "50_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "sd_", "._", "get_", "(_", "'", "title", "'_", ")_", "[_", ":_", "50_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "legislat", "ive", "\\u", "body_", "=_", "lb_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "page_", "=_", "sd_", "._", "get_", "(_", "'", "type", "'_", ")_", "==_", "'", "leader", "board", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "class_", "=_", "(_", "sd_", "._", "get_", "(_", "'", "css", "class", "'_", ")_", "or_", "''_", ")_", "[_", ":_", "50_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "owner_", "=_", "admin_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "locale_", "in_", "[_", "l_", "[_", "0_", "]_", "for_", "l_", "in_", "settings_", "._", "LANGUAGES_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "po_", "=_", "self_", "._", "pou", "tils_", "[_", "locale_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "short", " ", "label", "'_", "%_", "sd_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "sd_", "._", "get_", "(_", "'", "title", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sd_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "label", "'_", "%_", "sd_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "sd_", "._", "get_", "(_", "'", "title", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sd_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "long", " ", "description", "'_", "%_", "sd_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sd_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\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_", "created_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "Score", "Display", " ", "\"%", "s", "\"'_", ",_", "sd_", "._", "get_", "(_", "'", "title", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Score", "Display", " ", "\"%", "s", "\"", " ", "alr", "ead", "y", " ", "exist", "s", "'_", ",_", "sd_", "._", "get_", "(_", "'", "title", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "score", " ", "panel", "s", " ", "for", " ", "this", " ", "score", " ", "display", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "spr", "ef_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "displaye", "d\\u", "score", "\\u", "panels_", "(_", "sd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sp_", "=_", "self_", "._", "store_", "._", "get", "\\u", "score", "\\u", "panel_", "(_", "spr", "ef_", "._", "get_", "(_", "'", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "sp_", "._", "get_", "(_", "'", "id", "'_", ")_", "[_", ":_", "50_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "position_", "=_", "int_", "(_", "sp_", "._", "get_", "(_", "'", "position", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "sp_", "._", "get_", "(_", "'", "template", "'_", ")_", "[_", ":_", "500_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "css", "class_", "=_", "(_", "sp_", "._", "get_", "(_", "'", "css", "class", "'_", ")_", "or_", "''_", ")_", "[_", ":_", "50_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pn", "lty", "pe_", "=_", "sp_", "._", "get_", "(_", "'", "type", "'_", ")_", "[_", ":_", "20_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "ascending_", "=_", "sp_", "._", "get_", "(_", "'", "is", "\\u", "ascen", "ding", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "ascending_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "is", "\\u", "ascending_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ascending_", "=_", "sp_", "._", "get_", "(_", "'", "is", "\\u", "ascen", "ding", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp", "\\u", "obj_", ",_", "created_", "=_", "Score", "Panel_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "pn", "lty", "pe_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "position_", "=_", "position_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "class_", "=_", "css", "class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "ascending_", "=_", "(_", "ascending_", "is_", "None_", "or_", "ascending_", "==_", "'", "true", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "created_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sd", "\\u", "obj_", "._", "score", "panel", "\\u", "set_", "._", "add_", "(_", "sp", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Creat", "ed", " ", "Score", "Pane", "l", " ", "\"%", "s", "\"'_", ",_", "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 ", " ", "_", "attache", "d_", "=_", "sd", "\\u", "obj_", "._", "score", "panel", "\\u", "set_", "._", "filter_", "(_", "id_", "=_", "sp", "\\u", "obj_", "._", "id_", ")_", "._", "count_", "(_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "attache", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sd", "\\u", "obj_", "._", "score", "panel", "\\u", "set_", "._", "add_", "(_", "sp", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "Score", "Pane", "l", " ", "\"%", "s", "\"", " ", "alr", "ead", "y", " ", "exist", "s", "'_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "locale_", "in_", "[_", "l_", "[_", "0_", "]_", "for_", "l_", "in_", "settings_", "._", "LANGUAGES_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "po_", "=_", "self_", "._", "pou", "tils_", "[_", "locale_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "short", " ", "label", "'_", "%_", "sp", "\\u", "obj_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "sp_", "._", "get_", "(_", "'", "title", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sp_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "label", "'_", "%_", "sp", "\\u", "obj_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "sp_", "._", "get_", "(_", "'", "title", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sp_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "long", " ", "description", "'_", "%_", "sp", "\\u", "obj_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "sp_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "score", " ", "function", "s", " ", "for", " ", "this", " ", "score", " ", "panel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sfr", "ef_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "panel", "ed", "\\u", "score", "\\u", "functions_", "(_", "sp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sf", "\\u", "node_", "=_", "self_", "._", "store_", "._", "get", "\\u", "score", "\\u", "function_", "(_", "sfr", "ef_", "._", "get_", "(_", "'", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf", "\\u", "obj_", "=_", "self_", "._", "import", "\\u", "function_", "(_", "sf", "\\u", "node_", ",_", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "Score", "Function", " ", "reference", " ", "to", " ", "Score", "Panel_", "\\u\\u\\uNL\\u\\u\\u_", "sp", "\\u", "obj_", "._", "score", "\\u", "functions_", "._", "add_", "(_", "sf", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "possib", "le", " ", "to", " ", "defin", "e", " ", "Score", "Function", "s", " ", "tha", "t", " ", "are", " ", "not", " ", "part", " ", "of", " ", "any", " ", "Score", "Pane", "ls", ",", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "still", " ", "need", " ", "to", " ", "be", " ", "adde", "d", " ", "to", " ", "allow", " ", "for", " ", "user", " ", "selection", ".", " ", "Fin", "d", " ", "and", " ", "import", " ", "these", " ", "function", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sf", "\\u", "node_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "score", "\\u", "functions_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "import", "\\u", "function_", "(_", "sf", "\\u", "node_", ",_", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "validation", " ", "crite", "ria", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "store_", "._", "has", "\\u", "validation_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "Validat", "ion", " ", "not", " ", "configur", "ed", "'_", ")_", "\\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_", "for_", "vc_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "criteria_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lb_", "=_", "Legi", "slat", "ive", "Body_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "vc_", "._", "get_", "(_", "'", "legislat", "ive", "body", "ref", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "crit_", "in_", "self_", "._", "store_", "._", "filter", "\\u", "crite", "ria", "\\u", "criterion_", "(_", "vc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Import", " ", "the", " ", "score", " ", "function", " ", "for", " ", "this", " ", "validation", " ", "criterion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sfr", "ef_", "=_", "self_", "._", "store_", "._", "get", "\\u", "criterio", "n", "\\u", "score_", "(_", "crit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sf_", "=_", "self_", "._", "store_", "._", "get", "\\u", "score", "\\u", "function_", "(_", "sfr", "ef_", "._", "get_", "(_", "'", "ref", "'_", ")_", ")_", "\\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 ", " ", "_", "logger_", "._", "info_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "import", " ", "Score", "Function", " ", "for", " ", "Criteria", " ", "%", "s", "\"_", ",_", "crit_", "._", "get_", "(_", "'", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sf", "\\u", "obj_", "=_", "self_", "._", "import", "\\u", "function_", "(_", "sf_", ",_", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "this", " ", "validation", " ", "criterion_", "\\u\\u\\uNL\\u\\u\\u_", "attributes_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "crit_", "._", "get_", "(_", "'", "id", "'_", ")_", "[_", "0_", ":_", "50_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "function", "'_", ":_", "sf", "\\u", "obj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "legislat", "ive", "\\u", "body", "'_", ":_", "lb_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "crit", "\\u", "obj_", ",_", "created_", ",_", "changed_", ",_", "message_", "=_", "check", "\\u", "and", "\\u", "update_", "(_", "Validat", "ion", "Criteria", "_", ",_", "overwrite_", "=_", "force_", ",_", "**_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "locale_", "in_", "[_", "l_", "[_", "0_", "]_", "for_", "l_", "in_", "settings_", "._", "LANGUAGES_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "po_", "=_", "self_", "._", "pou", "tils_", "[_", "locale_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "short", " ", "label", "'_", "%_", "attributes_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "crit_", "._", "get_", "(_", "'", "name", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "crit_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "label", "'_", "%_", "attributes_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "crit_", "._", "get_", "(_", "'", "name", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "crit_", "._", "source", "line_", ",_", ")_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "._", "add", "\\u", "or", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msgid_", "=_", "u", "'%", "s", " ", "long", " ", "description", "'_", "%_", "attributes_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msgs", "tr_", "=_", "crit_", "._", "get_", "(_", "'", "description", "'_", ")_", "or_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "occur", "s_", "=_", "[_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "store_", "._", "datafile_", ")_", ",_", "crit_", "._", "source", "line_", ",_", ")_", "]_", "\\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_", "changed_", "and_", "not_", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "info_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
GoogleCloudPlatform/appengine-mapreduce/python/src/mapreduce/handlers.py
[ { "content": "#!/usr/bin/env python\n# Copyright 2010 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\"\"\"Defines executor tasks handlers for MapReduce implementation.\"\"\"\n\n\n\n# pylint: disable=protected-access\n# pylint: disable=g-bad-name\n\nimport datetime\nimport logging\nimport math\nimport os\nimport random\nimport sys\nimport time\nimport traceback\nimport zlib\n\ntry:\n import json\nexcept ImportError:\n import simplejson as json\n\nfrom google.appengine.ext import ndb\n\nfrom google.appengine import runtime\nfrom google.appengine.api import datastore_errors\nfrom google.appengine.api import logservice\nfrom google.appengine.api import taskqueue\nfrom google.appengine.ext import db\nfrom mapreduce import base_handler\nfrom mapreduce import context\nfrom mapreduce import errors\nfrom mapreduce import input_readers\nfrom mapreduce import map_job_context\nfrom mapreduce import model\nfrom mapreduce import operation\nfrom mapreduce import output_writers\nfrom mapreduce import parameters\nfrom mapreduce import shard_life_cycle\nfrom mapreduce import util\nfrom mapreduce.api import map_job\nfrom google.appengine.runtime import apiproxy_errors\n\n# pylint: disable=g-import-not-at-top\ntry:\n import cloudstorage\n # In 25 runtime, the above code will be scrubbed to import the stub version\n # of cloudstorage. All occurences of the following if condition in MR\n # codebase is to tell it apart.\n # TODO(user): Remove after 25 runtime MR is abondoned.\n if hasattr(cloudstorage, \"_STUB\"):\n cloudstorage = None\nexcept ImportError:\n cloudstorage = None # CloudStorage library not available\n\n\n# A guide to logging.\n# log.critical: messages user absolutely should see, e.g. failed job.\n# log.error: exceptions during processing user data, or unexpected\n# errors detected by mr framework.\n# log.warning: errors mr framework knows how to handle.\n# log.info: other expected events.\n\n\n# Set of strings of various test-injected faults.\n_TEST_INJECTED_FAULTS = set()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _run_task_hook(hooks, method, task, queue_name):\n \"\"\"Invokes hooks.method(task, queue_name).\n\n Args:\n hooks: A hooks.Hooks instance or None.\n method: The name of the method to invoke on the hooks class e.g.\n \"enqueue_kickoff_task\".\n task: The taskqueue.Task to pass to the hook method.\n queue_name: The name of the queue to pass to the hook method.\n\n Returns:\n True if the hooks.Hooks instance handled the method, False otherwise.\n \"\"\"\n if hooks is not None:\n try:\n getattr(hooks, method)(task, queue_name)\n except NotImplementedError:\n # Use the default task addition implementation.\n return False\n\n return True\n return False", "metadata": "root._run_task_hook", "header": "['module', '___EOS___']", "index": 84 }, { "content": "class MapperWorkerCallbackHandler(base_handler.HugeTaskHandler):\n \"\"\"Callback handler for mapreduce worker task.\"\"\"\n\n # These directives instruct self.__return() how to set state and enqueue task.\n _TASK_DIRECTIVE = util._enum(\n # Task is running as expected.\n PROCEED_TASK=\"proceed_task\",\n # Need to retry task. Lock was NOT acquired when the error occur.\n # Don't change payload or datastore.\n RETRY_TASK=\"retry_task\",\n # Need to retry task. Lock was acquired when the error occurr.\n # Don't change payload or datastore.\n RETRY_SLICE=\"retry_slice\",\n # Drop the task (due to duplicated task). Must log permanent drop.\n DROP_TASK=\"drop_task\",\n # See handlers.MapperWorkerCallbackHandler._attempt_slice_recovery.\n RECOVER_SLICE=\"recover_slice\",\n # Need to retry the shard.\n RETRY_SHARD=\"retry_shard\",\n # Need to drop task and fail the shard. Log permanent failure.\n FAIL_TASK=\"fail_task\",\n # Need to abort the shard.\n ABORT_SHARD=\"abort_shard\")\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 # Deprecated. Only used by old test cases.\n # TODO(user): clean up tests.", "metadata": "root.MapperWorkerCallbackHandler", "header": "['module', '___EOS___']", "index": 108 }, { "content": " def __init__(self, *args):\n \"\"\"Constructor.\"\"\"\n super(MapperWorkerCallbackHandler, self).__init__(*args)\n self._time = time.time\n self.slice_context = None\n self.shard_context = None", "metadata": "root.MapperWorkerCallbackHandler.__init__", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 132 }, { "content": " def _drop_gracefully(self):\n \"\"\"Drop worker task gracefully.\n\n Set current shard_state to failed. Controller logic will take care of\n other shards and the entire MR.\n \"\"\"\n shard_id = self.request.headers[util._MR_SHARD_ID_TASK_HEADER]\n mr_id = self.request.headers[util._MR_ID_TASK_HEADER]\n shard_state, mr_state = db.get([\n model.ShardState.get_key_by_shard_id(shard_id),\n model.MapreduceState.get_key_by_job_id(mr_id)])\n\n if shard_state and shard_state.active:\n shard_state.set_for_failure()\n config = util.create_datastore_write_config(mr_state.mapreduce_spec)\n shard_state.put(config=config)", "metadata": "root.MapperWorkerCallbackHandler._drop_gracefully", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 139 }, { "content": " def _try_acquire_lease(self, shard_state, tstate):\n \"\"\"Validate datastore and the task payload are consistent.\n\n If so, attempt to get a lease on this slice's execution.\n See model.ShardState doc on slice_start_time.\n\n Args:\n shard_state: model.ShardState from datastore.\n tstate: model.TransientShardState from taskqueue paylod.\n\n Returns:\n A _TASK_DIRECTIVE enum. PROCEED_TASK if lock is acquired.\n RETRY_TASK if task should be retried, DROP_TASK if task should\n be dropped. Only old tasks (comparing to datastore state)\n will be dropped. Future tasks are retried until they naturally\n become old so that we don't ever stuck MR.\n \"\"\"\n # Controller will tally shard_states and properly handle the situation.\n if not shard_state:\n logging.warning(\"State not found for shard %s; Possible spurious task \"\n \"execution. Dropping this task.\",\n tstate.shard_id)\n return self._TASK_DIRECTIVE.DROP_TASK\n\n if not shard_state.active:\n logging.warning(\"Shard %s is not active. Possible spurious task \"\n \"execution. Dropping this task.\", tstate.shard_id)\n logging.warning(str(shard_state))\n return self._TASK_DIRECTIVE.DROP_TASK\n\n # Validate shard retry count.\n if shard_state.retries > tstate.retries:\n logging.warning(\n \"Got shard %s from previous shard retry %s. Possible spurious \"\n \"task execution. Dropping this task.\",\n tstate.shard_id,\n tstate.retries)\n logging.warning(str(shard_state))\n return self._TASK_DIRECTIVE.DROP_TASK\n elif shard_state.retries < tstate.retries:\n # By the end of last slice, task enqueue succeeded but datastore commit\n # failed. That transaction will be retried and adding the same task\n # will pass.\n logging.warning(\n \"ShardState for %s is behind slice. Waiting for it to catch up\",\n shard_state.shard_id)\n return self._TASK_DIRECTIVE.RETRY_TASK\n\n # Validate slice id.\n # Taskqueue executes old successful tasks.\n if shard_state.slice_id > tstate.slice_id:\n logging.warning(\n \"Task %s-%s is behind ShardState %s. Dropping task.\"\"\",\n tstate.shard_id, tstate.slice_id, shard_state.slice_id)\n return self._TASK_DIRECTIVE.DROP_TASK\n # By the end of last slice, task enqueue succeeded but datastore commit\n # failed. That transaction will be retried and adding the same task\n # will pass. User data is duplicated in this case.\n elif shard_state.slice_id < tstate.slice_id:\n logging.warning(\n \"Task %s-%s is ahead of ShardState %s. Waiting for it to catch up.\",\n tstate.shard_id, tstate.slice_id, shard_state.slice_id)\n return self._TASK_DIRECTIVE.RETRY_TASK\n\n # Check potential duplicated tasks for the same slice.\n # See model.ShardState doc.\n if shard_state.slice_start_time:\n countdown = self._wait_time(shard_state,\n parameters._LEASE_DURATION_SEC)\n if countdown > 0:\n logging.warning(\n \"Last retry of slice %s-%s may be still running.\"\n \"Will try again in %s seconds\", tstate.shard_id, tstate.slice_id,\n countdown)\n # TODO(user): There might be a better way. Taskqueue's countdown\n # only applies to add new tasks, not retry of tasks.\n # Reduce contention.\n time.sleep(countdown)\n return self._TASK_DIRECTIVE.RETRY_TASK\n # lease could have expired. Verify with logs API.\n else:\n if self._wait_time(shard_state,\n parameters._MAX_LEASE_DURATION_SEC):\n if not self._has_old_request_ended(shard_state):\n logging.warning(\n \"Last retry of slice %s-%s is still in flight with request_id \"\n \"%s. Will try again later.\", tstate.shard_id, tstate.slice_id,\n shard_state.slice_request_id)\n return self._TASK_DIRECTIVE.RETRY_TASK\n else:\n logging.warning(\n \"Last retry of slice %s-%s has no log entry and has\"\n \"timed out after %s seconds\",\n tstate.shard_id, tstate.slice_id,\n parameters._MAX_LEASE_DURATION_SEC)\n\n # Lease expired or slice_start_time not set.\n config = util.create_datastore_write_config(tstate.mapreduce_spec)\n @db.transactional(retries=5)\n def _tx():\n \"\"\"Use datastore to set slice_start_time to now.\n\n If failed for any reason, raise error to retry the task (hence all\n the previous validation code). The task would die naturally eventually.\n\n Raises:\n Rollback: If the shard state is missing.\n\n Returns:\n A _TASK_DIRECTIVE enum.\n \"\"\"\n fresh_state = model.ShardState.get_by_shard_id(tstate.shard_id)\n if not fresh_state:\n logging.warning(\"ShardState missing.\")\n raise db.Rollback()\n if (fresh_state.active and\n fresh_state.slice_id == shard_state.slice_id and\n fresh_state.slice_start_time == shard_state.slice_start_time):\n shard_state.slice_start_time = datetime.datetime.now()\n shard_state.slice_request_id = os.environ.get(\"REQUEST_LOG_ID\")\n shard_state.acquired_once = True\n shard_state.put(config=config)\n return self._TASK_DIRECTIVE.PROCEED_TASK\n else:\n logging.warning(\n \"Contention on slice %s-%s execution. Will retry again.\",\n tstate.shard_id, tstate.slice_id)\n # One proposer should win. In case all lost, back off arbitrarily.\n time.sleep(random.randrange(1, 5))\n return self._TASK_DIRECTIVE.RETRY_TASK\n\n return _tx()", "metadata": "root.MapperWorkerCallbackHandler._try_acquire_lease", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 156 }, { "content": " def _has_old_request_ended(self, shard_state):\n \"\"\"Whether previous slice retry has ended according to Logs API.\n\n Args:\n shard_state: shard state.\n\n Returns:\n True if the request of previous slice retry has ended. False if it has\n not or unknown.\n \"\"\"\n assert shard_state.slice_start_time is not None\n assert shard_state.slice_request_id is not None\n request_ids = [shard_state.slice_request_id]\n logs = None\n try:\n logs = list(logservice.fetch(request_ids=request_ids))\n except (apiproxy_errors.FeatureNotEnabledError,\n apiproxy_errors.CapabilityDisabledError) as e:\n # Managed VMs do not have access to the logservice API\n # See https://groups.google.com/forum/#!topic/app-engine-managed-vms/r8i65uiFW0w\n logging.warning(\"Ignoring exception: %s\", e)\n\n if not logs or not logs[0].finished:\n return False\n return True", "metadata": "root.MapperWorkerCallbackHandler._has_old_request_ended", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 289 }, { "content": " def _wait_time(self, shard_state, secs, now=datetime.datetime.now):\n \"\"\"Time to wait until slice_start_time is secs ago from now.\n\n Args:\n shard_state: shard state.\n secs: duration in seconds.\n now: a func that gets now.\n\n Returns:\n 0 if no wait. A positive int in seconds otherwise. Always around up.\n \"\"\"\n assert shard_state.slice_start_time is not None\n delta = now() - shard_state.slice_start_time\n duration = datetime.timedelta(seconds=secs)\n if delta < duration:\n return util.total_seconds(duration - delta)\n else:\n return 0", "metadata": "root.MapperWorkerCallbackHandler._wait_time", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 315 }, { "content": " def _try_free_lease(self, shard_state, slice_retry=False):\n \"\"\"Try to free lease.\n\n A lightweight transaction to update shard_state and unset\n slice_start_time to allow the next retry to happen without blocking.\n We don't care if this fails or not because the lease will expire\n anyway.\n\n Under normal execution, _save_state_and_schedule_next is the exit point.\n It updates/saves shard state and schedules the next slice or returns.\n Other exit points are:\n 1. _are_states_consistent: at the beginning of handle, checks\n if datastore states and the task are in sync.\n If not, raise or return.\n 2. _attempt_slice_retry: may raise exception to taskqueue.\n 3. _save_state_and_schedule_next: may raise exception when taskqueue/db\n unreachable.\n\n This handler should try to free the lease on every exceptional exit point.\n\n Args:\n shard_state: model.ShardState.\n slice_retry: whether to count this as a failed slice execution.\n \"\"\"\n @db.transactional\n def _tx():\n fresh_state = model.ShardState.get_by_shard_id(shard_state.shard_id)\n if fresh_state and fresh_state.active:\n # Free lease.\n fresh_state.slice_start_time = None\n fresh_state.slice_request_id = None\n if slice_retry:\n fresh_state.slice_retries += 1\n fresh_state.put()\n try:\n _tx()\n # pylint: disable=broad-except\n except Exception, e:\n logging.warning(e)\n logging.warning(\n \"Release lock for shard %s failed. Wait for lease to expire.\",\n shard_state.shard_id)", "metadata": "root.MapperWorkerCallbackHandler._try_free_lease", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 334 }, { "content": " def _maintain_LC(self, obj, slice_id, last_slice=False, begin_slice=True,\n shard_ctx=None, slice_ctx=None):\n \"\"\"Makes sure shard life cycle interface are respected.\n\n Args:\n obj: the obj that may have implemented _ShardLifeCycle.\n slice_id: current slice_id\n last_slice: whether this is the last slice.\n begin_slice: whether this is the beginning or the end of a slice.\n shard_ctx: shard ctx for dependency injection. If None, it will be read\n from self.\n slice_ctx: slice ctx for dependency injection. If None, it will be read\n from self.\n \"\"\"\n if obj is None or not isinstance(obj, shard_life_cycle._ShardLifeCycle):\n return\n\n shard_context = shard_ctx or self.shard_context\n slice_context = slice_ctx or self.slice_context\n if begin_slice:\n if slice_id == 0:\n obj.begin_shard(shard_context)\n obj.begin_slice(slice_context)\n else:\n obj.end_slice(slice_context)\n if last_slice:\n obj.end_shard(shard_context)", "metadata": "root.MapperWorkerCallbackHandler._maintain_LC", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 377 }, { "content": " def _lc_start_slice(self, tstate, slice_id):\n self._maintain_LC(tstate.output_writer, slice_id)\n self._maintain_LC(tstate.input_reader, slice_id)\n self._maintain_LC(tstate.handler, slice_id)", "metadata": "root.MapperWorkerCallbackHandler._lc_start_slice", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 405 }, { "content": " def _lc_end_slice(self, tstate, slice_id, last_slice=False):\n self._maintain_LC(tstate.handler, slice_id, last_slice=last_slice,\n begin_slice=False)\n self._maintain_LC(tstate.input_reader, slice_id, last_slice=last_slice,\n begin_slice=False)\n self._maintain_LC(tstate.output_writer, slice_id, last_slice=last_slice,\n begin_slice=False)", "metadata": "root.MapperWorkerCallbackHandler._lc_end_slice", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 410 }, { "content": " def handle(self):\n \"\"\"Handle request.\n\n This method has to be careful to pass the same ShardState instance to\n its subroutines calls if the calls mutate or read from ShardState.\n Note especially that Context instance caches and updates the ShardState\n instance.\n\n Returns:\n Set HTTP status code and always returns None.\n \"\"\"\n # Reconstruct basic states.\n self._start_time = self._time()\n shard_id = self.request.headers[util._MR_SHARD_ID_TASK_HEADER]\n mr_id = self.request.headers[util._MR_ID_TASK_HEADER]\n spec = model.MapreduceSpec._get_mapreduce_spec(mr_id)\n shard_state, control = db.get([\n model.ShardState.get_key_by_shard_id(shard_id),\n model.MapreduceControl.get_key_by_job_id(mr_id),\n ])\n\n # Set context before any IO code is called.\n ctx = context.Context(spec, shard_state,\n task_retry_count=self.task_retry_count())\n context.Context._set(ctx)\n\n # Unmarshall input reader, output writer, and other transient states.\n tstate = model.TransientShardState.from_request(self.request)\n\n # Try acquire a lease on the shard.\n if shard_state:\n is_this_a_retry = shard_state.acquired_once\n task_directive = self._try_acquire_lease(shard_state, tstate)\n if task_directive in (self._TASK_DIRECTIVE.RETRY_TASK,\n self._TASK_DIRECTIVE.DROP_TASK):\n return self.__return(shard_state, tstate, task_directive)\n assert task_directive == self._TASK_DIRECTIVE.PROCEED_TASK\n\n # Abort shard if received signal.\n if control and control.command == model.MapreduceControl.ABORT:\n task_directive = self._TASK_DIRECTIVE.ABORT_SHARD\n return self.__return(shard_state, tstate, task_directive)\n\n # Retry shard if user disabled slice retry.\n if (is_this_a_retry and\n parameters.config.TASK_MAX_DATA_PROCESSING_ATTEMPTS <= 1):\n task_directive = self._TASK_DIRECTIVE.RETRY_SHARD\n return self.__return(shard_state, tstate, task_directive)\n\n # TODO(user): Find a better way to set these per thread configs.\n # E.g. what if user change it?\n util._set_ndb_cache_policy()\n\n job_config = map_job.JobConfig._to_map_job_config(\n spec,\n os.environ.get(\"HTTP_X_APPENGINE_QUEUENAME\"))\n job_context = map_job_context.JobContext(job_config)\n self.shard_context = map_job_context.ShardContext(job_context, shard_state)\n self.slice_context = map_job_context.SliceContext(self.shard_context,\n shard_state,\n tstate)\n try:\n slice_id = tstate.slice_id\n self._lc_start_slice(tstate, slice_id)\n\n if shard_state.is_input_finished():\n self._lc_end_slice(tstate, slice_id, last_slice=True)\n # Finalize the stream and set status if there's no more input.\n if (tstate.output_writer and\n isinstance(tstate.output_writer, output_writers.OutputWriter)):\n # It's possible that finalization is successful but\n # saving state failed. In this case this shard will retry upon\n # finalization error.\n # TODO(user): make finalize method idempotent!\n tstate.output_writer.finalize(ctx, shard_state)\n shard_state.set_for_success()\n return self.__return(shard_state, tstate, task_directive)\n\n if is_this_a_retry:\n task_directive = self._attempt_slice_recovery(shard_state, tstate)\n if task_directive != self._TASK_DIRECTIVE.PROCEED_TASK:\n return self.__return(shard_state, tstate, task_directive)\n\n last_slice = self._process_inputs(\n tstate.input_reader, shard_state, tstate, ctx)\n\n self._lc_end_slice(tstate, slice_id)\n\n ctx.flush()\n\n if last_slice:\n # We're done processing data but we still need to finalize the output\n # stream. We save this condition in datastore and force a new slice.\n # That way if finalize fails no input data will be retried.\n shard_state.set_input_finished()\n # pylint: disable=broad-except\n except Exception, e:\n logging.warning(\"Shard %s got error.\", shard_state.shard_id)\n logging.error(traceback.format_exc())\n\n # Fail fast.\n if type(e) is errors.FailJobError:\n logging.error(\"Got FailJobError.\")\n task_directive = self._TASK_DIRECTIVE.FAIL_TASK\n else:\n task_directive = self._TASK_DIRECTIVE.RETRY_SLICE\n\n self.__return(shard_state, tstate, task_directive)", "metadata": "root.MapperWorkerCallbackHandler.handle", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 418 }, { "content": " def __return(self, shard_state, tstate, task_directive):\n \"\"\"Handler should always call this as the last statement.\"\"\"\n task_directive = self._set_state(shard_state, tstate, task_directive)\n self._save_state_and_schedule_next(shard_state, tstate, task_directive)\n context.Context._set(None)", "metadata": "root.MapperWorkerCallbackHandler.__return", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 527 }, { "content": " def _process_inputs(self,\n input_reader,\n shard_state,\n tstate,\n ctx):\n \"\"\"Read inputs, process them, and write out outputs.\n\n This is the core logic of MapReduce. It reads inputs from input reader,\n invokes user specified mapper function, and writes output with\n output writer. It also updates shard_state accordingly.\n e.g. if shard processing is done, set shard_state.active to False.\n\n If errors.FailJobError is caught, it will fail this MR job.\n All other exceptions will be logged and raised to taskqueue for retry\n until the number of retries exceeds a limit.\n\n Args:\n input_reader: input reader.\n shard_state: shard state.\n tstate: transient shard state.\n ctx: mapreduce context.\n\n Returns:\n Whether this shard has finished processing all its input split.\n \"\"\"\n processing_limit = self._processing_limit(tstate.mapreduce_spec)\n if processing_limit == 0:\n return\n\n finished_shard = True\n # Input reader may not be an iterator. It is only a container.\n iterator = iter(input_reader)\n\n while True:\n try:\n entity = iterator.next()\n except StopIteration:\n break\n # Reading input got exception. If we assume\n # 1. The input reader have done enough retries.\n # 2. The input reader can still serialize correctly after this exception.\n # 3. The input reader, upon resume, will try to re-read this failed\n # record.\n # 4. This exception doesn't imply the input reader is permanently stuck.\n # we can serialize current slice immediately to avoid duplicated\n # outputs.\n # TODO(user): Validate these assumptions on all readers. MR should\n # also have a way to detect fake forward progress.\n\n if isinstance(entity, db.Model):\n shard_state.last_work_item = repr(entity.key())\n elif isinstance(entity, ndb.Model):\n shard_state.last_work_item = repr(entity.key)\n else:\n shard_state.last_work_item = repr(entity)[:100]\n\n processing_limit -= 1\n\n if not self._process_datum(\n entity, input_reader, ctx, tstate):\n finished_shard = False\n break\n elif processing_limit == 0:\n finished_shard = False\n break\n\n # Flush context and its pools.\n self.slice_context.incr(\n context.COUNTER_MAPPER_WALLTIME_MS,\n int((self._time() - self._start_time)*1000))\n\n return finished_shard", "metadata": "root.MapperWorkerCallbackHandler._process_inputs", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 533 }, { "content": " def _process_datum(self, data, input_reader, ctx, transient_shard_state):\n \"\"\"Process a single data piece.\n\n Call mapper handler on the data.\n\n Args:\n data: a datum to process.\n input_reader: input reader.\n ctx: mapreduce context\n transient_shard_state: transient shard state.\n\n Returns:\n True if scan should be continued, False if scan should be stopped.\n \"\"\"\n if data is not input_readers.ALLOW_CHECKPOINT:\n self.slice_context.incr(context.COUNTER_MAPPER_CALLS)\n\n handler = transient_shard_state.handler\n\n if isinstance(handler, map_job.Mapper):\n handler(self.slice_context, data)\n else:\n if input_reader.expand_parameters:\n result = handler(*data)\n else:\n result = handler(data)\n\n if util.is_generator(result):\n for output in result:\n if isinstance(output, operation.Operation):\n output(ctx)\n else:\n output_writer = transient_shard_state.output_writer\n if not output_writer:\n logging.warning(\n \"Handler yielded %s, but no output writer is set.\", output)\n else:\n output_writer.write(output)\n\n if self._time() - self._start_time >= parameters.config._SLICE_DURATION_SEC:\n return False\n return True", "metadata": "root.MapperWorkerCallbackHandler._process_datum", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 606 }, { "content": " def _set_state(self, shard_state, tstate, task_directive):\n \"\"\"Set shard_state and tstate based on task_directive.\n\n Args:\n shard_state: model.ShardState for current shard.\n tstate: model.TransientShardState for current shard.\n task_directive: self._TASK_DIRECTIVE for current shard.\n\n Returns:\n A _TASK_DIRECTIVE enum.\n PROCEED_TASK if task should proceed normally.\n RETRY_SHARD if shard should be retried.\n RETRY_SLICE if slice should be retried.\n FAIL_TASK if sahrd should fail.\n RECOVER_SLICE if slice should be recovered.\n ABORT_SHARD if shard should be aborted.\n RETRY_TASK if task should be retried.\n DROP_TASK if task should be dropped.\n \"\"\"\n if task_directive in (self._TASK_DIRECTIVE.RETRY_TASK,\n self._TASK_DIRECTIVE.DROP_TASK):\n return task_directive\n\n if task_directive == self._TASK_DIRECTIVE.ABORT_SHARD:\n shard_state.set_for_abort()\n return task_directive\n\n if task_directive == self._TASK_DIRECTIVE.PROCEED_TASK:\n shard_state.advance_for_next_slice()\n tstate.advance_for_next_slice()\n return task_directive\n\n if task_directive == self._TASK_DIRECTIVE.RECOVER_SLICE:\n tstate.advance_for_next_slice(recovery_slice=True)\n shard_state.advance_for_next_slice(recovery_slice=True)\n return task_directive\n\n if task_directive == self._TASK_DIRECTIVE.RETRY_SLICE:\n task_directive = self._attempt_slice_retry(shard_state, tstate)\n if task_directive == self._TASK_DIRECTIVE.RETRY_SHARD:\n task_directive = self._attempt_shard_retry(shard_state, tstate)\n if task_directive == self._TASK_DIRECTIVE.FAIL_TASK:\n shard_state.set_for_failure()\n\n return task_directive", "metadata": "root.MapperWorkerCallbackHandler._set_state", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 649 }, { "content": " def _save_state_and_schedule_next(self, shard_state, tstate, task_directive):\n \"\"\"Save state and schedule task.\n\n Save shard state to datastore.\n Schedule next slice if needed.\n Set HTTP response code.\n No modification to any shard_state or tstate.\n\n Args:\n shard_state: model.ShardState for current shard.\n tstate: model.TransientShardState for current shard.\n task_directive: enum _TASK_DIRECTIVE.\n\n Returns:\n The task to retry if applicable.\n \"\"\"\n spec = tstate.mapreduce_spec\n\n if task_directive == self._TASK_DIRECTIVE.DROP_TASK:\n return\n if task_directive in (self._TASK_DIRECTIVE.RETRY_SLICE,\n self._TASK_DIRECTIVE.RETRY_TASK):\n # Set HTTP code to 500.\n return self.retry_task()\n elif task_directive == self._TASK_DIRECTIVE.ABORT_SHARD:\n logging.info(\"Aborting shard %d of job '%s'\",\n shard_state.shard_number, shard_state.mapreduce_id)\n task = None\n elif task_directive == self._TASK_DIRECTIVE.FAIL_TASK:\n logging.critical(\"Shard %s failed permanently.\", shard_state.shard_id)\n task = None\n elif task_directive == self._TASK_DIRECTIVE.RETRY_SHARD:\n logging.warning(\"Shard %s is going to be attempted for the %s time.\",\n shard_state.shard_id,\n shard_state.retries + 1)\n task = self._state_to_task(tstate, shard_state)\n elif task_directive == self._TASK_DIRECTIVE.RECOVER_SLICE:\n logging.warning(\"Shard %s slice %s is being recovered.\",\n shard_state.shard_id,\n shard_state.slice_id)\n task = self._state_to_task(tstate, shard_state)\n else:\n assert task_directive == self._TASK_DIRECTIVE.PROCEED_TASK\n countdown = self._get_countdown_for_next_slice(spec)\n task = self._state_to_task(tstate, shard_state, countdown=countdown)\n\n # Prepare parameters for db transaction and taskqueue.\n queue_name = os.environ.get(\"HTTP_X_APPENGINE_QUEUENAME\",\n # For test only.\n # TODO(user): Remove this.\n \"default\")\n config = util.create_datastore_write_config(spec)\n\n @db.transactional(retries=5)\n def _tx():\n \"\"\"The Transaction helper.\"\"\"\n fresh_shard_state = model.ShardState.get_by_shard_id(tstate.shard_id)\n if not fresh_shard_state:\n raise db.Rollback()\n if (not fresh_shard_state.active or\n \"worker_active_state_collision\" in _TEST_INJECTED_FAULTS):\n logging.warning(\"Shard %s is not active. Possible spurious task \"\n \"execution. Dropping this task.\", tstate.shard_id)\n logging.warning(\"Datastore's %s\", str(fresh_shard_state))\n logging.warning(\"Slice's %s\", str(shard_state))\n return\n fresh_shard_state.copy_from(shard_state)\n fresh_shard_state.put(config=config)\n # Add task in the same datastore transaction.\n # This way we guarantee taskqueue is never behind datastore states.\n # Old tasks will be dropped.\n # Future task won't run until datastore states catches up.\n if fresh_shard_state.active:\n # Not adding task transactionally.\n # transactional enqueue requires tasks with no name.\n self._add_task(task, spec, queue_name)\n\n try:\n _tx()\n except (datastore_errors.Error,\n taskqueue.Error,\n runtime.DeadlineExceededError,\n apiproxy_errors.Error), e:\n logging.warning(\n \"Can't transactionally continue shard. \"\n \"Will retry slice %s %s for the %s time.\",\n tstate.shard_id,\n tstate.slice_id,\n self.task_retry_count() + 1)\n self._try_free_lease(shard_state)\n raise e", "metadata": "root.MapperWorkerCallbackHandler._save_state_and_schedule_next", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 695 }, { "content": " def _attempt_slice_recovery(self, shard_state, tstate):\n \"\"\"Recover a slice.\n\n This is run when a slice had been previously attempted and output\n may have been written. If an output writer requires slice recovery,\n we run those logic to remove output duplicates. Otherwise we just retry\n the slice.\n\n If recovery is needed, then the entire slice will be dedicated\n to recovery logic. No data processing will take place. Thus we call\n the slice \"recovery slice\". This is needed for correctness:\n An output writer instance can be out of sync from its physical\n medium only when the slice dies after acquring the shard lock but before\n committing shard state to db. The worst failure case is when\n shard state failed to commit after the NAMED task for the next slice was\n added. Thus, recovery slice has a special logic to increment current\n slice_id n to n+2. If the task for n+1 had been added, it will be dropped\n because it is behind shard state.\n\n Args:\n shard_state: an instance of Model.ShardState.\n tstate: an instance of Model.TransientShardState.\n\n Returns:\n _TASK_DIRECTIVE.PROCEED_TASK to continue with this retry.\n _TASK_DIRECTIVE.RECOVER_SLICE to recover this slice.\n The next slice will start at the same input as\n this slice but output to a new instance of output writer.\n Combining outputs from all writer instances is up to implementation.\n \"\"\"\n mapper_spec = tstate.mapreduce_spec.mapper\n if not (tstate.output_writer and\n tstate.output_writer._supports_slice_recovery(mapper_spec)):\n return self._TASK_DIRECTIVE.PROCEED_TASK\n\n tstate.output_writer = tstate.output_writer._recover(\n tstate.mapreduce_spec, shard_state.shard_number,\n shard_state.retries + 1)\n return self._TASK_DIRECTIVE.RECOVER_SLICE", "metadata": "root.MapperWorkerCallbackHandler._attempt_slice_recovery", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 787 }, { "content": " def _attempt_shard_retry(self, shard_state, tstate):\n \"\"\"Whether to retry shard.\n\n This method may modify shard_state and tstate to prepare for retry or fail.\n\n Args:\n shard_state: model.ShardState for current shard.\n tstate: model.TransientShardState for current shard.\n\n Returns:\n A _TASK_DIRECTIVE enum. RETRY_SHARD if shard should be retried.\n FAIL_TASK otherwise.\n \"\"\"\n shard_attempts = shard_state.retries + 1\n\n if shard_attempts >= parameters.config.SHARD_MAX_ATTEMPTS:\n logging.warning(\n \"Shard attempt %s exceeded %s max attempts.\",\n shard_attempts, parameters.config.SHARD_MAX_ATTEMPTS)\n return self._TASK_DIRECTIVE.FAIL_TASK\n if tstate.output_writer and (\n not tstate.output_writer._supports_shard_retry(tstate)):\n logging.warning(\"Output writer %s does not support shard retry.\",\n tstate.output_writer.__class__.__name__)\n return self._TASK_DIRECTIVE.FAIL_TASK\n\n shard_state.reset_for_retry()\n logging.warning(\"Shard %s attempt %s failed with up to %s attempts.\",\n shard_state.shard_id,\n shard_state.retries,\n parameters.config.SHARD_MAX_ATTEMPTS)\n output_writer = None\n if tstate.output_writer:\n output_writer = tstate.output_writer.create(\n tstate.mapreduce_spec, shard_state.shard_number, shard_attempts + 1)\n tstate.reset_for_retry(output_writer)\n return self._TASK_DIRECTIVE.RETRY_SHARD", "metadata": "root.MapperWorkerCallbackHandler._attempt_shard_retry", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 827 }, { "content": " def _attempt_slice_retry(self, shard_state, tstate):\n \"\"\"Attempt to retry this slice.\n\n This method may modify shard_state and tstate to prepare for retry or fail.\n\n Args:\n shard_state: model.ShardState for current shard.\n tstate: model.TransientShardState for current shard.\n\n Returns:\n A _TASK_DIRECTIVE enum. RETRY_SLICE if slice should be retried.\n RETRY_SHARD if shard retry should be attempted.\n \"\"\"\n if (shard_state.slice_retries + 1 <\n parameters.config.TASK_MAX_DATA_PROCESSING_ATTEMPTS):\n logging.warning(\n \"Slice %s %s failed for the %s of up to %s attempts \"\n \"(%s of %s taskqueue execution attempts). \"\n \"Will retry now.\",\n tstate.shard_id,\n tstate.slice_id,\n shard_state.slice_retries + 1,\n parameters.config.TASK_MAX_DATA_PROCESSING_ATTEMPTS,\n self.task_retry_count() + 1,\n parameters.config.TASK_MAX_ATTEMPTS)\n # Clear info related to current exception. Otherwise, the real\n # callstack that includes a frame for this method will show up\n # in log.\n sys.exc_clear()\n self._try_free_lease(shard_state, slice_retry=True)\n return self._TASK_DIRECTIVE.RETRY_SLICE\n\n if parameters.config.TASK_MAX_DATA_PROCESSING_ATTEMPTS > 0:\n logging.warning(\"Slice attempt %s exceeded %s max attempts.\",\n self.task_retry_count() + 1,\n parameters.config.TASK_MAX_DATA_PROCESSING_ATTEMPTS)\n return self._TASK_DIRECTIVE.RETRY_SHARD", "metadata": "root.MapperWorkerCallbackHandler._attempt_slice_retry", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 865 }, { "content": " @staticmethod\n def get_task_name(shard_id, slice_id, retry=0):\n \"\"\"Compute single worker task name.\n\n Args:\n shard_id: shard id.\n slice_id: slice id.\n retry: current shard retry count.\n\n Returns:\n task name which should be used to process specified shard/slice.\n \"\"\"\n # Prefix the task name with something unique to this framework's\n # namespace so we don't conflict with user tasks on the queue.\n return \"appengine-mrshard-%s-%s-retry-%s\" % (\n shard_id, slice_id, retry)", "metadata": "root.MapperWorkerCallbackHandler.get_task_name", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 903 }, { "content": " def _get_countdown_for_next_slice(self, spec):\n \"\"\"Get countdown for next slice's task.\n\n When user sets processing rate, we set countdown to delay task execution.\n\n Args:\n spec: model.MapreduceSpec\n\n Returns:\n countdown in int.\n \"\"\"\n countdown = 0\n if self._processing_limit(spec) != -1:\n countdown = max(\n int(parameters.config._SLICE_DURATION_SEC -\n (self._time() - self._start_time)), 0)\n return countdown", "metadata": "root.MapperWorkerCallbackHandler._get_countdown_for_next_slice", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 920 }, { "content": " @classmethod\n def _state_to_task(cls,\n tstate,\n shard_state,\n eta=None,\n countdown=None):\n \"\"\"Generate task for slice according to current states.\n\n Args:\n tstate: An instance of TransientShardState.\n shard_state: An instance of ShardState.\n eta: Absolute time when the MR should execute. May not be specified\n if 'countdown' is also supplied. This may be timezone-aware or\n timezone-naive.\n countdown: Time in seconds into the future that this MR should execute.\n Defaults to zero.\n\n Returns:\n A model.HugeTask instance for the slice specified by current states.\n \"\"\"\n base_path = tstate.base_path\n\n task_name = MapperWorkerCallbackHandler.get_task_name(\n tstate.shard_id,\n tstate.slice_id,\n tstate.retries)\n\n headers = util._get_task_headers(tstate.mapreduce_spec.mapreduce_id)\n headers[util._MR_SHARD_ID_TASK_HEADER] = tstate.shard_id\n\n worker_task = model.HugeTask(\n url=base_path + \"/worker_callback/\" + tstate.shard_id,\n params=tstate.to_dict(),\n name=task_name,\n eta=eta,\n countdown=countdown,\n parent=shard_state,\n headers=headers)\n return worker_task", "metadata": "root.MapperWorkerCallbackHandler._state_to_task", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 938 }, { "content": " @classmethod\n def _add_task(cls,\n worker_task,\n mapreduce_spec,\n queue_name):\n \"\"\"Schedule slice scanning by adding it to the task queue.\n\n Args:\n worker_task: a model.HugeTask task for slice. This is NOT a taskqueue\n task.\n mapreduce_spec: an instance of model.MapreduceSpec.\n queue_name: Optional queue to run on; uses the current queue of\n execution or the default queue if unspecified.\n \"\"\"\n if not _run_task_hook(mapreduce_spec.get_hooks(),\n \"enqueue_worker_task\",\n worker_task,\n queue_name):\n try:\n # Not adding transactionally because worker_task has name.\n # Named task is not allowed for transactional add.\n worker_task.add(queue_name)\n except (taskqueue.TombstonedTaskError,\n taskqueue.TaskAlreadyExistsError), e:\n logging.warning(\"Task %r already exists. %s: %s\",\n worker_task.name,\n e.__class__,\n e)", "metadata": "root.MapperWorkerCallbackHandler._add_task", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 978 }, { "content": " def _processing_limit(self, spec):\n \"\"\"Get the limit on the number of map calls allowed by this slice.\n\n Args:\n spec: a Mapreduce spec.\n\n Returns:\n The limit as a positive int if specified by user. -1 otherwise.\n \"\"\"\n processing_rate = float(spec.mapper.params.get(\"processing_rate\", 0))\n slice_processing_limit = -1\n if processing_rate > 0:\n slice_processing_limit = int(math.ceil(\n parameters.config._SLICE_DURATION_SEC*processing_rate/\n int(spec.mapper.shard_count)))\n return slice_processing_limit", "metadata": "root.MapperWorkerCallbackHandler._processing_limit", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1007 }, { "content": " @classmethod\n def _schedule_slice(cls,\n shard_state,\n tstate,\n queue_name=None,\n eta=None,\n countdown=None):\n \"\"\"Schedule slice scanning by adding it to the task queue.\n\n Args:\n shard_state: An instance of ShardState.\n tstate: An instance of TransientShardState.\n queue_name: Optional queue to run on; uses the current queue of\n execution or the default queue if unspecified.\n eta: Absolute time when the MR should execute. May not be specified\n if 'countdown' is also supplied. This may be timezone-aware or\n timezone-naive.\n countdown: Time in seconds into the future that this MR should execute.\n Defaults to zero.\n \"\"\"\n queue_name = queue_name or os.environ.get(\"HTTP_X_APPENGINE_QUEUENAME\",\n \"default\")\n task = cls._state_to_task(tstate, shard_state, eta, countdown)\n cls._add_task(task, tstate.mapreduce_spec, queue_name)", "metadata": "root.MapperWorkerCallbackHandler._schedule_slice", "header": "['class', 'MapperWorkerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1026 }, { "content": "class ControllerCallbackHandler(base_handler.HugeTaskHandler):\n \"\"\"Supervises mapreduce execution.\n\n Is also responsible for gathering execution status from shards together.\n\n This task is \"continuously\" running by adding itself again to taskqueue if\n and only if mapreduce is still active. A mapreduce is active if it has\n actively running shards.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ControllerCallbackHandler", "header": "['module', '___EOS___']", "index": 1052 }, { "content": " def __init__(self, *args):\n \"\"\"Constructor.\"\"\"\n super(ControllerCallbackHandler, self).__init__(*args)\n self._time = time.time", "metadata": "root.ControllerCallbackHandler.__init__", "header": "['class', 'ControllerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1062 }, { "content": " def _drop_gracefully(self):\n \"\"\"Gracefully drop controller task.\n\n This method is called when decoding controller task payload failed.\n Upon this we mark ShardState and MapreduceState as failed so all\n tasks can stop.\n\n Writing to datastore is forced (ignore read-only mode) because we\n want the tasks to stop badly, and if force_writes was False,\n the job would have never been started.\n \"\"\"\n mr_id = self.request.headers[util._MR_ID_TASK_HEADER]\n state = model.MapreduceState.get_by_job_id(mr_id)\n if not state or not state.active:\n return\n\n state.active = False\n state.result_status = model.MapreduceState.RESULT_FAILED\n config = util.create_datastore_write_config(state.mapreduce_spec)\n puts = []\n for ss in model.ShardState.find_all_by_mapreduce_state(state):\n if ss.active:\n ss.set_for_failure()\n puts.append(ss)\n # Avoid having too many shard states in memory.\n if len(puts) > model.ShardState._MAX_STATES_IN_MEMORY:\n db.put(puts, config=config)\n puts = []\n db.put(puts, config=config)\n # Put mr_state only after all shard_states are put.\n db.put(state, config=config)", "metadata": "root.ControllerCallbackHandler._drop_gracefully", "header": "['class', 'ControllerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1067 }, { "content": " def handle(self):\n \"\"\"Handle request.\"\"\"\n spec = model.MapreduceSpec.from_json_str(\n self.request.get(\"mapreduce_spec\"))\n state, control = db.get([\n model.MapreduceState.get_key_by_job_id(spec.mapreduce_id),\n model.MapreduceControl.get_key_by_job_id(spec.mapreduce_id),\n ])\n\n if not state:\n logging.warning(\"State not found for MR '%s'; dropping controller task.\",\n spec.mapreduce_id)\n return\n if not state.active:\n logging.warning(\n \"MR %r is not active. Looks like spurious controller task execution.\",\n spec.mapreduce_id)\n self._clean_up_mr(spec)\n return\n\n shard_states = model.ShardState.find_all_by_mapreduce_state(state)\n self._update_state_from_shard_states(state, shard_states, control)\n\n if state.active:\n ControllerCallbackHandler.reschedule(\n state, spec, self.serial_id() + 1)", "metadata": "root.ControllerCallbackHandler.handle", "header": "['class', 'ControllerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1099 }, { "content": " def _update_state_from_shard_states(self, state, shard_states, control):\n \"\"\"Update mr state by examing shard states.\n\n Args:\n state: current mapreduce state as MapreduceState.\n shard_states: an iterator over shard states.\n control: model.MapreduceControl entity.\n \"\"\"\n # Initialize vars.\n state.active_shards, state.aborted_shards, state.failed_shards = 0, 0, 0\n total_shards = 0\n processed_counts = []\n processed_status = []\n state.counters_map.clear()\n\n # Tally across shard states once.\n for s in shard_states:\n total_shards += 1\n status = 'unknown'\n if s.active:\n state.active_shards += 1\n status = 'running'\n if s.result_status == model.ShardState.RESULT_SUCCESS:\n status = 'success'\n elif s.result_status == model.ShardState.RESULT_ABORTED:\n state.aborted_shards += 1\n status = 'aborted'\n elif s.result_status == model.ShardState.RESULT_FAILED:\n state.failed_shards += 1\n status = 'failed'\n\n # Update stats in mapreduce state by aggregating stats from shard states.\n state.counters_map.add_map(s.counters_map)\n processed_counts.append(s.counters_map.get(context.COUNTER_MAPPER_CALLS))\n processed_status.append(status)\n\n state.set_processed_counts(processed_counts, processed_status)\n state.last_poll_time = datetime.datetime.utcfromtimestamp(self._time())\n\n spec = state.mapreduce_spec\n\n if total_shards != spec.mapper.shard_count:\n logging.error(\"Found %d shard states. Expect %d. \"\n \"Issuing abort command to job '%s'\",\n total_shards, spec.mapper.shard_count,\n spec.mapreduce_id)\n # We issue abort command to allow shards to stop themselves.\n model.MapreduceControl.abort(spec.mapreduce_id)\n\n # If any shard is active then the mr is active.\n # This way, controller won't prematurely stop before all the shards have.\n state.active = bool(state.active_shards)\n if not control and (state.failed_shards or state.aborted_shards):\n # Issue abort command if there are failed shards.\n model.MapreduceControl.abort(spec.mapreduce_id)\n\n if not state.active:\n # Set final result status derived from shard states.\n if state.failed_shards or not total_shards:\n state.result_status = model.MapreduceState.RESULT_FAILED\n # It's important failed shards is checked before aborted shards\n # because failed shards will trigger other shards to abort.\n elif state.aborted_shards:\n state.result_status = model.MapreduceState.RESULT_ABORTED\n else:\n state.result_status = model.MapreduceState.RESULT_SUCCESS\n self._finalize_outputs(spec, state)\n self._finalize_job(spec, state)\n else:\n @db.transactional(retries=5)\n def _put_state():\n \"\"\"The helper for storing the state.\"\"\"\n fresh_state = model.MapreduceState.get_by_job_id(spec.mapreduce_id)\n # We don't check anything other than active because we are only\n # updating stats. It's OK if they are briefly inconsistent.\n if not fresh_state.active:\n logging.warning(\n \"Job %s is not active. Looks like spurious task execution. \"\n \"Dropping controller task.\", spec.mapreduce_id)\n return\n config = util.create_datastore_write_config(spec)\n state.put(config=config)\n\n _put_state()", "metadata": "root.ControllerCallbackHandler._update_state_from_shard_states", "header": "['class', 'ControllerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1126 }, { "content": " def serial_id(self):\n \"\"\"Get serial unique identifier of this task from request.\n\n Returns:\n serial identifier as int.\n \"\"\"\n return int(self.request.get(\"serial_id\"))", "metadata": "root.ControllerCallbackHandler.serial_id", "header": "['class', 'ControllerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1211 }, { "content": " @classmethod\n def _finalize_outputs(cls, mapreduce_spec, mapreduce_state):\n \"\"\"Finalize outputs.\n\n Args:\n mapreduce_spec: an instance of MapreduceSpec.\n mapreduce_state: an instance of MapreduceState.\n \"\"\"\n # Only finalize the output writers if the job is successful.\n if (mapreduce_spec.mapper.output_writer_class() and\n mapreduce_state.result_status == model.MapreduceState.RESULT_SUCCESS):\n mapreduce_spec.mapper.output_writer_class().finalize_job(mapreduce_state)", "metadata": "root.ControllerCallbackHandler._finalize_outputs", "header": "['class', 'ControllerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1219 }, { "content": " @classmethod\n def _finalize_job(cls, mapreduce_spec, mapreduce_state):\n \"\"\"Finalize job execution.\n\n Invokes done callback and save mapreduce state in a transaction,\n and schedule necessary clean ups. This method is idempotent.\n\n Args:\n mapreduce_spec: an instance of MapreduceSpec\n mapreduce_state: an instance of MapreduceState\n \"\"\"\n config = util.create_datastore_write_config(mapreduce_spec)\n queue_name = util.get_queue_name(mapreduce_spec.params.get(\n model.MapreduceSpec.PARAM_DONE_CALLBACK_QUEUE))\n done_callback = mapreduce_spec.params.get(\n model.MapreduceSpec.PARAM_DONE_CALLBACK)\n done_task = None\n if done_callback:\n done_task = taskqueue.Task(\n url=done_callback,\n headers=util._get_task_headers(mapreduce_spec.mapreduce_id,\n util.CALLBACK_MR_ID_TASK_HEADER),\n method=mapreduce_spec.params.get(\"done_callback_method\", \"POST\"))\n\n @db.transactional(retries=5)\n def _put_state():\n \"\"\"Helper to store state.\"\"\"\n fresh_state = model.MapreduceState.get_by_job_id(\n mapreduce_spec.mapreduce_id)\n if not fresh_state.active:\n logging.warning(\n \"Job %s is not active. Looks like spurious task execution. \"\n \"Dropping task.\", mapreduce_spec.mapreduce_id)\n return\n mapreduce_state.put(config=config)\n # Enqueue done_callback if needed.\n if done_task and not _run_task_hook(\n mapreduce_spec.get_hooks(),\n \"enqueue_done_task\",\n done_task,\n queue_name):\n done_task.add(queue_name, transactional=True)\n\n _put_state()\n logging.info(\"Final result for job '%s' is '%s'\",\n mapreduce_spec.mapreduce_id, mapreduce_state.result_status)\n cls._clean_up_mr(mapreduce_spec)", "metadata": "root.ControllerCallbackHandler._finalize_job", "header": "['class', 'ControllerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1232 }, { "content": " @classmethod\n def _clean_up_mr(cls, mapreduce_spec):\n FinalizeJobHandler.schedule(mapreduce_spec)", "metadata": "root.ControllerCallbackHandler._clean_up_mr", "header": "['class', 'ControllerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1280 }, { "content": " @staticmethod\n def get_task_name(mapreduce_spec, serial_id):\n \"\"\"Compute single controller task name.\n\n Args:\n mapreduce_spec: specification of the mapreduce.\n serial_id: id of the invocation as int.\n\n Returns:\n task name which should be used to process specified shard/slice.\n \"\"\"\n # Prefix the task name with something unique to this framework's\n # namespace so we don't conflict with user tasks on the queue.\n return \"appengine-mrcontrol-%s-%s\" % (\n mapreduce_spec.mapreduce_id, serial_id)", "metadata": "root.ControllerCallbackHandler.get_task_name", "header": "['class', 'ControllerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1284 }, { "content": " @staticmethod\n def controller_parameters(mapreduce_spec, serial_id):\n \"\"\"Fill in controller task parameters.\n\n Returned parameters map is to be used as task payload, and it contains\n all the data, required by controller to perform its function.\n\n Args:\n mapreduce_spec: specification of the mapreduce.\n serial_id: id of the invocation as int.\n\n Returns:\n string->string map of parameters to be used as task payload.\n \"\"\"\n return {\"mapreduce_spec\": mapreduce_spec.to_json_str(),\n \"serial_id\": str(serial_id)}", "metadata": "root.ControllerCallbackHandler.controller_parameters", "header": "['class', 'ControllerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1300 }, { "content": " @classmethod\n def reschedule(cls,\n mapreduce_state,\n mapreduce_spec,\n serial_id,\n queue_name=None):\n \"\"\"Schedule new update status callback task.\n\n Args:\n mapreduce_state: mapreduce state as model.MapreduceState\n mapreduce_spec: mapreduce specification as MapreduceSpec.\n serial_id: id of the invocation as int.\n queue_name: The queue to schedule this task on. Will use the current\n queue of execution if not supplied.\n \"\"\"\n task_name = ControllerCallbackHandler.get_task_name(\n mapreduce_spec, serial_id)\n task_params = ControllerCallbackHandler.controller_parameters(\n mapreduce_spec, serial_id)\n if not queue_name:\n queue_name = os.environ.get(\"HTTP_X_APPENGINE_QUEUENAME\", \"default\")\n\n controller_callback_task = model.HugeTask(\n url=(mapreduce_spec.params[\"base_path\"] + \"/controller_callback/\" +\n mapreduce_spec.mapreduce_id),\n name=task_name, params=task_params,\n countdown=parameters.config._CONTROLLER_PERIOD_SEC,\n parent=mapreduce_state,\n headers=util._get_task_headers(mapreduce_spec.mapreduce_id))\n\n if not _run_task_hook(mapreduce_spec.get_hooks(),\n \"enqueue_controller_task\",\n controller_callback_task,\n queue_name):\n try:\n controller_callback_task.add(queue_name)\n except (taskqueue.TombstonedTaskError,\n taskqueue.TaskAlreadyExistsError), e:\n logging.warning(\"Task %r with params %r already exists. %s: %s\",\n task_name, task_params, e.__class__, e)", "metadata": "root.ControllerCallbackHandler.reschedule", "header": "['class', 'ControllerCallbackHandler', '(', 'base_handler', '.', 'HugeTaskHandler', ')', ':', '___EOS___']", "index": 1317 }, { "content": "class KickOffJobHandler(base_handler.TaskQueueHandler):\n \"\"\"Taskqueue handler which kicks off a mapreduce processing.\n\n This handler is idempotent.\n\n Precondition:\n The Model.MapreduceState entity for this mr is already created and\n saved to datastore by StartJobHandler._start_map.\n\n Request Parameters:\n mapreduce_id: in string.\n \"\"\"\n\n # Datastore key used to save json serialized input readers.\n _SERIALIZED_INPUT_READERS_KEY = \"input_readers_for_mr_%s\"\n\n\n\n\n\n\n", "metadata": "root.KickOffJobHandler", "header": "['module', '___EOS___']", "index": 1359 }, { "content": " def handle(self):\n \"\"\"Handles kick off request.\"\"\"\n # Get and verify mr state.\n mr_id = self.request.get(\"mapreduce_id\")\n # Log the mr_id since this is started in an unnamed task\n logging.info(\"Processing kickoff for job %s\", mr_id)\n state = model.MapreduceState.get_by_job_id(mr_id)\n if not self._check_mr_state(state, mr_id):\n return\n\n # Create input readers.\n readers, serialized_readers_entity = self._get_input_readers(state)\n if readers is None:\n # We don't have any data. Finish map.\n logging.warning(\"Found no mapper input data to process.\")\n state.active = False\n state.result_status = model.MapreduceState.RESULT_SUCCESS\n ControllerCallbackHandler._finalize_job(\n state.mapreduce_spec, state)\n return False\n\n # Create output writers.\n self._setup_output_writer(state)\n\n # Save states and make sure we use the saved input readers for\n # subsequent operations.\n result = self._save_states(state, serialized_readers_entity)\n if result is None:\n readers, _ = self._get_input_readers(state)\n elif not result:\n return\n\n queue_name = self.request.headers.get(\"X-AppEngine-QueueName\")\n KickOffJobHandler._schedule_shards(state.mapreduce_spec, readers,\n queue_name,\n state.mapreduce_spec.params[\"base_path\"],\n state)\n\n ControllerCallbackHandler.reschedule(\n state, state.mapreduce_spec, serial_id=0, queue_name=queue_name)", "metadata": "root.KickOffJobHandler.handle", "header": "['class', 'KickOffJobHandler', '(', 'base_handler', '.', 'TaskQueueHandler', ')', ':', '___EOS___']", "index": 1375 }, { "content": " def _drop_gracefully(self):\n \"\"\"See parent.\"\"\"\n mr_id = self.request.get(\"mapreduce_id\")\n logging.error(\"Failed to kick off job %s\", mr_id)\n\n state = model.MapreduceState.get_by_job_id(mr_id)\n if not self._check_mr_state(state, mr_id):\n return\n\n # Issue abort command just in case there are running tasks.\n config = util.create_datastore_write_config(state.mapreduce_spec)\n model.MapreduceControl.abort(mr_id, config=config)\n\n # Finalize job and invoke callback.\n state.active = False\n state.result_status = model.MapreduceState.RESULT_FAILED\n ControllerCallbackHandler._finalize_job(state.mapreduce_spec, state)", "metadata": "root.KickOffJobHandler._drop_gracefully", "header": "['class', 'KickOffJobHandler', '(', 'base_handler', '.', 'TaskQueueHandler', ')', ':', '___EOS___']", "index": 1416 }, { "content": " def _get_input_readers(self, state):\n \"\"\"Get input readers.\n\n Args:\n state: a MapreduceState model.\n\n Returns:\n A tuple: (a list of input readers, a model._HugeTaskPayload entity).\n The payload entity contains the json serialized input readers.\n (None, None) when input reader inplitting returned no data to process.\n \"\"\"\n serialized_input_readers_key = (self._SERIALIZED_INPUT_READERS_KEY %\n state.key().id_or_name())\n serialized_input_readers = model._HugeTaskPayload.get_by_key_name(\n serialized_input_readers_key, parent=state)\n\n # Initialize input readers.\n input_reader_class = state.mapreduce_spec.mapper.input_reader_class()\n split_param = state.mapreduce_spec.mapper\n if issubclass(input_reader_class, map_job.InputReader):\n split_param = map_job.JobConfig._to_map_job_config(\n state.mapreduce_spec,\n os.environ.get(\"HTTP_X_APPENGINE_QUEUENAME\"))\n if serialized_input_readers is None:\n readers = input_reader_class.split_input(split_param)\n else:\n readers = [input_reader_class.from_json_str(_json) for _json in\n json.loads(zlib.decompress(\n serialized_input_readers.payload))]\n\n if not readers:\n return None, None\n\n # Update state and spec with actual shard count.\n state.mapreduce_spec.mapper.shard_count = len(readers)\n state.active_shards = len(readers)\n\n # Prepare to save serialized input readers.\n if serialized_input_readers is None:\n # Use mr_state as parent so it can be easily cleaned up later.\n serialized_input_readers = model._HugeTaskPayload(\n key_name=serialized_input_readers_key, parent=state)\n readers_json_str = [i.to_json_str() for i in readers]\n serialized_input_readers.payload = zlib.compress(json.dumps(\n readers_json_str))\n return readers, serialized_input_readers", "metadata": "root.KickOffJobHandler._get_input_readers", "header": "['class', 'KickOffJobHandler', '(', 'base_handler', '.', 'TaskQueueHandler', ')', ':', '___EOS___']", "index": 1434 }, { "content": " def _setup_output_writer(self, state):\n if not state.writer_state:\n output_writer_class = state.mapreduce_spec.mapper.output_writer_class()\n if output_writer_class:\n output_writer_class.init_job(state)", "metadata": "root.KickOffJobHandler._setup_output_writer", "header": "['class', 'KickOffJobHandler', '(', 'base_handler', '.', 'TaskQueueHandler', ')', ':', '___EOS___']", "index": 1481 }, { "content": " @db.transactional\n def _save_states(self, state, serialized_readers_entity):\n \"\"\"Run transaction to save state.\n\n Args:\n state: a model.MapreduceState entity.\n serialized_readers_entity: a model._HugeTaskPayload entity containing\n json serialized input readers.\n\n Returns:\n False if a fatal error is encountered and this task should be dropped\n immediately. True if transaction is successful. None if a previous\n attempt of this same transaction has already succeeded.\n \"\"\"\n mr_id = state.key().id_or_name()\n fresh_state = model.MapreduceState.get_by_job_id(mr_id)\n if not self._check_mr_state(fresh_state, mr_id):\n return False\n if fresh_state.active_shards != 0:\n logging.warning(\n \"Mapreduce %s already has active shards. Looks like spurious task \"\n \"execution.\", mr_id)\n return None\n config = util.create_datastore_write_config(state.mapreduce_spec)\n db.put([state, serialized_readers_entity], config=config)\n return True", "metadata": "root.KickOffJobHandler._save_states", "header": "['class', 'KickOffJobHandler', '(', 'base_handler', '.', 'TaskQueueHandler', ')', ':', '___EOS___']", "index": 1487 }, { "content": " @classmethod\n def _schedule_shards(cls,\n spec,\n readers,\n queue_name,\n base_path,\n mr_state):\n \"\"\"Prepares shard states and schedules their execution.\n\n Even though this method does not schedule shard task and save shard state\n transactionally, it's safe for taskqueue to retry this logic because\n the initial shard_state for each shard is the same from any retry.\n This is an important yet reasonable assumption on model.ShardState.\n\n Args:\n spec: mapreduce specification as MapreduceSpec.\n readers: list of InputReaders describing shard splits.\n queue_name: The queue to run this job on.\n base_path: The base url path of mapreduce callbacks.\n mr_state: The MapReduceState of current job.\n \"\"\"\n # Create shard states.\n shard_states = []\n for shard_number, input_reader in enumerate(readers):\n shard_state = model.ShardState.create_new(spec.mapreduce_id, shard_number)\n shard_state.shard_description = str(input_reader)\n shard_states.append(shard_state)\n\n # Retrieves already existing shard states.\n existing_shard_states = db.get(shard.key() for shard in shard_states)\n existing_shard_keys = set(shard.key() for shard in existing_shard_states\n if shard is not None)\n\n # Save non existent shard states.\n # Note: we could do this transactionally if necessary.\n db.put((shard for shard in shard_states\n if shard.key() not in existing_shard_keys),\n config=util.create_datastore_write_config(spec))\n\n # Create output writers.\n writer_class = spec.mapper.output_writer_class()\n writers = [None] * len(readers)\n if writer_class:\n for shard_number, shard_state in enumerate(shard_states):\n writers[shard_number] = writer_class.create(\n mr_state.mapreduce_spec,\n shard_state.shard_number, shard_state.retries + 1,\n mr_state.writer_state)\n\n # Schedule ALL shard tasks.\n # Since each task is named, _add_task will fall back gracefully if a\n # task already exists.\n for shard_number, (input_reader, output_writer) in enumerate(\n zip(readers, writers)):\n shard_id = model.ShardState.shard_id_from_number(\n spec.mapreduce_id, shard_number)\n task = MapperWorkerCallbackHandler._state_to_task(\n model.TransientShardState(\n base_path, spec, shard_id, 0, input_reader, input_reader,\n output_writer=output_writer,\n handler=spec.mapper.handler),\n shard_states[shard_number])\n MapperWorkerCallbackHandler._add_task(task,\n spec,\n queue_name)", "metadata": "root.KickOffJobHandler._schedule_shards", "header": "['class', 'KickOffJobHandler', '(', 'base_handler', '.', 'TaskQueueHandler', ')', ':', '___EOS___']", "index": 1514 }, { "content": " @classmethod\n def _check_mr_state(cls, state, mr_id):\n \"\"\"Check MapreduceState.\n\n Args:\n state: an MapreduceState instance.\n mr_id: mapreduce id.\n\n Returns:\n True if state is valid. False if not and this task should be dropped.\n \"\"\"\n if state is None:\n logging.warning(\n \"Mapreduce State for job %s is missing. Dropping Task.\",\n mr_id)\n return False\n if not state.active:\n logging.warning(\n \"Mapreduce %s is not active. Looks like spurious task \"\n \"execution. Dropping Task.\", mr_id)\n return False\n return True", "metadata": "root.KickOffJobHandler._check_mr_state", "header": "['class', 'KickOffJobHandler', '(', 'base_handler', '.', 'TaskQueueHandler', ')', ':', '___EOS___']", "index": 1580 }, { "content": "class StartJobHandler(base_handler.PostJsonHandler):\n \"\"\"Command handler starts a mapreduce job.\n\n This handler allows user to start a mr via a web form. It's _start_map\n method can also be used independently to start a mapreduce.\n \"\"\"\n\n\n\n\n\n", "metadata": "root.StartJobHandler", "header": "['module', '___EOS___']", "index": 1604 }, { "content": " def handle(self):\n \"\"\"Handles start request.\"\"\"\n # Mapper spec as form arguments.\n mapreduce_name = self._get_required_param(\"name\")\n mapper_input_reader_spec = self._get_required_param(\"mapper_input_reader\")\n mapper_handler_spec = self._get_required_param(\"mapper_handler\")\n mapper_output_writer_spec = self.request.get(\"mapper_output_writer\")\n mapper_params = self._get_params(\n \"mapper_params_validator\", \"mapper_params.\")\n params = self._get_params(\n \"params_validator\", \"params.\")\n\n # Default values.\n mr_params = map_job.JobConfig._get_default_mr_params()\n mr_params.update(params)\n if \"queue_name\" in mapper_params:\n mr_params[\"queue_name\"] = mapper_params[\"queue_name\"]\n\n # Set some mapper param defaults if not present.\n mapper_params[\"processing_rate\"] = int(mapper_params.get(\n \"processing_rate\") or parameters.config.PROCESSING_RATE_PER_SEC)\n\n # Validate the Mapper spec, handler, and input reader.\n mapper_spec = model.MapperSpec(\n mapper_handler_spec,\n mapper_input_reader_spec,\n mapper_params,\n int(mapper_params.get(\"shard_count\", parameters.config.SHARD_COUNT)),\n output_writer_spec=mapper_output_writer_spec)\n\n mapreduce_id = self._start_map(\n mapreduce_name,\n mapper_spec,\n mr_params,\n queue_name=mr_params[\"queue_name\"],\n _app=mapper_params.get(\"_app\"))\n self.json_response[\"mapreduce_id\"] = mapreduce_id", "metadata": "root.StartJobHandler.handle", "header": "['class', 'StartJobHandler', '(', 'base_handler', '.', 'PostJsonHandler', ')', ':', '___EOS___']", "index": 1611 }, { "content": " def _get_params(self, validator_parameter, name_prefix):\n \"\"\"Retrieves additional user-supplied params for the job and validates them.\n\n Args:\n validator_parameter: name of the request parameter which supplies\n validator for this parameter set.\n name_prefix: common prefix for all parameter names in the request.\n\n Raises:\n Any exception raised by the 'params_validator' request parameter if\n the params fail to validate.\n\n Returns:\n The user parameters.\n \"\"\"\n params_validator = self.request.get(validator_parameter)\n\n user_params = {}\n for key in self.request.arguments():\n if key.startswith(name_prefix):\n values = self.request.get_all(key)\n adjusted_key = key[len(name_prefix):]\n if len(values) == 1:\n user_params[adjusted_key] = values[0]\n else:\n user_params[adjusted_key] = values\n\n if params_validator:\n resolved_validator = util.for_name(params_validator)\n resolved_validator(user_params)\n\n return user_params", "metadata": "root.StartJobHandler._get_params", "header": "['class', 'StartJobHandler', '(', 'base_handler', '.', 'PostJsonHandler', ')', ':', '___EOS___']", "index": 1649 }, { "content": " def _get_required_param(self, param_name):\n \"\"\"Get a required request parameter.\n\n Args:\n param_name: name of request parameter to fetch.\n\n Returns:\n parameter value\n\n Raises:\n errors.NotEnoughArgumentsError: if parameter is not specified.\n \"\"\"\n value = self.request.get(param_name)\n if not value:\n raise errors.NotEnoughArgumentsError(param_name + \" not specified\")\n return value", "metadata": "root.StartJobHandler._get_required_param", "header": "['class', 'StartJobHandler', '(', 'base_handler', '.', 'PostJsonHandler', ')', ':', '___EOS___']", "index": 1682 }, { "content": " @classmethod\n def _start_map(cls,\n name,\n mapper_spec,\n mapreduce_params,\n queue_name,\n eta=None,\n countdown=None,\n hooks_class_name=None,\n _app=None,\n in_xg_transaction=False):\n # pylint: disable=g-doc-args\n # pylint: disable=g-doc-return-or-yield\n \"\"\"See control.start_map.\n\n Requirements for this method:\n 1. The request that invokes this method can either be regular or\n from taskqueue. So taskqueue specific headers can not be used.\n 2. Each invocation transactionally starts an isolated mapreduce job with\n a unique id. MapreduceState should be immediately available after\n returning. See control.start_map's doc on transactional.\n 3. Method should be lightweight.\n \"\"\"\n # Validate input reader.\n mapper_input_reader_class = mapper_spec.input_reader_class()\n mapper_input_reader_class.validate(mapper_spec)\n\n # Validate output writer.\n mapper_output_writer_class = mapper_spec.output_writer_class()\n if mapper_output_writer_class:\n mapper_output_writer_class.validate(mapper_spec)\n\n # Create a new id and mr spec.\n mapreduce_id = model.MapreduceState.new_mapreduce_id()\n mapreduce_spec = model.MapreduceSpec(\n name,\n mapreduce_id,\n mapper_spec.to_json(),\n mapreduce_params,\n hooks_class_name)\n\n # Validate mapper handler.\n ctx = context.Context(mapreduce_spec, None)\n context.Context._set(ctx)\n try:\n # pylint: disable=pointless-statement\n mapper_spec.handler\n finally:\n context.Context._set(None)\n\n # Save states and enqueue task.\n if in_xg_transaction:\n propagation = db.MANDATORY\n else:\n propagation = db.INDEPENDENT\n\n @db.transactional(propagation=propagation)\n def _txn():\n cls._create_and_save_state(mapreduce_spec, _app)\n cls._add_kickoff_task(mapreduce_params[\"base_path\"], mapreduce_spec, eta,\n countdown, queue_name)\n _txn()\n\n return mapreduce_id", "metadata": "root.StartJobHandler._start_map", "header": "['class', 'StartJobHandler', '(', 'base_handler', '.', 'PostJsonHandler', ')', ':', '___EOS___']", "index": 1699 }, { "content": " @classmethod\n def _create_and_save_state(cls, mapreduce_spec, _app):\n \"\"\"Save mapreduce state to datastore.\n\n Save state to datastore so that UI can see it immediately.\n\n Args:\n mapreduce_spec: model.MapreduceSpec,\n _app: app id if specified. None otherwise.\n\n Returns:\n The saved Mapreduce state.\n \"\"\"\n state = model.MapreduceState.create_new(mapreduce_spec.mapreduce_id)\n state.mapreduce_spec = mapreduce_spec\n state.active = True\n state.active_shards = 0\n if _app:\n state.app_id = _app\n config = util.create_datastore_write_config(mapreduce_spec)\n state.put(config=config)\n return state", "metadata": "root.StartJobHandler._create_and_save_state", "header": "['class', 'StartJobHandler', '(', 'base_handler', '.', 'PostJsonHandler', ')', ':', '___EOS___']", "index": 1764 }, { "content": " @classmethod\n def _add_kickoff_task(cls,\n base_path,\n mapreduce_spec,\n eta,\n countdown,\n queue_name):\n \"\"\"Enqueues a new kickoff task.\"\"\"\n params = {\"mapreduce_id\": mapreduce_spec.mapreduce_id}\n # Task is not named so that it can be added within a transaction.\n kickoff_task = taskqueue.Task(\n url=base_path + \"/kickoffjob_callback/\" + mapreduce_spec.mapreduce_id,\n headers=util._get_task_headers(mapreduce_spec.mapreduce_id),\n params=params,\n eta=eta,\n countdown=countdown)\n hooks = mapreduce_spec.get_hooks()\n if hooks is not None:\n try:\n hooks.enqueue_kickoff_task(kickoff_task, queue_name)\n return\n except NotImplementedError:\n pass\n kickoff_task.add(queue_name, transactional=True)", "metadata": "root.StartJobHandler._add_kickoff_task", "header": "['class', 'StartJobHandler', '(', 'base_handler', '.', 'PostJsonHandler', ')', ':', '___EOS___']", "index": 1787 }, { "content": "class FinalizeJobHandler(base_handler.TaskQueueHandler):\n \"\"\"Finalize map job by deleting all temporary entities.\"\"\"\n\n", "metadata": "root.FinalizeJobHandler", "header": "['module', '___EOS___']", "index": 1813 }, { "content": " def handle(self):\n mapreduce_id = self.request.get(\"mapreduce_id\")\n mapreduce_state = model.MapreduceState.get_by_job_id(mapreduce_id)\n if mapreduce_state:\n config = (\n util.create_datastore_write_config(mapreduce_state.mapreduce_spec))\n keys = [model.MapreduceControl.get_key_by_job_id(mapreduce_id)]\n for ss in model.ShardState.find_all_by_mapreduce_state(mapreduce_state):\n keys.extend(list(\n model._HugeTaskPayload.all().ancestor(ss).run(keys_only=True)))\n keys.extend(list(model._HugeTaskPayload.all().ancestor(\n mapreduce_state).run(keys_only=True)))\n db.delete(keys, config=config)", "metadata": "root.FinalizeJobHandler.handle", "header": "['class', 'FinalizeJobHandler', '(', 'base_handler', '.', 'TaskQueueHandler', ')', ':', '___EOS___']", "index": 1816 }, { "content": " @classmethod\n def schedule(cls, mapreduce_spec):\n \"\"\"Schedule finalize task.\n\n Args:\n mapreduce_spec: mapreduce specification as MapreduceSpec.\n \"\"\"\n task_name = mapreduce_spec.mapreduce_id + \"-finalize\"\n finalize_task = taskqueue.Task(\n name=task_name,\n url=(mapreduce_spec.params[\"base_path\"] + \"/finalizejob_callback/\" +\n mapreduce_spec.mapreduce_id),\n params={\"mapreduce_id\": mapreduce_spec.mapreduce_id},\n headers=util._get_task_headers(mapreduce_spec.mapreduce_id))\n queue_name = util.get_queue_name(None)\n if not _run_task_hook(mapreduce_spec.get_hooks(),\n \"enqueue_controller_task\",\n finalize_task,\n queue_name):\n try:\n finalize_task.add(queue_name)\n except (taskqueue.TombstonedTaskError,\n taskqueue.TaskAlreadyExistsError), e:\n logging.warning(\"Task %r already exists. %s: %s\",\n task_name, e.__class__, e)", "metadata": "root.FinalizeJobHandler.schedule", "header": "['class', 'FinalizeJobHandler', '(', 'base_handler', '.', 'TaskQueueHandler', ')', ':', '___EOS___']", "index": 1830 }, { "content": "class CleanUpJobHandler(base_handler.PostJsonHandler):\n \"\"\"Command to kick off tasks to clean up a job's data.\"\"\"\n", "metadata": "root.CleanUpJobHandler", "header": "['module', '___EOS___']", "index": 1857 }, { "content": " def handle(self):\n mapreduce_id = self.request.get(\"mapreduce_id\")\n\n mapreduce_state = model.MapreduceState.get_by_job_id(mapreduce_id)\n if mapreduce_state:\n shard_keys = model.ShardState.calculate_keys_by_mapreduce_state(\n mapreduce_state)\n db.delete(shard_keys)\n db.delete(mapreduce_state)\n self.json_response[\"status\"] = (\"Job %s successfully cleaned up.\" %\n mapreduce_id)", "metadata": "root.CleanUpJobHandler.handle", "header": "['class', 'CleanUpJobHandler', '(', 'base_handler', '.', 'PostJsonHandler', ')', ':', '___EOS___']", "index": 1860 }, { "content": "class AbortJobHandler(base_handler.PostJsonHandler):\n \"\"\"Command to abort a running job.\"\"\"\n", "metadata": "root.AbortJobHandler", "header": "['module', '___EOS___']", "index": 1873 }, { "content": " def handle(self):\n model.MapreduceControl.abort(self.request.get(\"mapreduce_id\"))\n self.json_response[\"status\"] = \"Abort signal sent.\"", "metadata": "root.AbortJobHandler.handle", "header": "['class', 'AbortJobHandler', '(', 'base_handler', '.', 'PostJsonHandler', ')', ':', '___EOS___']", "index": 1876 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", " ", "Goo", "gle", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Define", "s", " ", "exec", "uto", "r", " ", "task", "s", " ", "handler", "s", " ", "for", " ", "Map", "Reduce", " ", "implementation", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "protect", "ed", "-", "access_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "g", "-", "bad", "-", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "ndb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "import_", "runtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datast", "ore", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "logs", "ervice", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "task", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "base", "\\u", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "input", "\\u", "readers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "map", "\\u", "job", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "operation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "output", "\\u", "writers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "parameters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "shard", "\\u", "life", "\\u", "cycle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mapreduce", "_", "._", "api_", "import_", "map", "\\u", "job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "runtime_", "import_", "api", "proxy", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "g", "-", "import", "-", "not", "-", "at", "-", "top_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "clouds", "tora", "ge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "25", " ", "runt", "ime", ",", " ", "the", " ", "above", " ", "code", " ", "will", " ", "be", " ", "scrub", "bed", " ", "to", " ", "import", " ", "the", " ", "stub", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "clouds", "tora", "ge", ".", " ", "All", " ", "occure", "nce", "s", " ", "of", " ", "the", " ", "follow", "ing", " ", "if", " ", "condition", " ", "in", " ", "MR", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "codeb", "ase", " ", "is", " ", "to", " ", "tell", " ", "it", " ", "apart", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "user", "):", " ", "Remove", " ", "after", " ", "25", " ", "runt", "ime", " ", "MR", " ", "is", " ", "abo", "ndo", "ned", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "clouds", "tora", "ge_", ",_", "\"\\u", "STU", "B", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clouds", "tora", "ge_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clouds", "tora", "ge_", "=_", "None_", "#", " ", "Cloud", "Stor", "age", " ", "librar", "y", " ", "not", " ", "available_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "guide", " ", "to", " ", "logg", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", ".", "critic", "al", ":", " ", "message", "s", " ", "user", " ", "abs", "olute", "ly", " ", "shou", "ld", " ", "see", ",", " ", "e", ".", "g", ".", " ", "fail", "ed", " ", "job", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", ".", "error", ":", " ", "exception", "s", " ", "dur", "ing", " ", "process", "ing", " ", "user", " ", "data", ",", " ", "or", " ", "unexpected", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", "s", " ", "detect", "ed", " ", "by", " ", "mr", " ", "frame", "work", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", ".", "warn", "ing", ":", " ", "error", "s", " ", "mr", " ", "frame", "work", " ", "knows", " ", "how", " ", "to", " ", "handle", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "log", ".", "info", ":", " ", "other", " ", "expected", " ", "events", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "of", " ", "string", "s", " ", "of", " ", "vari", "ous", " ", "test", "-", "injected", " ", "faults", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "TEST", "\\u", "IN", "JE", "CT", "ED", "\\u", "FA", "ULT", "S_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "run", "\\u", "task", "\\u", "hook_", "(_", "hooks_", ",_", "method_", ",_", "task_", ",_", "queue", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Invok", "es", " ", "hook", "s", ".", "method", "(", "task", ",", " ", "queue", "\\u", "name", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "hook", "s", ":", " ", "A", " ", "hook", "s", ".", "Hook", "s", " ", "instance", " ", "or", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "method", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "method", " ", "to", " ", "invoke", " ", "on", " ", "the", " ", "hook", "s", " ", "class", " ", "e", ".", "g", ".", "\\", "10", ";", " ", " ", " ", " ", "\"", "enqueue", "\\u", "kick", "off", "\\u", "task", "\".\\", "10", ";", " ", " ", " ", " ", "task", ":", " ", "The", " ", "task", "queue", ".", "Task", " ", "to", " ", "pass", " ", "to", " ", "the", " ", "hook", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "queue", "\\u", "name", ":", " ", "The", " ", "name", " ", "of", " ", "the", " ", "queue", " ", "to", " ", "pass", " ", "to", " ", "the", " ", "hook", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "Tru", "e", " ", "if", " ", "the", " ", "hook", "s", ".", "Hook", "s", " ", "instance", " ", "handle", "d", " ", "the", " ", "method", ",", " ", "Fal", "se", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hooks_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getattr_", "(_", "hooks_", ",_", "method_", ")_", "(_", "task_", ",_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "default", " ", "task", " ", "addition", " ", "implementation", "._", "\\u\\u\\uNL\\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_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "back", " ", "handler", " ", "for", " ", "mapreduce", " ", "worker", " ", "task", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "directive", "s", " ", "instruct", " ", "self", ".\\u", "\\u", "return", "()", " ", "how", " ", "to", " ", "set", " ", "state", " ", "and", " ", "enqueue", " ", "task", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "=_", "util_", "._", "\\u", "enum_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Task", " ", "is", " ", "runn", "ing", " ", "as", " ", "expected", "._", "\\u\\u\\uNL\\u\\u\\u_", "PROC", "EE", "D", "\\u", "TASK", "_", "=_", "\"", "proceed", "\\u", "task", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "retr", "y", " ", "task", ".", " ", "Lock", " ", "was", " ", "NOT", " ", "acquired", " ", "whe", "n", " ", "the", " ", "error", " ", "occur", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "change", " ", "payload", " ", "or", " ", "datast", "ore", "._", "\\u\\u\\uNL\\u\\u\\u_", "RETRY", "\\u", "TASK", "_", "=_", "\"", "retr", "y", "\\u", "task", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "retr", "y", " ", "task", ".", " ", "Lock", " ", "was", " ", "acquired", " ", "whe", "n", " ", "the", " ", "error", " ", "occur", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "change", " ", "payload", " ", "or", " ", "datast", "ore", "._", "\\u\\u\\uNL\\u\\u\\u_", "RETRY", "\\u", "SLI", "CE_", "=_", "\"", "retr", "y", "\\u", "slice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Drop", " ", "the", " ", "task", " ", "(", "due", " ", "to", " ", "duplicated", " ", "task", ").", " ", "Mus", "t", " ", "log", " ", "permanent", " ", "drop", "._", "\\u\\u\\uNL\\u\\u\\u_", "DROP", "\\u", "TASK", "_", "=_", "\"", "drop", "\\u", "task", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "handler", "s", ".", "Map", "per", "Worke", "r", "Call", "back", "Handle", "r", ".\\u", "atte", "mpt", "\\u", "slice", "\\u", "recover", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "RECO", "VER", "\\u", "SLI", "CE_", "=_", "\"", "recover", "\\u", "slice", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "retr", "y", " ", "the", " ", "shard", "._", "\\u\\u\\uNL\\u\\u\\u_", "RETRY", "\\u", "SHAR", "D_", "=_", "\"", "retr", "y", "\\u", "shard", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "drop", " ", "task", " ", "and", " ", "fail", " ", "the", " ", "shard", ".", " ", "Log", " ", "permanent", " ", "fail", "ure", "._", "\\u\\u\\uNL\\u\\u\\u_", "FAIL", "\\u", "TASK", "_", "=_", "\"", "fail", "\\u", "task", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "abort", " ", "the", " ", "shard", "._", "\\u\\u\\uNL\\u\\u\\u_", "ABORT", "\\u", "SHAR", "D_", "=_", "\"", "abort", "\\u", "shard", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dep", "reca", "ted", ".", " ", "On", "ly", " ", "used", " ", "by", " ", "old", " ", "test", " ", "case", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "user", "):", " ", "clean", " ", "up", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "time_", "=_", "time_", "._", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "context_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shard", "\\u", "context_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "drop", "\\u", "graceful", "ly_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Drop", " ", "worker", " ", "task", " ", "graceful", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "current", " ", "shard", "\\u", "state", " ", "to", " ", "fail", "ed", ".", " ", "Controlle", "r", " ", "logic", " ", "will", " ", "take", " ", "care", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "other", " ", "shard", "s", " ", "and", " ", "the", " ", "entire", " ", "MR", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "id_", "=_", "self_", "._", "request_", "._", "headers_", "[_", "util_", "._", "\\u", "MR", "\\u", "SHAR", "D", "\\u", "ID", "\\u", "TASK", "\\u", "HEADER_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mr", "\\u", "id_", "=_", "self_", "._", "request_", "._", "headers_", "[_", "util_", "._", "\\u", "MR", "\\u", "ID", "\\u", "TASK", "\\u", "HEADER_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "state_", ",_", "mr", "\\u", "state_", "=_", "db_", "._", "get_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "Shard", "State_", "._", "get", "\\u", "key", "\\u", "by", "\\u", "shard", "\\u", "id_", "(_", "shard", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "Map", "reduce", "State_", "._", "get", "\\u", "key", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "mr", "\\u", "id_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shard", "\\u", "state_", "and_", "shard", "\\u", "state_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "state_", "._", "set\\u", "for", "\\u", "failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "util_", "._", "create", "\\u", "datast", "ore", "\\u", "write", "\\u", "config_", "(_", "mr", "\\u", "state_", "._", "mapreduce", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "state_", "._", "put_", "(_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "try", "\\u", "acquir", "e\\u", "lease_", "(_", "self_", ",_", "shard", "\\u", "state_", ",_", "tsta", "te_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Validate", " ", "datast", "ore", " ", "and", " ", "the", " ", "task", " ", "payload", " ", "are", " ", "consistent", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "so", ",", " ", "atte", "mpt", " ", "to", " ", "get", " ", "a", " ", "lease", " ", "on", " ", "this", " ", "slice", "'", "s", " ", "executi", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "model", ".", "Shard", "State", " ", "doc", " ", "on", " ", "slice", "\\u", "start", "\\u", "time", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "model", ".", "Shard", "State", " ", "from", " ", "datast", "ore", ".", "\\", "10", ";", " ", " ", "tsta", "te", ":", " ", "model", ".", "Transi", "ent", "Shard", "State", " ", "from", " ", "task", "queue", " ", "pay", "lod", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "\\u", "TASK", "\\u", "DIRECT", "IV", "E", " ", "enum", ".", " ", "PROC", "EE", "D", "\\u", "TASK", " ", "if", " ", "lock", " ", "is", " ", "acquired", ".", "\\", "10", ";", " ", " ", " ", " ", "RETRY", "\\u", "TASK", " ", "if", " ", "task", " ", "shou", "ld", " ", "be", " ", "retrie", "d", ",", " ", "DROP", "\\u", "TASK", " ", "if", " ", "task", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "dropped", ".", " ", "On", "ly", " ", "old", " ", "task", "s", " ", "(", "compa", "ring", " ", "to", " ", "datast", "ore", " ", "state", ")", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "dropped", ".", " ", "Fu", "ture", " ", "task", "s", " ", "are", " ", "retrie", "d", " ", "unti", "l", " ", "the", "y", " ", "natur", "ally", "\\", "10", ";", " ", " ", " ", " ", "bec", "ome", " ", "old", " ", "so", " ", "tha", "t", " ", "we", " ", "don", "'", "t", " ", "ever", " ", "stu", "ck", " ", "MR", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Controlle", "r", " ", "will", " ", "tally", " ", "shard", "\\u", "state", "s", " ", "and", " ", "proper", "ly", " ", "handle", " ", "the", " ", "situation", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "shard", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "State", " ", "not", " ", "found", " ", "for", " ", "shard", " ", "%", "s", ";", " ", "Poss", "ibl", "e", " ", "spu", "rio", "us", " ", "task", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "executi", "on", ".", " ", "Dropp", "ing", " ", "this", " ", "task", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "shard", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "DROP", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "shard", "\\u", "state_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Shard", " ", "%", "s", " ", "is", " ", "not", " ", "active", ".", " ", "Poss", "ibl", "e", " ", "spu", "rio", "us", " ", "task", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "executi", "on", ".", " ", "Dropp", "ing", " ", "this", " ", "task", ".\"_", ",_", "tsta", "te_", "._", "shard", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "warning_", "(_", "str_", "(_", "shard", "\\u", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "DROP", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "shard", " ", "retr", "y", " ", "count", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "shard", "\\u", "state_", "._", "retries_", ">_", "tsta", "te_", "._", "retries_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Got", " ", "shard", " ", "%", "s", " ", "from", " ", "previ", "ous", " ", "shard", " ", "retr", "y", " ", "%", "s", ".", " ", "Poss", "ibl", "e", " ", "spu", "rio", "us", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "task", " ", "executi", "on", ".", " ", "Dropp", "ing", " ", "this", " ", "task", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "shard", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "retries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "warning_", "(_", "str_", "(_", "shard", "\\u", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "DROP", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "shard", "\\u", "state_", "._", "retries_", "<_", "tsta", "te_", "._", "retries_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "By", " ", "the", " ", "end", " ", "of", " ", "last", " ", "slice", ",", " ", "task", " ", "enqueue", " ", "succe", "eded", " ", "but", " ", "datast", "ore", " ", "commit_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fail", "ed", ".", " ", "Tha", "t", " ", "transaction", " ", "will", " ", "be", " ", "retrie", "d", " ", "and", " ", "addin", "g", " ", "the", " ", "same", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "pass", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Shard", "State", " ", "for", " ", "%", "s", " ", "is", " ", "beh", "ind", " ", "slice", ".", " ", "Wait", "ing", " ", "for", " ", "it", " ", "to", " ", "catch", " ", "up", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "shard", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "slice", " ", "id", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Task", "queue", " ", "execute", "s", " ", "old", " ", "success", "ful", " ", "task", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "shard", "\\u", "state_", "._", "slice", "\\u", "id_", ">_", "tsta", "te_", "._", "slice", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Task", " ", "%", "s", "-%", "s", " ", "is", " ", "beh", "ind", " ", "Shard", "State", " ", "%", "s", ".", " ", "Dropp", "ing", " ", "task", ".\"_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "shard", "\\u", "id_", ",_", "tsta", "te_", "._", "slice", "\\u", "id_", ",_", "shard", "\\u", "state_", "._", "slice", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "DROP", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "By", " ", "the", " ", "end", " ", "of", " ", "last", " ", "slice", ",", " ", "task", " ", "enqueue", " ", "succe", "eded", " ", "but", " ", "datast", "ore", " ", "commit_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fail", "ed", ".", " ", "Tha", "t", " ", "transaction", " ", "will", " ", "be", " ", "retrie", "d", " ", "and", " ", "addin", "g", " ", "the", " ", "same", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "pass", ".", " ", "User", " ", "data", " ", "is", " ", "duplicated", " ", "in", " ", "this", " ", "case", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "shard", "\\u", "state_", "._", "slice", "\\u", "id_", "<_", "tsta", "te_", "._", "slice", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Task", " ", "%", "s", "-%", "s", " ", "is", " ", "ahe", "ad", " ", "of", " ", "Shard", "State", " ", "%", "s", ".", " ", "Wait", "ing", " ", "for", " ", "it", " ", "to", " ", "catch", " ", "up", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "shard", "\\u", "id_", ",_", "tsta", "te_", "._", "slice", "\\u", "id_", ",_", "shard", "\\u", "state_", "._", "slice", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "potenti", "al", " ", "duplicated", " ", "task", "s", " ", "for", " ", "the", " ", "same", " ", "slice", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "model", ".", "Shard", "State", " ", "doc", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "shard", "\\u", "state_", "._", "slice", "\\u", "start", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "countdown", "_", "=_", "self_", "._", "\\u", "wait", "\\u", "time_", "(_", "shard", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "._", "\\u", "LEA", "SE", "\\u", "DURATION", "\\u", "SEC", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "countdown", "_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Las", "t", " ", "retr", "y", " ", "of", " ", "slice", " ", "%", "s", "-%", "s", " ", "may", " ", "be", " ", "still", " ", "runn", "ing", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Wil", "l", " ", "try", " ", "again", " ", "in", " ", "%", "s", " ", "second", "s", "\"_", ",_", "tsta", "te_", "._", "shard", "\\u", "id_", ",_", "tsta", "te_", "._", "slice", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "countdown", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "(", "user", "):", " ", "There", " ", "mig", "ht", " ", "be", " ", "a", " ", "bett", "er", " ", "way", ".", " ", "Task", "queue", "'", "s", " ", "countdown", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "appli", "es", " ", "to", " ", "add", " ", "new", " ", "task", "s", ",", " ", "not", " ", "retr", "y", " ", "of", " ", "task", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Reduce", " ", "content", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "countdown", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "lease", " ", "coul", "d", " ", "have", " ", "expir", "ed", ".", " ", "Verify", " ", "with", " ", "logs", " ", "API", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "wait", "\\u", "time_", "(_", "shard", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "._", "\\u", "MAX", "\\u", "LEA", "SE", "\\u", "DURATION", "\\u", "SEC", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "has", "\\u", "old", "\\u", "request", "\\u", "ended_", "(_", "shard", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Las", "t", " ", "retr", "y", " ", "of", " ", "slice", " ", "%", "s", "-%", "s", " ", "is", " ", "still", " ", "in", " ", "flight", " ", "with", " ", "request", "\\u", "id", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", ".", " ", "Wil", "l", " ", "try", " ", "again", " ", "late", "r", ".\"_", ",_", "tsta", "te_", "._", "shard", "\\u", "id_", ",_", "tsta", "te_", "._", "slice", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "slice", "\\u", "request", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "TASK", "_", "\\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 ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Las", "t", " ", "retr", "y", " ", "of", " ", "slice", " ", "%", "s", "-%", "s", " ", "has", " ", "no", " ", "log", " ", "entry", " ", "and", " ", "has", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "timed", " ", "out", " ", "after", " ", "%", "s", " ", "second", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "shard", "\\u", "id_", ",_", "tsta", "te_", "._", "slice", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "._", "\\u", "MAX", "\\u", "LEA", "SE", "\\u", "DURATION", "\\u", "SEC", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Leas", "e", " ", "expir", "ed", " ", "or", " ", "slice", "\\u", "start", "\\u", "time", " ", "not", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "=_", "util_", "._", "create", "\\u", "datast", "ore", "\\u", "write", "\\u", "config_", "(_", "tsta", "te_", "._", "mapreduce", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "db_", "._", "transaction", "al_", "(_", "retries_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "tx_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "e", " ", "datast", "ore", " ", "to", " ", "set", " ", "slice", "\\u", "start", "\\u", "time", " ", "to", " ", "now", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "If", " ", "fail", "ed", " ", "for", " ", "any", " ", "reason", ",", " ", "raise", " ", "error", " ", "to", " ", "retr", "y", " ", "the", " ", "task", " ", "(", "hen", "ce", " ", "all", "\\", "10", ";", " ", " ", "the", " ", "previ", "ous", " ", "validation", " ", "code", ").", " ", "The", " ", "task", " ", "wou", "ld", " ", "die", " ", "natur", "ally", " ", "eventual", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "Roll", "back", ":", " ", "If", " ", "the", " ", "shard", " ", "state", " ", "is", " ", "missi", "ng", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "\\u", "TASK", "\\u", "DIRECT", "IV", "E", " ", "enum", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fresh", "\\u", "state_", "=_", "model_", "._", "Shard", "State_", "._", "get", "\\u", "by", "\\u", "shard", "\\u", "id_", "(_", "tsta", "te_", "._", "shard", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fresh", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Shard", "State", " ", "missi", "ng", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "db_", "._", "Roll", "back_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "fresh", "\\u", "state_", "._", "active_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "fresh", "\\u", "state_", "._", "slice", "\\u", "id_", "==_", "shard", "\\u", "state_", "._", "slice", "\\u", "id_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "fresh", "\\u", "state_", "._", "slice", "\\u", "start", "\\u", "time_", "==_", "shard", "\\u", "state_", "._", "slice", "\\u", "start", "\\u", "time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "state_", "._", "slice", "\\u", "start", "\\u", "time_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "state_", "._", "slice", "\\u", "request", "\\u", "id_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "REQUEST", "\\u", "LOG", "\\u", "ID", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "state_", "._", "acquired", "\\u", "once_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "state_", "._", "put_", "(_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "PROC", "EE", "D", "\\u", "TASK", "_", "\\u\\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_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Conten", "tion", " ", "on", " ", "slice", " ", "%", "s", "-%", "s", " ", "executi", "on", ".", " ", "Wil", "l", " ", "retr", "y", " ", "again", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "shard", "\\u", "id_", ",_", "tsta", "te_", "._", "slice", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "One", " ", "propos", "er", " ", "shou", "ld", " ", "win", ".", " ", "In", " ", "case", " ", "all", " ", "lost", ",", " ", "back", " ", "off", " ", "arbitra", "ri", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "sleep_", "(_", "random_", "._", "randrange_", "(_", "1_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "tx_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "has", "\\u", "old", "\\u", "request", "\\u", "ended_", "(_", "self_", ",_", "shard", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Whe", "ther", " ", "previ", "ous", " ", "slice", " ", "retr", "y", " ", "has", " ", "ende", "d", " ", "according", " ", "to", " ", "Log", "s", " ", "API", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "shard", " ", "state", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Tru", "e", " ", "if", " ", "the", " ", "request", " ", "of", " ", "previ", "ous", " ", "slice", " ", "retr", "y", " ", "has", " ", "ende", "d", ".", " ", "Fal", "se", " ", "if", " ", "it", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "or", " ", "unknown", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "shard", "\\u", "state_", "._", "slice", "\\u", "start", "\\u", "time_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "shard", "\\u", "state_", "._", "slice", "\\u", "request", "\\u", "id_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "ids_", "=_", "[_", "shard", "\\u", "state_", "._", "slice", "\\u", "request", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logs_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", "=_", "list_", "(_", "logs", "ervice", "_", "._", "fetch_", "(_", "request", "\\u", "ids_", "=_", "request", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "api", "proxy", "\\u", "errors_", "._", "Feature", "Not", "Enable", "d", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "api", "proxy", "\\u", "errors_", "._", "Capa", "bilit", "y", "Disa", "ble", "d", "Error_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Manage", "d", " ", "VM", "s", " ", "do", " ", "not", " ", "have", " ", "access", " ", "to", " ", "the", " ", "logs", "ervice", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "https", "://", "group", "s", ".", "google", ".", "com", "/", "forum", "/", "#!", "topic", "/", "app", "-", "eng", "ine", "-", "manage", "d", "-", "vms", "/", "r", "8", "i", "6", "5", "ui", "FW", "0", "w_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Ignor", "ing", " ", "exception", ":", " ", "%", "s", "\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "logs_", "or_", "not_", "logs_", "[_", "0_", "]_", "._", "finished_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "wait", "\\u", "time_", "(_", "self_", ",_", "shard", "\\u", "state_", ",_", "secs_", ",_", "now_", "=_", "datetime_", "._", "datetime_", "._", "now_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Time", " ", "to", " ", "wait", " ", "unti", "l", " ", "slice", "\\u", "start", "\\u", "time", " ", "is", " ", "secs", " ", "ago", " ", "from", " ", "now", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "shard", " ", "state", ".", "\\", "10", ";", " ", " ", "secs", ":", " ", "duration", " ", "in", " ", "second", "s", ".", "\\", "10", ";", " ", " ", "now", ":", " ", "a", " ", "func", " ", "tha", "t", " ", "gets", " ", "now", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "0", " ", "if", " ", "no", " ", "wait", ".", " ", "A", " ", "posit", "ive", " ", "int", " ", "in", " ", "second", "s", " ", "other", "wis", "e", ".", " ", "Al", "way", "s", " ", "aro", "und", " ", "up", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "shard", "\\u", "state_", "._", "slice", "\\u", "start", "\\u", "time_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "now_", "(_", ")_", "-_", "shard", "\\u", "state_", "._", "slice", "\\u", "start", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration_", "=_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "secs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "delta_", "<_", "duration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "util_", "._", "total", "\\u", "seconds_", "(_", "duration_", "-_", "delta_", ")_", "\\u\\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_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "try", "\\u", "free", "\\u", "lease_", "(_", "self_", ",_", "shard", "\\u", "state_", ",_", "slice", "\\u", "retry_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Tr", "y", " ", "to", " ", "free", " ", "lease", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "light", "weight", " ", "transaction", " ", "to", " ", "update", " ", "shard", "\\u", "state", " ", "and", " ", "unse", "t", "\\", "10", ";", " ", " ", " ", " ", "slice", "\\u", "start", "\\u", "time", " ", "to", " ", "allow", " ", "the", " ", "next", " ", "retr", "y", " ", "to", " ", "happ", "en", " ", "with", "out", " ", "blockin", "g", ".", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "don", "'", "t", " ", "care", " ", "if", " ", "this", " ", "fail", "s", " ", "or", " ", "not", " ", "bec", "aus", "e", " ", "the", " ", "lease", " ", "will", " ", "expir", "e", "\\", "10", ";", " ", " ", " ", " ", "anyway", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Under", " ", "normal", " ", "executi", "on", ",", " ", "\\u", "save", "\\u", "state", "\\u", "and", "\\u", "schedule", "\\u", "next", " ", "is", " ", "the", " ", "exit", " ", "point", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "update", "s", "/", "save", "s", " ", "shard", " ", "state", " ", "and", " ", "schedules", " ", "the", " ", "next", " ", "slice", " ", "or", " ", "return", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Ot", "her", " ", "exit", " ", "points", " ", "are", ":", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "\\u", "are", "\\u", "state", "s", "\\u", "consistent", ":", " ", "at", " ", "the", " ", "beginn", "ing", " ", "of", " ", "handle", ",", " ", "checks", "\\", "10", ";", " ", " ", "if", " ", "datast", "ore", " ", "state", "s", " ", "and", " ", "the", " ", "task", " ", "are", " ", "in", " ", "sync", ".", "\\", "10", ";", " ", " ", "If", " ", "not", ",", " ", "raise", " ", "or", " ", "return", ".", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "\\u", "atte", "mpt", "\\u", "slice", "\\u", "retr", "y", ":", " ", "may", " ", "raise", " ", "exception", " ", "to", " ", "task", "queue", ".", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "\\u", "save", "\\u", "state", "\\u", "and", "\\u", "schedule", "\\u", "next", ":", " ", "may", " ", "raise", " ", "exception", " ", "whe", "n", " ", "task", "queue", "/", "db", "\\", "10", ";", " ", " ", " ", "unreachable", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "handler", " ", "shou", "ld", " ", "try", " ", "to", " ", "free", " ", "the", " ", "lease", " ", "on", " ", "every", " ", "exception", "al", " ", "exit", " ", "point", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "model", ".", "Shard", "State", ".", "\\", "10", ";", " ", " ", "slice", "\\u", "retr", "y", ":", " ", "whe", "ther", " ", "to", " ", "count", " ", "this", " ", "as", " ", "a", " ", "fail", "ed", " ", "slice", " ", "executi", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "db_", "._", "transaction", "al_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "tx_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fresh", "\\u", "state_", "=_", "model_", "._", "Shard", "State_", "._", "get", "\\u", "by", "\\u", "shard", "\\u", "id_", "(_", "shard", "\\u", "state_", "._", "shard", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fresh", "\\u", "state_", "and_", "fresh", "\\u", "state_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Free", " ", "lease", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fresh", "\\u", "state_", "._", "slice", "\\u", "start", "\\u", "time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fresh", "\\u", "state_", "._", "slice", "\\u", "request", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "slice", "\\u", "retry_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fresh", "\\u", "state_", "._", "slice", "\\u", "retries_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fresh", "\\u", "state_", "._", "put_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "tx_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "broad", "-", "except_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Release", " ", "lock", " ", "for", " ", "shard", " ", "%", "s", " ", "fail", "ed", ".", " ", "Wait", " ", "for", " ", "lease", " ", "to", " ", "expir", "e", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "shard", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "maintain", "\\u", "LC", "_", "(_", "self_", ",_", "obj_", ",_", "slice", "\\u", "id_", ",_", "last", "\\u", "slice_", "=_", "False_", ",_", "begin", "\\u", "slice_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "ctx_", "=_", "None_", ",_", "slice", "\\u", "ctx_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", "s", " ", "sure", " ", "shard", " ", "life", " ", "cycle", " ", "interface", " ", "are", " ", "respec", "ted", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "obj", ":", " ", "the", " ", "obj", " ", "tha", "t", " ", "may", " ", "have", " ", "implemented", " ", "\\u", "Shard", "Life", "Cycle", ".", "\\", "10", ";", " ", " ", "slice", "\\u", "id", ":", " ", "current", " ", "slice", "\\u", "id", "\\", "10", ";", " ", " ", "last", "\\u", "slice", ":", " ", "whe", "ther", " ", "this", " ", "is", " ", "the", " ", "last", " ", "slice", ".", "\\", "10", ";", " ", " ", "begin", "\\u", "slice", ":", " ", "whe", "ther", " ", "this", " ", "is", " ", "the", " ", "beginn", "ing", " ", "or", " ", "the", " ", "end", " ", "of", " ", "a", " ", "slice", ".", "\\", "10", ";", " ", " ", "shard", "\\u", "ctx", ":", " ", "shard", " ", "ctx", " ", "for", " ", "dependen", "cy", " ", "injection", ".", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "will", " ", "be", " ", "read", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "self", ".", "\\", "10", ";", " ", " ", "slice", "\\u", "ctx", ":", " ", "slice", " ", "ctx", " ", "for", " ", "dependen", "cy", " ", "injection", ".", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "will", " ", "be", " ", "read", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "self", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "is_", "None_", "or_", "not_", "isinstance_", "(_", "obj_", ",_", "shard", "\\u", "life", "\\u", "cycle_", "._", "\\u", "Shard", "Life", "Cycle_", ")_", ":_", "\\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_", "shard", "\\u", "context_", "=_", "shard", "\\u", "ctx_", "or_", "self_", "._", "shard", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "context_", "=_", "slice", "\\u", "ctx_", "or_", "self_", "._", "slice", "\\u", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "begin", "\\u", "slice_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "slice", "\\u", "id_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "begin", "\\u", "shard_", "(_", "shard", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "._", "begin", "\\u", "slice_", "(_", "slice", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "end", "\\u", "slice_", "(_", "slice", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "slice_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "end", "\\u", "shard_", "(_", "shard", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "lc", "\\u", "start", "\\u", "slice_", "(_", "self_", ",_", "tsta", "te_", ",_", "slice", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "maintain", "\\u", "LC", "_", "(_", "tsta", "te_", "._", "output", "\\u", "writer_", ",_", "slice", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "maintain", "\\u", "LC", "_", "(_", "tsta", "te_", "._", "input", "\\u", "reader_", ",_", "slice", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "maintain", "\\u", "LC", "_", "(_", "tsta", "te_", "._", "handler_", ",_", "slice", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "lc", "\\u", "end", "\\u", "slice_", "(_", "self_", ",_", "tsta", "te_", ",_", "slice", "\\u", "id_", ",_", "last", "\\u", "slice_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "maintain", "\\u", "LC", "_", "(_", "tsta", "te_", "._", "handler_", ",_", "slice", "\\u", "id_", ",_", "last", "\\u", "slice_", "=_", "last", "\\u", "slice_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "begin", "\\u", "slice_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "maintain", "\\u", "LC", "_", "(_", "tsta", "te_", "._", "input", "\\u", "reader_", ",_", "slice", "\\u", "id_", ",_", "last", "\\u", "slice_", "=_", "last", "\\u", "slice_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "begin", "\\u", "slice_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "maintain", "\\u", "LC", "_", "(_", "tsta", "te_", "._", "output", "\\u", "writer_", ",_", "slice", "\\u", "id_", ",_", "last", "\\u", "slice_", "=_", "last", "\\u", "slice_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "begin", "\\u", "slice_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "has", " ", "to", " ", "be", " ", "care", "ful", " ", "to", " ", "pass", " ", "the", " ", "same", " ", "Shard", "State", " ", "instance", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "its", " ", "subro", "utine", "s", " ", "calls", " ", "if", " ", "the", " ", "calls", " ", "mutate", " ", "or", " ", "read", " ", "from", " ", "Shard", "State", ".", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "especial", "ly", " ", "tha", "t", " ", "Context", " ", "instance", " ", "cache", "s", " ", "and", " ", "update", "s", " ", "the", " ", "Shard", "State", "\\", "10", ";", " ", " ", " ", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Set", " ", "HTTP", " ", "status", " ", "code", " ", "and", " ", "alw", "ay", "s", " ", "return", "s", " ", "Non", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Recon", "struct", " ", "basic", " ", "state", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "start", "\\u", "time_", "=_", "self_", "._", "\\u", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "id_", "=_", "self_", "._", "request_", "._", "headers_", "[_", "util_", "._", "\\u", "MR", "\\u", "SHAR", "D", "\\u", "ID", "\\u", "TASK", "\\u", "HEADER_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mr", "\\u", "id_", "=_", "self_", "._", "request_", "._", "headers_", "[_", "util_", "._", "\\u", "MR", "\\u", "ID", "\\u", "TASK", "\\u", "HEADER_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spec_", "=_", "model_", "._", "Map", "reduce", "Spec_", "._", "\\u", "get", "\\u", "mapreduce", "\\u", "spec_", "(_", "mr", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "state_", ",_", "control_", "=_", "db_", "._", "get_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "Shard", "State_", "._", "get", "\\u", "key", "\\u", "by", "\\u", "shard", "\\u", "id_", "(_", "shard", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "Map", "reduce", "Control_", "._", "get", "\\u", "key", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "mr", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "context", " ", "bef", "ore", " ", "any", " ", "IO", " ", "code", " ", "is", " ", "call", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "=_", "context_", "._", "Context_", "(_", "spec_", ",_", "shard", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "retr", "y", "\\u", "count_", "=_", "self_", "._", "task", "\\u", "retr", "y", "\\u", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "Context_", "._", "\\u", "set_", "(_", "ctx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unma", "rsh", "all", " ", "input", " ", "reader", ",", " ", "output", " ", "writer", ",", " ", "and", " ", "other", " ", "transient", " ", "state", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "=_", "model_", "._", "Transi", "ent", "Shard", "State_", "._", "from", "\\u", "request_", "(_", "self_", "._", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "acquir", "e", " ", "a", " ", "lease", " ", "on", " ", "the", " ", "shard", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shard", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "this", "\\u", "a", "\\u", "retry_", "=_", "shard", "\\u", "state_", "._", "acquired", "\\u", "once_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "task", "\\u", "directive_", "=_", "self_", "._", "\\u", "try", "\\u", "acquir", "e\\u", "lease_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "task", "\\u", "directive_", "in_", "(_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "TASK", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "DROP", "\\u", "TASK", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "return_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "task", "\\u", "directive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "PROC", "EE", "D", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Abo", "rt", " ", "shard", " ", "if", " ", "receive", "d", " ", "signal", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "control_", "and_", "control_", "._", "command_", "==_", "model_", "._", "Map", "reduce", "Control_", "._", "ABORT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "directive_", "=_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "ABORT", "\\u", "SHAR", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "return_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "task", "\\u", "directive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Retr", "y", " ", "shard", " ", "if", " ", "user", " ", "disable", "d", " ", "slice", " ", "retr", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "is", "\\u", "this", "\\u", "a", "\\u", "retry_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "._", "config_", "._", "TASK", "\\u", "MAX", "\\u", "DATA", "\\u", "PROCESS", "ING", "\\u", "ATTE", "MPT", "S_", "<=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "directive_", "=_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "SHAR", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "return_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "task", "\\u", "directive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "user", "):", " ", "Fin", "d", " ", "a", " ", "bett", "er", " ", "way", " ", "to", " ", "set", " ", "these", " ", "per", " ", "thread", " ", "configs", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "E", ".", "g", ".", " ", "what", " ", "if", " ", "user", " ", "change", " ", "it", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "util_", "._", "\\u", "set\\u", "ndb", "\\u", "cache", "\\u", "policy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "job", "\\u", "config_", "=_", "map", "\\u", "job_", "._", "Jo", "b", "Config_", "._", "\\u", "to", "\\u", "map", "\\u", "job", "\\u", "config_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "HTTP", "\\u", "X", "\\u", "APPEN", "GIN", "E", "\\u", "QUEUE", "NAME", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "context_", "=_", "map", "\\u", "job", "\\u", "context_", "._", "Jo", "b", "Context_", "(_", "job", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shard", "\\u", "context_", "=_", "map", "\\u", "job", "\\u", "context_", "._", "Shard", "Context_", "(_", "job", "\\u", "context_", ",_", "shard", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "slice", "\\u", "context_", "=_", "map", "\\u", "job", "\\u", "context_", "._", "Slice", "Context_", "(_", "self_", "._", "shard", "\\u", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice", "\\u", "id_", "=_", "tsta", "te_", "._", "slice", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lc", "\\u", "start", "\\u", "slice_", "(_", "tsta", "te_", ",_", "slice", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shard", "\\u", "state_", "._", "is", "\\u", "input", "\\u", "finished_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lc", "\\u", "end", "\\u", "slice_", "(_", "tsta", "te_", ",_", "slice", "\\u", "id_", ",_", "last", "\\u", "slice_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Finali", "ze", " ", "the", " ", "stream", " ", "and", " ", "set", " ", "status", " ", "if", " ", "there", "'", "s", " ", "no", " ", "more", " ", "input", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "tsta", "te_", "._", "output", "\\u", "writer_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "tsta", "te_", "._", "output", "\\u", "writer_", ",_", "output", "\\u", "writers_", "._", "Output", "Writer_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "possib", "le", " ", "tha", "t", " ", "finali", "zatio", "n", " ", "is", " ", "success", "ful", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "saving", " ", "state", " ", "fail", "ed", ".", " ", "In", " ", "this", " ", "case", " ", "this", " ", "shard", " ", "will", " ", "retr", "y", " ", "upo", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "finali", "zatio", "n", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "user", "):", " ", "make", " ", "finalize", " ", "method", " ", "idempotent", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tsta", "te_", "._", "output", "\\u", "writer_", "._", "finalize_", "(_", "ctx_", ",_", "shard", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shard", "\\u", "state_", "._", "set\\u", "for", "\\u", "success_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "return_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "task", "\\u", "directive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "this", "\\u", "a", "\\u", "retry_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "directive_", "=_", "self_", "._", "\\u", "atte", "mpt", "\\u", "slice", "\\u", "recover", "y_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "task", "\\u", "directive_", "!=_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "PROC", "EE", "D", "\\u", "TASK", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "return_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "task", "\\u", "directive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "slice_", "=_", "self_", "._", "\\u", "process", "\\u", "inputs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "input", "\\u", "reader_", ",_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "ctx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "lc", "\\u", "end", "\\u", "slice_", "(_", "tsta", "te_", ",_", "slice", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "last", "\\u", "slice_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "don", "e", " ", "process", "ing", " ", "data", " ", "but", " ", "we", " ", "still", " ", "need", " ", "to", " ", "finalize", " ", "the", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stream", ".", " ", "We", " ", "save", " ", "this", " ", "condition", " ", "in", " ", "datast", "ore", " ", "and", " ", "force", " ", "a", " ", "new", " ", "slice", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tha", "t", " ", "way", " ", "if", " ", "finalize", " ", "fail", "s", " ", "no", " ", "input", " ", "data", " ", "will", " ", "be", " ", "retrie", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "state_", "._", "set\\u", "input", "\\u", "finished_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "broad", "-", "except_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Shard", " ", "%", "s", " ", "got", " ", "error", ".\"_", ",_", "shard", "\\u", "state_", "._", "shard", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "error_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fail", " ", "fast", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type_", "(_", "e_", ")_", "is_", "errors_", "._", "Fail", "Jo", "b", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Got", " ", "Fail", "Jo", "b", "Error", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "directive_", "=_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "FAIL", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "directive_", "=_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "SLI", "CE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "return_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "task", "\\u", "directive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "return_", "(_", "self_", ",_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "task", "\\u", "directive_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", "r", " ", "shou", "ld", " ", "alw", "ay", "s", " ", "call", " ", "this", " ", "as", " ", "the", " ", "last", " ", "statem", "ent", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "directive_", "=_", "self_", "._", "\\u", "set\\u", "state_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "task", "\\u", "directive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "save", "\\u", "state", "\\u", "and", "\\u", "schedule", "\\u", "next_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "task", "\\u", "directive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "Context_", "._", "\\u", "set_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process", "\\u", "inputs_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "reader_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Read", " ", "inputs", ",", " ", "process", " ", "them", ",", " ", "and", " ", "write", " ", "out", " ", "output", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "core", " ", "logic", " ", "of", " ", "Map", "Reduce", ".", " ", "It", " ", "reads", " ", "inputs", " ", "from", " ", "input", " ", "reader", ",", "\\", "10", ";", " ", " ", " ", " ", "invoke", "s", " ", "user", " ", "specified", " ", "mapper", " ", "function", ",", " ", "and", " ", "writes", " ", "output", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "output", " ", "writer", ".", " ", "It", " ", "als", "o", " ", "update", "s", " ", "shard", "\\u", "state", " ", "according", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".", " ", "if", " ", "shard", " ", "process", "ing", " ", "is", " ", "don", "e", ",", " ", "set", " ", "shard", "\\u", "state", ".", "active", " ", "to", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "error", "s", ".", "Fail", "Jo", "b", "Error", " ", "is", " ", "cau", "ght", ",", " ", "it", " ", "will", " ", "fail", " ", "this", " ", "MR", " ", "job", ".", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "other", " ", "exception", "s", " ", "will", " ", "be", " ", "logged", " ", "and", " ", "raise", "d", " ", "to", " ", "task", "queue", " ", "for", " ", "retr", "y", "\\", "10", ";", " ", " ", " ", " ", "unti", "l", " ", "the", " ", "number", " ", "of", " ", "retrie", "s", " ", "exceed", "s", " ", "a", " ", "limit", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "input", "\\u", "reader", ":", " ", "input", " ", "reader", ".", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "shard", " ", "state", ".", "\\", "10", ";", " ", " ", "tsta", "te", ":", " ", "transient", " ", "shard", " ", "state", ".", "\\", "10", ";", " ", " ", "ctx", ":", " ", "mapreduce", " ", "context", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Whe", "ther", " ", "this", " ", "shard", " ", "has", " ", "finish", "ed", " ", "process", "ing", " ", "all", " ", "its", " ", "input", " ", "split", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ing", "\\u", "limit_", "=_", "self_", "._", "\\u", "process", "ing", "\\u", "limit_", "(_", "tsta", "te_", "._", "mapreduce", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "process", "ing", "\\u", "limit_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finish", "ed", "\\u", "shard_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Inp", "ut", " ", "reader", " ", "may", " ", "not", " ", "be", " ", "an", " ", "iter", "ator", ".", " ", "It", " ", "is", " ", "only", " ", "a", " ", "container", "._", "\\u\\u\\uNL\\u\\u\\u_", "iterator_", "=_", "iter_", "(_", "input", "\\u", "reader_", ")_", "\\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 ", " _", "entity_", "=_", "iterator_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reading", " ", "input", " ", "got", " ", "exception", ".", " ", "If", " ", "we", " ", "assume", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "The", " ", "input", " ", "reader", " ", "have", " ", "don", "e", " ", "eno", "ugh", " ", "retrie", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "The", " ", "input", " ", "reader", " ", "can", " ", "still", " ", "serialize", " ", "correct", "ly", " ", "after", " ", "this", " ", "exception", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", ".", " ", "The", " ", "input", " ", "reader", ",", " ", "upo", "n", " ", "resum", "e", ",", " ", "will", " ", "try", " ", "to", " ", "re", "-", "read", " ", "this", " ", "failed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "record", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "4", ".", " ", "Thi", "s", " ", "exception", " ", "doe", "sn", "'", "t", " ", "impl", "y", " ", "the", " ", "input", " ", "reader", " ", "is", " ", "permanent", "ly", " ", "stu", "ck", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "can", " ", "serialize", " ", "current", " ", "slice", " ", "immediate", "ly", " ", "to", " ", "avoid", " ", "duplicated", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "user", "):", " ", "Validate", " ", "these", " ", "assumption", "s", " ", "on", " ", "all", " ", "reader", "s", ".", " ", "MR", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "als", "o", " ", "have", " ", "a", " ", "way", " ", "to", " ", "detect", " ", "fake", " ", "forward", " ", "progress", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "entity_", ",_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "state_", "._", "last", "\\u", "work", "\\u", "item_", "=_", "repr_", "(_", "entity_", "._", "key_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "entity_", ",_", "ndb_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "state_", "._", "last", "\\u", "work", "\\u", "item_", "=_", "repr_", "(_", "entity_", "._", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "state_", "._", "last", "\\u", "work", "\\u", "item_", "=_", "repr_", "(_", "entity_", ")_", "[_", ":_", "100_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "process", "ing", "\\u", "limit_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "process", "\\u", "datum_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", ",_", "input", "\\u", "reader_", ",_", "ctx_", ",_", "tsta", "te_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "finish", "ed", "\\u", "shard_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "process", "ing", "\\u", "limit_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "finish", "ed", "\\u", "shard_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Flu", "sh", " ", "context", " ", "and", " ", "its", " ", "pools", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "slice", "\\u", "context_", "._", "incr_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "._", "COUNTER", "\\u", "MAP", "PER", "\\u", "WALL", "TIME", "\\u", "MS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "(_", "self_", "._", "\\u", "time_", "(_", ")_", "-_", "self_", "._", "\\u", "start", "\\u", "time_", ")_", "*_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "finish", "ed", "\\u", "shard_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process", "\\u", "datum_", "(_", "self_", ",_", "data_", ",_", "input", "\\u", "reader_", ",_", "ctx_", ",_", "transient", "\\u", "shard", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Process", " ", "a", " ", "single", " ", "data", " ", "piece", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Call", " ", "mapper", " ", "handler", " ", "on", " ", "the", " ", "data", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "data", ":", " ", "a", " ", "dat", "um", " ", "to", " ", "process", ".", "\\", "10", ";", " ", " ", "input", "\\u", "reader", ":", " ", "input", " ", "reader", ".", "\\", "10", ";", " ", " ", "ctx", ":", " ", "mapreduce", " ", "context", "\\", "10", ";", " ", " ", "transient", "\\u", "shard", "\\u", "state", ":", " ", "transient", " ", "shard", " ", "state", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Tru", "e", " ", "if", " ", "scan", " ", "shou", "ld", " ", "be", " ", "continue", "d", ",", " ", "Fal", "se", " ", "if", " ", "scan", " ", "shou", "ld", " ", "be", " ", "stopp", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "is_", "not_", "input", "\\u", "readers_", "._", "ALLOW", "\\u", "CHECK", "POINT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "slice", "\\u", "context_", "._", "incr_", "(_", "context_", "._", "COUNTER", "\\u", "MAP", "PER", "\\u", "CALL", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "transient", "\\u", "shard", "\\u", "state_", "._", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "handler_", ",_", "map", "\\u", "job_", "._", "Mapper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "(_", "self_", "._", "slice", "\\u", "context_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "input", "\\u", "reader_", "._", "expand", "\\u", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "handler_", "(_", "*_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "handler_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "util_", "._", "is", "\\u", "generator_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "output_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "output_", ",_", "operation_", "._", "Operation_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "(_", "ctx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "writer_", "=_", "transient", "\\u", "shard", "\\u", "state_", "._", "output", "\\u", "writer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "output", "\\u", "writer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Handle", "r", " ", "yield", "ed", " ", "%", "s", ",", " ", "but", " ", "no", " ", "output", " ", "writer", " ", "is", " ", "set", ".\"_", ",_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "writer_", "._", "write_", "(_", "output_", ")_", "\\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_", "self_", "._", "\\u", "time_", "(_", ")_", "-_", "self_", "._", "\\u", "start", "\\u", "time_", ">=_", "parameters_", "._", "config_", "._", "\\u", "SLI", "CE", "\\u", "DURATION", "\\u", "SEC", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "state_", "(_", "self_", ",_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "task", "\\u", "directive_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "shard", "\\u", "state", " ", "and", " ", "tsta", "te", " ", "based", " ", "on", " ", "task", "\\u", "directive", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "model", ".", "Shard", "State", " ", "for", " ", "current", " ", "shard", ".", "\\", "10", ";", " ", " ", "tsta", "te", ":", " ", "model", ".", "Transi", "ent", "Shard", "State", " ", "for", " ", "current", " ", "shard", ".", "\\", "10", ";", " ", " ", "task", "\\u", "directive", ":", " ", "self", ".\\u", "TASK", "\\u", "DIRECT", "IV", "E", " ", "for", " ", "current", " ", "shard", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "\\u", "TASK", "\\u", "DIRECT", "IV", "E", " ", "enum", ".", "\\", "10", ";", " ", " ", "PROC", "EE", "D", "\\u", "TASK", " ", "if", " ", "task", " ", "shou", "ld", " ", "proceed", " ", "normal", "ly", ".", "\\", "10", ";", " ", " ", "RETRY", "\\u", "SHAR", "D", " ", "if", " ", "shard", " ", "shou", "ld", " ", "be", " ", "retrie", "d", ".", "\\", "10", ";", " ", " ", "RETRY", "\\u", "SLI", "CE", " ", "if", " ", "slice", " ", "shou", "ld", " ", "be", " ", "retrie", "d", ".", "\\", "10", ";", " ", " ", "FAIL", "\\u", "TASK", " ", "if", " ", "sa", "hr", "d", " ", "shou", "ld", " ", "fail", ".", "\\", "10", ";", " ", " ", "RECO", "VER", "\\u", "SLI", "CE", " ", "if", " ", "slice", " ", "shou", "ld", " ", "be", " ", "recovered", ".", "\\", "10", ";", " ", " ", "ABORT", "\\u", "SHAR", "D", " ", "if", " ", "shard", " ", "shou", "ld", " ", "be", " ", "abort", "ed", ".", "\\", "10", ";", " ", " ", "RETRY", "\\u", "TASK", " ", "if", " ", "task", " ", "shou", "ld", " ", "be", " ", "retrie", "d", ".", "\\", "10", ";", " ", " ", "DROP", "\\u", "TASK", " ", "if", " ", "task", " ", "shou", "ld", " ", "be", " ", "dropped", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "task", "\\u", "directive_", "in_", "(_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "TASK", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "DROP", "\\u", "TASK", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "task", "\\u", "directive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "ABORT", "\\u", "SHAR", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "state_", "._", "set\\u", "for", "\\u", "abort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "task", "\\u", "directive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "PROC", "EE", "D", "\\u", "TASK", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "state_", "._", "advance", "\\u", "for", "\\u", "next", "\\u", "slice_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tsta", "te_", "._", "advance", "\\u", "for", "\\u", "next", "\\u", "slice_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "task", "\\u", "directive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RECO", "VER", "\\u", "SLI", "CE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tsta", "te_", "._", "advance", "\\u", "for", "\\u", "next", "\\u", "slice_", "(_", "recover", "y", "\\u", "slice_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "state_", "._", "advance", "\\u", "for", "\\u", "next", "\\u", "slice_", "(_", "recover", "y", "\\u", "slice_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "task", "\\u", "directive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "SLI", "CE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "directive_", "=_", "self_", "._", "\\u", "atte", "mpt", "\\u", "slice", "\\u", "retry_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "SHAR", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "directive_", "=_", "self_", "._", "\\u", "atte", "mpt", "\\u", "shard", "\\u", "retry_", "(_", "shard", "\\u", "state_", ",_", "tsta", "te_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "FAIL", "\\u", "TASK", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "state_", "._", "set\\u", "for", "\\u", "failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "task", "\\u", "directive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "save", "\\u", "state", "\\u", "and", "\\u", "schedule", "\\u", "next_", "(_", "self_", ",_", "shard", "\\u", "state_", ",_", "tsta", "te_", ",_", "task", "\\u", "directive_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Save", " ", "state", " ", "and", " ", "schedule", " ", "task", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Save", " ", "shard", " ", "state", " ", "to", " ", "datast", "ore", ".", "\\", "10", ";", " ", " ", " ", " ", "Schedule", " ", "next", " ", "slice", " ", "if", " ", "need", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "HTTP", " ", "response", " ", "code", ".", "\\", "10", ";", " ", " ", " ", " ", "No", " ", "modification", " ", "to", " ", "any", " ", "shard", "\\u", "state", " ", "or", " ", "tsta", "te", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "model", ".", "Shard", "State", " ", "for", " ", "current", " ", "shard", ".", "\\", "10", ";", " ", " ", "tsta", "te", ":", " ", "model", ".", "Transi", "ent", "Shard", "State", " ", "for", " ", "current", " ", "shard", ".", "\\", "10", ";", " ", " ", "task", "\\u", "directive", ":", " ", "enum", " ", "\\u", "TASK", "\\u", "DIRECT", "IV", "E", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "task", " ", "to", " ", "retr", "y", " ", "if", " ", "applica", "ble", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spec_", "=_", "tsta", "te_", "._", "mapreduce", "\\u", "spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "DROP", "\\u", "TASK", "_", ":_", "\\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_", "task", "\\u", "directive_", "in_", "(_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "SLI", "CE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "TASK", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "HTTP", " ", "code", " ", "to", " ", "500", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "retr", "y", "\\u", "task_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "ABORT", "\\u", "SHAR", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Abo", "rti", "ng", " ", "shard", " ", "%", "d", " ", "of", " ", "job", " ", "'%", "s", "'\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "shard", "\\u", "number_", ",_", "shard", "\\u", "state_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "FAIL", "\\u", "TASK", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "critical_", "(_", "\"", "Shard", " ", "%", "s", " ", "fail", "ed", " ", "permanent", "ly", ".\"_", ",_", "shard", "\\u", "state_", "._", "shard", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "SHAR", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Shard", " ", "%", "s", " ", "is", " ", "goi", "ng", " ", "to", " ", "be", " ", "atte", "mpte", "d", " ", "for", " ", "the", " ", "%", "s", " ", "time", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "shard", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "retries_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "=_", "self_", "._", "\\u", "state", "\\u", "to", "\\u", "task_", "(_", "tsta", "te_", ",_", "shard", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RECO", "VER", "\\u", "SLI", "CE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Shard", " ", "%", "s", " ", "slice", " ", "%", "s", " ", "is", " ", "bei", "ng", " ", "recovered", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "shard", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "slice", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "=_", "self_", "._", "\\u", "state", "\\u", "to", "\\u", "task_", "(_", "tsta", "te_", ",_", "shard", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "task", "\\u", "directive_", "==_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "PROC", "EE", "D", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "countdown", "_", "=_", "self_", "._", "\\u", "get", "\\u", "countdown", "\\u", "for", "\\u", "next", "\\u", "slice_", "(_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "=_", "self_", "._", "\\u", "state", "\\u", "to", "\\u", "task_", "(_", "tsta", "te_", ",_", "shard", "\\u", "state_", ",_", "countdown", "_", "=_", "countdown", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepare", " ", "parameter", "s", " ", "for", " ", "db", " ", "transaction", " ", "and", " ", "task", "queue", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "queue", "\\u", "name_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "HTTP", "\\u", "X", "\\u", "APPEN", "GIN", "E", "\\u", "QUEUE", "NAME", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "test", " ", "only", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "user", "):", " ", "Remove", " ", "this", "._", "\\u\\u\\uNL\\u\\u\\u_", "\"", "default", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "util_", "._", "create", "\\u", "datast", "ore", "\\u", "write", "\\u", "config_", "(_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "db_", "._", "transaction", "al_", "(_", "retries_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "tx_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "Transa", "ction", " ", "help", "er", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fresh", "\\u", "shard", "\\u", "state_", "=_", "model_", "._", "Shard", "State_", "._", "get", "\\u", "by", "\\u", "shard", "\\u", "id_", "(_", "tsta", "te_", "._", "shard", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fresh", "\\u", "shard", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "db_", "._", "Roll", "back_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "fresh", "\\u", "shard", "\\u", "state_", "._", "active_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "worker", "\\u", "active", "\\u", "state", "\\u", "colli", "sion", "\"_", "in_", "\\u", "TEST", "\\u", "IN", "JE", "CT", "ED", "\\u", "FA", "ULT", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Shard", " ", "%", "s", " ", "is", " ", "not", " ", "active", ".", " ", "Poss", "ibl", "e", " ", "spu", "rio", "us", " ", "task", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "executi", "on", ".", " ", "Dropp", "ing", " ", "this", " ", "task", ".\"_", ",_", "tsta", "te_", "._", "shard", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "warning_", "(_", "\"", "Datas", "tore", "'", "s", " ", "%", "s", "\"_", ",_", "str_", "(_", "fresh", "\\u", "shard", "\\u", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "warning_", "(_", "\"", "Slice", "'", "s", " ", "%", "s", "\"_", ",_", "str_", "(_", "shard", "\\u", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fresh", "\\u", "shard", "\\u", "state_", "._", "copy", "\\u", "from_", "(_", "shard", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fresh", "\\u", "shard", "\\u", "state_", "._", "put_", "(_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "task", " ", "in", " ", "the", " ", "same", " ", "datast", "ore", " ", "transaction", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "way", " ", "we", " ", "guaran", "tee", " ", "task", "queue", " ", "is", " ", "neve", "r", " ", "beh", "ind", " ", "datast", "ore", " ", "state", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Old", " ", "task", "s", " ", "will", " ", "be", " ", "dropped", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fu", "ture", " ", "task", " ", "won", "'", "t", " ", "run", " ", "unti", "l", " ", "datast", "ore", " ", "state", "s", " ", "catche", "s", " ", "up", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "fresh", "\\u", "shard", "\\u", "state_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "addin", "g", " ", "task", " ", "transaction", "ally", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transaction", "al", " ", "enqueue", " ", "require", "s", " ", "task", "s", " ", "with", " ", "no", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "add", "\\u", "task_", "(_", "task_", ",_", "spec_", ",_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "tx_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "datast", "ore", "\\u", "errors_", "._", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "queue_", "._", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "runtime_", "._", "Dead", "line", "Exce", "eded", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "api", "proxy", "\\u", "errors_", "._", "Error_", ")_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Can", "'", "t", " ", "transaction", "ally", " ", "continue", " ", "shard", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Wil", "l", " ", "retr", "y", " ", "slice", " ", "%", "s", " ", "%", "s", " ", "for", " ", "the", " ", "%", "s", " ", "time", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "shard", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "slice", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "task", "\\u", "retr", "y", "\\u", "count_", "(_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "try", "\\u", "free", "\\u", "lease_", "(_", "shard", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "atte", "mpt", "\\u", "slice", "\\u", "recover", "y_", "(_", "self_", ",_", "shard", "\\u", "state_", ",_", "tsta", "te_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Recover", " ", "a", " ", "slice", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "run", " ", "whe", "n", " ", "a", " ", "slice", " ", "had", " ", "bee", "n", " ", "previ", "ously", " ", "atte", "mpte", "d", " ", "and", " ", "output", "\\", "10", ";", " ", " ", " ", " ", "may", " ", "have", " ", "bee", "n", " ", "writt", "en", ".", " ", "If", " ", "an", " ", "output", " ", "writer", " ", "require", "s", " ", "slice", " ", "recover", "y", ",", "\\", "10", ";", " ", " ", " ", " ", "we", " ", "run", " ", "tho", "se", " ", "logic", " ", "to", " ", "remove", " ", "output", " ", "duplicat", "es", ".", " ", "Ot", "her", "wis", "e", " ", "we", " ", "just", " ", "retr", "y", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "slice", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "recover", "y", " ", "is", " ", "need", "ed", ",", " ", "then", " ", "the", " ", "entire", " ", "slice", " ", "will", " ", "be", " ", "dedicated", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "recover", "y", " ", "logic", ".", " ", "No", " ", "data", " ", "process", "ing", " ", "will", " ", "take", " ", "place", ".", " ", "Thu", "s", " ", "we", " ", "call", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "slice", " ", "\"", "recover", "y", " ", "slice", "\".", " ", "Thi", "s", " ", "is", " ", "need", "ed", " ", "for", " ", "correct", "ness", ":", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "output", " ", "writer", " ", "instance", " ", "can", " ", "be", " ", "out", " ", "of", " ", "sync", " ", "from", " ", "its", " ", "physical", "\\", "10", ";", " ", " ", " ", " ", "medium", " ", "only", " ", "whe", "n", " ", "the", " ", "slice", " ", "die", "s", " ", "after", " ", "acq", "uri", "ng", " ", "the", " ", "shard", " ", "lock", " ", "but", " ", "bef", "ore", "\\", "10", ";", " ", " ", " ", " ", "committ", "ing", " ", "shard", " ", "state", " ", "to", " ", "db", ".", " ", "The", " ", "worst", " ", "fail", "ure", " ", "case", " ", "is", " ", "whe", "n", "\\", "10", ";", " ", " ", " ", " ", "shard", " ", "state", " ", "fail", "ed", " ", "to", " ", "commit", " ", "after", " ", "the", " ", "NAME", "D", " ", "task", " ", "for", " ", "the", " ", "next", " ", "slice", " ", "was", "\\", "10", ";", " ", " ", " ", " ", "adde", "d", ".", " ", "Thu", "s", ",", " ", "recover", "y", " ", "slice", " ", "has", " ", "a", " ", "special", " ", "logic", " ", "to", " ", "increment", " ", "current", "\\", "10", ";", " ", " ", " ", " ", "slice", "\\u", "id", " ", "n", " ", "to", " ", "n", "+", "2", ".", " ", "If", " ", "the", " ", "task", " ", "for", " ", "n", "+", "1", " ", "had", " ", "bee", "n", " ", "adde", "d", ",", " ", "it", " ", "will", " ", "be", " ", "dropped", "\\", "10", ";", " ", " ", " ", " ", "bec", "aus", "e", " ", "it", " ", "is", " ", "beh", "ind", " ", "shard", " ", "state", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "an", " ", "instance", " ", "of", " ", "Model", ".", "Shard", "State", ".", "\\", "10", ";", " ", " ", "tsta", "te", ":", " ", "an", " ", "instance", " ", "of", " ", "Model", ".", "Transi", "ent", "Shard", "State", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "\\u", "TASK", "\\u", "DIRECT", "IV", "E", ".", "PROC", "EE", "D", "\\u", "TASK", " ", "to", " ", "continue", " ", "with", " ", "this", " ", "retr", "y", ".", "\\", "10", ";", " ", " ", "\\u", "TASK", "\\u", "DIRECT", "IV", "E", ".", "RECO", "VER", "\\u", "SLI", "CE", " ", "to", " ", "recover", " ", "this", " ", "slice", ".", "\\", "10", ";", " ", " ", "The", " ", "next", " ", "slice", " ", "will", " ", "start", " ", "at", " ", "the", " ", "same", " ", "input", " ", "as", "\\", "10", ";", " ", " ", "this", " ", "slice", " ", "but", " ", "output", " ", "to", " ", "a", " ", "new", " ", "instance", " ", "of", " ", "output", " ", "writer", ".", "\\", "10", ";", " ", " ", "Comb", "inin", "g", " ", "output", "s", " ", "from", " ", "all", " ", "writer", " ", "instance", "s", " ", "is", " ", "up", " ", "to", " ", "implementation", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "spec_", "=_", "tsta", "te_", "._", "mapreduce", "\\u", "spec_", "._", "mapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "tsta", "te_", "._", "output", "\\u", "writer_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "output", "\\u", "writer_", "._", "\\u", "support", "s", "\\u", "slice", "\\u", "recover", "y_", "(_", "mapper", "\\u", "spec_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "PROC", "EE", "D", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tsta", "te_", "._", "output", "\\u", "writer_", "=_", "tsta", "te_", "._", "output", "\\u", "writer_", "._", "\\u", "recover_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "mapreduce", "\\u", "spec_", ",_", "shard", "\\u", "state_", "._", "shard", "\\u", "number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "retries_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RECO", "VER", "\\u", "SLI", "CE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "atte", "mpt", "\\u", "shard", "\\u", "retry_", "(_", "self_", ",_", "shard", "\\u", "state_", ",_", "tsta", "te_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Whe", "ther", " ", "to", " ", "retr", "y", " ", "shard", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "may", " ", "modif", "y", " ", "shard", "\\u", "state", " ", "and", " ", "tsta", "te", " ", "to", " ", "prepar", "e", " ", "for", " ", "retr", "y", " ", "or", " ", "fail", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "model", ".", "Shard", "State", " ", "for", " ", "current", " ", "shard", ".", "\\", "10", ";", " ", " ", "tsta", "te", ":", " ", "model", ".", "Transi", "ent", "Shard", "State", " ", "for", " ", "current", " ", "shard", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "\\u", "TASK", "\\u", "DIRECT", "IV", "E", " ", "enum", ".", " ", "RETRY", "\\u", "SHAR", "D", " ", "if", " ", "shard", " ", "shou", "ld", " ", "be", " ", "retrie", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "FAIL", "\\u", "TASK", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "attempts_", "=_", "shard", "\\u", "state_", "._", "retries_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shard", "\\u", "attempts_", ">=_", "parameters_", "._", "config_", "._", "SHAR", "D", "\\u", "MAX", "\\u", "ATTE", "MPT", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Shard", " ", "atte", "mpt", " ", "%", "s", " ", "exceed", "ed", " ", "%", "s", " ", "max", " ", "atte", "mpt", "s", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "attempts_", ",_", "parameters_", "._", "config_", "._", "SHAR", "D", "\\u", "MAX", "\\u", "ATTE", "MPT", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "FAIL", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tsta", "te_", "._", "output", "\\u", "writer_", "and_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "tsta", "te_", "._", "output", "\\u", "writer_", "._", "\\u", "support", "s", "\\u", "shard", "\\u", "retry_", "(_", "tsta", "te_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Output", " ", "writer", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "support", " ", "shard", " ", "retr", "y", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "output", "\\u", "writer_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "FAIL", "\\u", "TASK", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shard", "\\u", "state_", "._", "reset", "\\u", "for", "\\u", "retry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "warning_", "(_", "\"", "Shard", " ", "%", "s", " ", "atte", "mpt", " ", "%", "s", " ", "fail", "ed", " ", "with", " ", "up", " ", "to", " ", "%", "s", " ", "atte", "mpt", "s", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "shard", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "retries_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "._", "config_", "._", "SHAR", "D", "\\u", "MAX", "\\u", "ATTE", "MPT", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "writer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tsta", "te_", "._", "output", "\\u", "writer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "writer_", "=_", "tsta", "te_", "._", "output", "\\u", "writer_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "mapreduce", "\\u", "spec_", ",_", "shard", "\\u", "state_", "._", "shard", "\\u", "number_", ",_", "shard", "\\u", "attempts_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tsta", "te_", "._", "reset", "\\u", "for", "\\u", "retry_", "(_", "output", "\\u", "writer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "SHAR", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "atte", "mpt", "\\u", "slice", "\\u", "retry_", "(_", "self_", ",_", "shard", "\\u", "state_", ",_", "tsta", "te_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Atte", "mpt", " ", "to", " ", "retr", "y", " ", "this", " ", "slice", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "may", " ", "modif", "y", " ", "shard", "\\u", "state", " ", "and", " ", "tsta", "te", " ", "to", " ", "prepar", "e", " ", "for", " ", "retr", "y", " ", "or", " ", "fail", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "model", ".", "Shard", "State", " ", "for", " ", "current", " ", "shard", ".", "\\", "10", ";", " ", " ", "tsta", "te", ":", " ", "model", ".", "Transi", "ent", "Shard", "State", " ", "for", " ", "current", " ", "shard", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "\\u", "TASK", "\\u", "DIRECT", "IV", "E", " ", "enum", ".", " ", "RETRY", "\\u", "SLI", "CE", " ", "if", " ", "slice", " ", "shou", "ld", " ", "be", " ", "retrie", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "RETRY", "\\u", "SHAR", "D", " ", "if", " ", "shard", " ", "retr", "y", " ", "shou", "ld", " ", "be", " ", "atte", "mpte", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "shard", "\\u", "state_", "._", "slice", "\\u", "retries_", "+_", "1_", "<_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "._", "config_", "._", "TASK", "\\u", "MAX", "\\u", "DATA", "\\u", "PROCESS", "ING", "\\u", "ATTE", "MPT", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Slice", " ", "%", "s", " ", "%", "s", " ", "fail", "ed", " ", "for", " ", "the", " ", "%", "s", " ", "of", " ", "up", " ", "to", " ", "%", "s", " ", "atte", "mpt", "s", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "%", "s", " ", "of", " ", "%", "s", " ", "task", "queue", " ", "executi", "on", " ", "atte", "mpt", "s", ").", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Wil", "l", " ", "retr", "y", " ", "now", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "shard", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "slice", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "slice", "\\u", "retries_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "._", "config_", "._", "TASK", "\\u", "MAX", "\\u", "DATA", "\\u", "PROCESS", "ING", "\\u", "ATTE", "MPT", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "task", "\\u", "retr", "y", "\\u", "count_", "(_", ")_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "._", "config_", "._", "TASK", "\\u", "MAX", "\\u", "ATTE", "MPT", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Clear", " ", "info", " ", "relate", "d", " ", "to", " ", "current", " ", "exception", ".", " ", "Ot", "her", "wis", "e", ",", " ", "the", " ", "real_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calls", "tack", " ", "tha", "t", " ", "include", "s", " ", "a", " ", "frame", " ", "for", " ", "this", " ", "method", " ", "will", " ", "show", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "log", "._", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "exc", "\\u", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "try", "\\u", "free", "\\u", "lease_", "(_", "shard", "\\u", "state_", ",_", "slice", "\\u", "retry_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "SLI", "CE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parameters_", "._", "config_", "._", "TASK", "\\u", "MAX", "\\u", "DATA", "\\u", "PROCESS", "ING", "\\u", "ATTE", "MPT", "S_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Slice", " ", "atte", "mpt", " ", "%", "s", " ", "exceed", "ed", " ", "%", "s", " ", "max", " ", "atte", "mpt", "s", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "task", "\\u", "retr", "y", "\\u", "count_", "(_", ")_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "._", "config_", "._", "TASK", "\\u", "MAX", "\\u", "DATA", "\\u", "PROCESS", "ING", "\\u", "ATTE", "MPT", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "TASK", "\\u", "DIRECT", "IVE_", "._", "RETRY", "\\u", "SHAR", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\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_", "get", "\\u", "task", "\\u", "name_", "(_", "shard", "\\u", "id_", ",_", "slice", "\\u", "id_", ",_", "retry_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compute", " ", "single", " ", "worker", " ", "task", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "shard", "\\u", "id", ":", " ", "shard", " ", "id", ".", "\\", "10", ";", " ", " ", "slice", "\\u", "id", ":", " ", "slice", " ", "id", ".", "\\", "10", ";", " ", " ", "retr", "y", ":", " ", "current", " ", "shard", " ", "retr", "y", " ", "count", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "task", " ", "name", " ", "whi", "ch", " ", "shou", "ld", " ", "be", " ", "used", " ", "to", " ", "process", " ", "specified", " ", "shard", "/", "slice", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pref", "ix", " ", "the", " ", "task", " ", "name", " ", "with", " ", "somet", "hing", " ", "unique", " ", "to", " ", "this", " ", "frame", "work", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "namespace", " ", "so", " ", "we", " ", "don", "'", "t", " ", "confl", "ict", " ", "with", " ", "user", " ", "task", "s", " ", "on", " ", "the", " ", "queue", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"", "appengine", "-", "mrs", "hard", "-%", "s", "-%", "s", "-", "retr", "y", "-%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "id_", ",_", "slice", "\\u", "id_", ",_", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "countdown", "\\u", "for", "\\u", "next", "\\u", "slice_", "(_", "self_", ",_", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "countdown", " ", "for", " ", "next", " ", "slice", "'", "s", " ", "task", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "user", " ", "sets", " ", "process", "ing", " ", "rate", ",", " ", "we", " ", "set", " ", "countdown", " ", "to", " ", "dela", "y", " ", "task", " ", "executi", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "spec", ":", " ", "model", ".", "Map", "reduce", "Spec", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "countdown", " ", "in", " ", "int", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "countdown", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "process", "ing", "\\u", "limit_", "(_", "spec_", ")_", "!=_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "countdown", "_", "=_", "max_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "parameters_", "._", "config_", "._", "\\u", "SLI", "CE", "\\u", "DURATION", "\\u", "SEC", "_", "-_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "\\u", "time_", "(_", ")_", "-_", "self_", "._", "\\u", "start", "\\u", "time_", ")_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "countdown", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "state", "\\u", "to", "\\u", "task_", "(_", "cls_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eta_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "countdown", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "task", " ", "for", " ", "slice", " ", "according", " ", "to", " ", "current", " ", "state", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "tsta", "te", ":", " ", "An", " ", "instance", " ", "of", " ", "Transi", "ent", "Shard", "State", ".", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "An", " ", "instance", " ", "of", " ", "Shard", "State", ".", "\\", "10", ";", " ", " ", "eta", ":", " ", "Abs", "olute", " ", "time", " ", "whe", "n", " ", "the", " ", "MR", " ", "shou", "ld", " ", "execute", ".", " ", "Ma", "y", " ", "not", " ", "be", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "'", "countdown", "'", " ", "is", " ", "als", "o", " ", "supplie", "d", ".", " ", "Thi", "s", " ", "may", " ", "be", " ", "timezon", "e-", "awa", "re", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "timezon", "e-", "naive", ".", "\\", "10", ";", " ", " ", "countdown", ":", " ", "Time", " ", "in", " ", "second", "s", " ", "int", "o", " ", "the", " ", "future", " ", "tha", "t", " ", "this", " ", "MR", " ", "shou", "ld", " ", "execute", ".", "\\", "10", ";", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "zero", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "model", ".", "Hu", "ge", "Task", " ", "instance", " ", "for", " ", "the", " ", "slice", " ", "specified", " ", "by", " ", "current", " ", "state", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "path_", "=_", "tsta", "te_", "._", "base", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "name_", "=_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "._", "get", "\\u", "task", "\\u", "name_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "shard", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "slice", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", "._", "retries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "util_", "._", "\\u", "get", "\\u", "task", "\\u", "headers_", "(_", "tsta", "te_", "._", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "[_", "util_", "._", "\\u", "MR", "\\u", "SHAR", "D", "\\u", "ID", "\\u", "TASK", "\\u", "HEADER_", "]_", "=_", "tsta", "te_", "._", "shard", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "worker", "\\u", "task_", "=_", "model_", "._", "Hu", "ge", "Task_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "base", "\\u", "path_", "+_", "\"/", "worker", "\\u", "callback", "/\"_", "+_", "tsta", "te_", "._", "shard", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "tsta", "te_", "._", "to", "\\u", "dict_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "task", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eta_", "=_", "eta_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "countdown", "_", "=_", "countdown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "shard", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "worker", "\\u", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "add", "\\u", "task_", "(_", "cls_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "worker", "\\u", "task_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Schedule", " ", "slice", " ", "scanning", " ", "by", " ", "addin", "g", " ", "it", " ", "to", " ", "the", " ", "task", " ", "queue", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "worker", "\\u", "task", ":", " ", "a", " ", "model", ".", "Hu", "ge", "Task", " ", "task", " ", "for", " ", "slice", ".", " ", "Thi", "s", " ", "is", " ", "NOT", " ", "a", " ", "task", "queue", "\\", "10", ";", " ", " ", " ", " ", "task", ".", "\\", "10", ";", " ", " ", "mapreduce", "\\u", "spec", ":", " ", "an", " ", "instance", " ", "of", " ", "model", ".", "Map", "reduce", "Spec", ".", "\\", "10", ";", " ", " ", "queue", "\\u", "name", ":", " ", "Optio", "nal", " ", "queue", " ", "to", " ", "run", " ", "on", ";", " ", "use", "s", " ", "the", " ", "current", " ", "queue", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "executi", "on", " ", "or", " ", "the", " ", "default", " ", "queue", " ", "if", " ", "unspe", "cif", "ied", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "run", "\\u", "task", "\\u", "hook_", "(_", "mapreduce", "\\u", "spec_", "._", "get", "\\u", "hooks_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "enqueue", "\\u", "worker", "\\u", "task", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "worker", "\\u", "task_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "addin", "g", " ", "transaction", "ally", " ", "bec", "aus", "e", " ", "worker", "\\u", "task", " ", "has", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Name", "d", " ", "task", " ", "is", " ", "not", " ", "allow", "ed", " ", "for", " ", "transaction", "al", " ", "add", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "worker", "\\u", "task_", "._", "add_", "(_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "task", "queue_", "._", "Tom", "bst", "oned", "Task", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "queue_", "._", "Task", "Al", "read", "y", "Exist", "s", "Error_", ")_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Task", " ", "%", "r", " ", "alr", "ead", "y", " ", "exist", "s", ".", " ", "%", "s", ":", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "worker", "\\u", "task_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "e_", "._", "\\u\\u", "class\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "process", "ing", "\\u", "limit_", "(_", "self_", ",_", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "limit", " ", "on", " ", "the", " ", "number", " ", "of", " ", "map", " ", "calls", " ", "allow", "ed", " ", "by", " ", "this", " ", "slice", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "spec", ":", " ", "a", " ", "Map", "reduce", " ", "spec", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "limit", " ", "as", " ", "a", " ", "posit", "ive", " ", "int", " ", "if", " ", "specified", " ", "by", " ", "user", ".", " ", "-1", " ", "other", "wis", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ing", "\\u", "rate_", "=_", "float_", "(_", "spec_", "._", "mapper_", "._", "params_", "._", "get_", "(_", "\"", "process", "ing", "\\u", "rate", "\"_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "process", "ing", "\\u", "limit_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "process", "ing", "\\u", "rate_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "slice", "\\u", "process", "ing", "\\u", "limit_", "=_", "int_", "(_", "math_", "._", "ceil_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "._", "config_", "._", "\\u", "SLI", "CE", "\\u", "DURATION", "\\u", "SEC", "_", "*_", "process", "ing", "\\u", "rate_", "/_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "spec_", "._", "mapper_", "._", "shard", "\\u", "count_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "slice", "\\u", "process", "ing", "\\u", "limit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "schedule", "\\u", "slice_", "(_", "cls_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tsta", "te_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eta_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "countdown", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Schedule", " ", "slice", " ", "scanning", " ", "by", " ", "addin", "g", " ", "it", " ", "to", " ", "the", " ", "task", " ", "queue", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "shard", "\\u", "state", ":", " ", "An", " ", "instance", " ", "of", " ", "Shard", "State", ".", "\\", "10", ";", " ", " ", "tsta", "te", ":", " ", "An", " ", "instance", " ", "of", " ", "Transi", "ent", "Shard", "State", ".", "\\", "10", ";", " ", " ", "queue", "\\u", "name", ":", " ", "Optio", "nal", " ", "queue", " ", "to", " ", "run", " ", "on", ";", " ", "use", "s", " ", "the", " ", "current", " ", "queue", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "executi", "on", " ", "or", " ", "the", " ", "default", " ", "queue", " ", "if", " ", "unspe", "cif", "ied", ".", "\\", "10", ";", " ", " ", "eta", ":", " ", "Abs", "olute", " ", "time", " ", "whe", "n", " ", "the", " ", "MR", " ", "shou", "ld", " ", "execute", ".", " ", "Ma", "y", " ", "not", " ", "be", " ", "specified", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "'", "countdown", "'", " ", "is", " ", "als", "o", " ", "supplie", "d", ".", " ", "Thi", "s", " ", "may", " ", "be", " ", "timezon", "e-", "awa", "re", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "timezon", "e-", "naive", ".", "\\", "10", ";", " ", " ", "countdown", ":", " ", "Time", " ", "in", " ", "second", "s", " ", "int", "o", " ", "the", " ", "future", " ", "tha", "t", " ", "this", " ", "MR", " ", "shou", "ld", " ", "execute", ".", "\\", "10", ";", " ", " ", " ", " ", "Default", "s", " ", "to", " ", "zero", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue", "\\u", "name_", "=_", "queue", "\\u", "name_", "or_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "HTTP", "\\u", "X", "\\u", "APPEN", "GIN", "E", "\\u", "QUEUE", "NAME", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "default", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "=_", "cls_", "._", "\\u", "state", "\\u", "to", "\\u", "task_", "(_", "tsta", "te_", ",_", "shard", "\\u", "state_", ",_", "eta_", ",_", "countdown", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "add", "\\u", "task_", "(_", "task_", ",_", "tsta", "te_", "._", "mapreduce", "\\u", "spec_", ",_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Supervis", "es", " ", "mapreduce", " ", "executi", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Is", " ", "als", "o", " ", "responsib", "le", " ", "for", " ", "gather", "ing", " ", "executi", "on", " ", "status", " ", "from", " ", "shard", "s", " ", "tog", "ether", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "task", " ", "is", " ", "\"", "continuous", "ly", "\"", " ", "runn", "ing", " ", "by", " ", "addin", "g", " ", "its", "elf", " ", "again", " ", "to", " ", "task", "queue", " ", "if", "\\", "10", ";", " ", " ", "and", " ", "only", " ", "if", " ", "mapreduce", " ", "is", " ", "still", " ", "active", ".", " ", "A", " ", "mapreduce", " ", "is", " ", "active", " ", "if", " ", "it", " ", "has", "\\", "10", ";", " ", " ", "active", "ly", " ", "runn", "ing", " ", "shard", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Controlle", "r", "Call", "back", "Handler_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "time_", "=_", "time_", "._", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "drop", "\\u", "graceful", "ly_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Gra", "cef", "ull", "y", " ", "drop", " ", "controlle", "r", " ", "task", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "whe", "n", " ", "deco", "ding", " ", "controlle", "r", " ", "task", " ", "payload", " ", "fail", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "Up", "on", " ", "this", " ", "we", " ", "mark", " ", "Shard", "State", " ", "and", " ", "Map", "reduce", "State", " ", "as", " ", "fail", "ed", " ", "so", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "task", "s", " ", "can", " ", "stop", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Writ", "ing", " ", "to", " ", "datast", "ore", " ", "is", " ", "forced", " ", "(", "ignore", " ", "read", "-", "only", " ", "mode", ")", " ", "bec", "aus", "e", " ", "we", "\\", "10", ";", " ", " ", " ", " ", "want", " ", "the", " ", "task", "s", " ", "to", " ", "stop", " ", "bad", "ly", ",", " ", "and", " ", "if", " ", "force", "\\u", "writes", " ", "was", " ", "Fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "job", " ", "wou", "ld", " ", "have", " ", "neve", "r", " ", "bee", "n", " ", "start", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mr", "\\u", "id_", "=_", "self_", "._", "request_", "._", "headers_", "[_", "util_", "._", "\\u", "MR", "\\u", "ID", "\\u", "TASK", "\\u", "HEADER_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "get", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "mr", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "state_", "or_", "not_", "state_", "._", "active_", ":_", "\\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_", "state_", "._", "active_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "result", "\\u", "status_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "RESU", "LT", "\\u", "FAILED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "util_", "._", "create", "\\u", "datast", "ore", "\\u", "write", "\\u", "config_", "(_", "state_", "._", "mapreduce", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "puts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ss_", "in_", "model_", "._", "Shard", "State_", "._", "find", "\\u", "all", "\\u", "by", "\\u", "mapreduce", "\\u", "state_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ss_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ss_", "._", "set\\u", "for", "\\u", "failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "puts_", "._", "append_", "(_", "ss_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Av", "oid", " ", "hav", "ing", " ", "too", " ", "many", " ", "shard", " ", "state", "s", " ", "in", " ", "memory", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "puts_", ")_", ">_", "model_", "._", "Shard", "State_", "._", "\\u", "MAX", "\\u", "STATE", "S", "\\u", "IN", "\\u", "MEM", "ORY", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "put_", "(_", "puts_", ",_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "puts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "put_", "(_", "puts_", ",_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Put", " ", "mr", "\\u", "state", " ", "only", " ", "after", " ", "all", " ", "shard", "\\u", "state", "s", " ", "are", " ", "put", "._", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "put_", "(_", "state_", ",_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", " ", "request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spec_", "=_", "model_", "._", "Map", "reduce", "Spec_", "._", "from", "\\u", "json", "\\u", "str_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", "._", "get_", "(_", "\"", "mapreduce", "\\u", "spec", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", ",_", "control_", "=_", "db_", "._", "get_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "Map", "reduce", "State_", "._", "get", "\\u", "key", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "spec_", "._", "mapreduce", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "Map", "reduce", "Control_", "._", "get", "\\u", "key", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "spec_", "._", "mapreduce", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "State", " ", "not", " ", "found", " ", "for", " ", "MR", " ", "'%", "s", "';", " ", "drop", "ping", " ", "controlle", "r", " ", "task", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "state_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MR", " ", "%", "r", " ", "is", " ", "not", " ", "active", ".", " ", "Look", "s", " ", "like", " ", "spu", "rio", "us", " ", "controlle", "r", " ", "task", " ", "executi", "on", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "clean", "\\u", "up", "\\u", "mr_", "(_", "spec_", ")_", "\\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_", "shard", "\\u", "states_", "=_", "model_", "._", "Shard", "State_", "._", "find", "\\u", "all", "\\u", "by", "\\u", "mapreduce", "\\u", "state_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "state", "\\u", "from", "\\u", "shard", "\\u", "states_", "(_", "state_", ",_", "shard", "\\u", "states_", ",_", "control_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "state_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Controlle", "r", "Call", "back", "Handler_", "._", "resc", "hedule", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "state_", ",_", "spec_", ",_", "self_", "._", "serial", "\\u", "id_", "(_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "\\u", "state", "\\u", "from", "\\u", "shard", "\\u", "states_", "(_", "self_", ",_", "state_", ",_", "shard", "\\u", "states_", ",_", "control_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "mr", " ", "state", " ", "by", " ", "exam", "ing", " ", "shard", " ", "state", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "state", ":", " ", "current", " ", "mapreduce", " ", "state", " ", "as", " ", "Map", "reduce", "State", ".", "\\", "10", ";", " ", " ", "shard", "\\u", "state", "s", ":", " ", "an", " ", "iter", "ator", " ", "over", " ", "shard", " ", "state", "s", ".", "\\", "10", ";", " ", " ", "control", ":", " ", "model", ".", "Map", "reduce", "Control", " ", "entity", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "vars", "._", "\\u\\u\\uNL\\u\\u\\u_", "state_", "._", "active", "\\u", "shards_", ",_", "state_", "._", "abort", "ed", "\\u", "shards_", ",_", "state_", "._", "fail", "ed", "\\u", "shards_", "=_", "0_", ",_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "\\u", "shards_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ed", "\\u", "counts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ed", "\\u", "status_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "counter", "s", "\\u", "map_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tal", "ly", " ", "acro", "ss", " ", "shard", " ", "state", "s", " ", "onc", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "s_", "in_", "shard", "\\u", "states_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "\\u", "shards_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "'", "unknown", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "._", "active", "\\u", "shards_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "'", "runn", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "s_", "._", "result", "\\u", "status_", "==_", "model_", "._", "Shard", "State_", "._", "RESU", "LT", "\\u", "SUCCESS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "'", "success", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "result", "\\u", "status_", "==_", "model_", "._", "Shard", "State_", "._", "RESU", "LT", "\\u", "ABORT", "ED_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "._", "abort", "ed", "\\u", "shards_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "'", "abort", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "result", "\\u", "status_", "==_", "model_", "._", "Shard", "State_", "._", "RESU", "LT", "\\u", "FAILED_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "._", "fail", "ed", "\\u", "shards_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "'", "fail", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "stats", " ", "in", " ", "mapreduce", " ", "state", " ", "by", " ", "aggre", "gati", "ng", " ", "stats", " ", "from", " ", "shard", " ", "state", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "state_", "._", "counter", "s", "\\u", "map_", "._", "add", "\\u", "map_", "(_", "s_", "._", "counter", "s", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ed", "\\u", "counts_", "._", "append_", "(_", "s_", "._", "counter", "s", "\\u", "map_", "._", "get_", "(_", "context_", "._", "COUNTER", "\\u", "MAP", "PER", "\\u", "CALL", "S_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "ed", "\\u", "status_", "._", "append_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "state_", "._", "set\\u", "process", "ed", "\\u", "counts_", "(_", "process", "ed", "\\u", "counts_", ",_", "process", "ed", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "last", "\\u", "poll", "\\u", "time_", "=_", "datetime_", "._", "datetime_", "._", "utc", "fromtimestamp_", "(_", "self_", "._", "\\u", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", "=_", "state_", "._", "mapreduce", "\\u", "spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "total", "\\u", "shards_", "!=_", "spec_", "._", "mapper_", "._", "shard", "\\u", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\"", "Foun", "d", " ", "%", "d", " ", "shard", " ", "state", "s", ".", " ", "Expect", " ", "%", "d", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Is", "sui", "ng", " ", "abort", " ", "command", " ", "to", " ", "job", " ", "'%", "s", "'\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "total", "\\u", "shards_", ",_", "spec_", "._", "mapper_", "._", "shard", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "issue", " ", "abort", " ", "command", " ", "to", " ", "allow", " ", "shard", "s", " ", "to", " ", "stop", " ", "them", "sel", "ves", "._", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "Map", "reduce", "Control_", "._", "abort_", "(_", "spec_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "any", " ", "shard", " ", "is", " ", "active", " ", "then", " ", "the", " ", "mr", " ", "is", " ", "active", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "way", ",", " ", "controlle", "r", " ", "won", "'", "t", " ", "prem", "ature", "ly", " ", "stop", " ", "bef", "ore", " ", "all", " ", "the", " ", "shard", "s", " ", "have", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "state_", "._", "active_", "=_", "bool_", "(_", "state_", "._", "active", "\\u", "shards_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "control_", "and_", "(_", "state_", "._", "fail", "ed", "\\u", "shards_", "or_", "state_", "._", "abort", "ed", "\\u", "shards_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Issue", " ", "abort", " ", "command", " ", "if", " ", "there", " ", "are", " ", "fail", "ed", " ", "shard", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "._", "Map", "reduce", "Control_", "._", "abort_", "(_", "spec_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "state_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "final", " ", "result", " ", "status", " ", "derive", "d", " ", "from", " ", "shard", " ", "state", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "state_", "._", "fail", "ed", "\\u", "shards_", "or_", "not_", "total", "\\u", "shards_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "._", "result", "\\u", "status_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "RESU", "LT", "\\u", "FAILED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "importa", "nt", " ", "fail", "ed", " ", "shard", "s", " ", "is", " ", "checke", "d", " ", "bef", "ore", " ", "abort", "ed", " ", "shards_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bec", "aus", "e", " ", "fail", "ed", " ", "shard", "s", " ", "will", " ", "trigger", " ", "other", " ", "shard", "s", " ", "to", " ", "abort", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "state_", "._", "abort", "ed", "\\u", "shards_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "._", "result", "\\u", "status_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "RESU", "LT", "\\u", "ABORT", "ED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "._", "result", "\\u", "status_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "RESU", "LT", "\\u", "SUCCESS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "finalize", "\\u", "outputs_", "(_", "spec_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "finalize", "\\u", "job_", "(_", "spec_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "db_", "._", "transaction", "al_", "(_", "retries_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "put", "\\u", "state_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "help", "er", " ", "for", " ", "stor", "ing", " ", "the", " ", "state", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fresh", "\\u", "state_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "get", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "spec_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "don", "'", "t", " ", "check", " ", "anyt", "hing", " ", "other", " ", "than", " ", "active", " ", "bec", "aus", "e", " ", "we", " ", "are", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "updat", "ing", " ", "stats", ".", " ", "It", "'", "s", " ", "OK", " ", "if", " ", "the", "y", " ", "are", " ", "brief", "ly", " ", "inconsistent", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "fresh", "\\u", "state_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Jo", "b", " ", "%", "s", " ", "is", " ", "not", " ", "active", ".", " ", "Look", "s", " ", "like", " ", "spu", "rio", "us", " ", "task", " ", "executi", "on", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dropp", "ing", " ", "controlle", "r", " ", "task", ".\"_", ",_", "spec_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "=_", "util_", "._", "create", "\\u", "datast", "ore", "\\u", "write", "\\u", "config_", "(_", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "put_", "(_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "put", "\\u", "state_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serial", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "serial", " ", "unique", " ", "identifi", "er", " ", "of", " ", "this", " ", "task", " ", "from", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "serial", " ", "identifi", "er", " ", "as", " ", "int", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "int_", "(_", "self_", "._", "request_", "._", "get_", "(_", "\"", "serial", "\\u", "id", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "finalize", "\\u", "outputs_", "(_", "cls_", ",_", "mapreduce", "\\u", "spec_", ",_", "mapreduce", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Finali", "ze", " ", "output", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "mapreduce", "\\u", "spec", ":", " ", "an", " ", "instance", " ", "of", " ", "Map", "reduce", "Spec", ".", "\\", "10", ";", " ", " ", "mapreduce", "\\u", "state", ":", " ", "an", " ", "instance", " ", "of", " ", "Map", "reduce", "State", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "finalize", " ", "the", " ", "output", " ", "writer", "s", " ", "if", " ", "the", " ", "job", " ", "is", " ", "success", "ful", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "mapreduce", "\\u", "spec_", "._", "mapper_", "._", "output", "\\u", "writer", "\\u", "class_", "(_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "state_", "._", "result", "\\u", "status_", "==_", "model_", "._", "Map", "reduce", "State_", "._", "RESU", "LT", "\\u", "SUCCESS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapreduce", "\\u", "spec_", "._", "mapper_", "._", "output", "\\u", "writer", "\\u", "class_", "(_", ")_", "._", "finalize", "\\u", "job_", "(_", "mapreduce", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "finalize", "\\u", "job_", "(_", "cls_", ",_", "mapreduce", "\\u", "spec_", ",_", "mapreduce", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Finali", "ze", " ", "job", " ", "executi", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Invok", "es", " ", "don", "e", " ", "callback", " ", "and", " ", "save", " ", "mapreduce", " ", "state", " ", "in", " ", "a", " ", "transaction", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "schedule", " ", "necessar", "y", " ", "clean", " ", "ups", ".", " ", "Thi", "s", " ", "method", " ", "is", " ", "idempotent", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "mapreduce", "\\u", "spec", ":", " ", "an", " ", "instance", " ", "of", " ", "Map", "reduce", "Spec", "\\", "10", ";", " ", " ", "mapreduce", "\\u", "state", ":", " ", "an", " ", "instance", " ", "of", " ", "Map", "reduce", "State", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "util_", "._", "create", "\\u", "datast", "ore", "\\u", "write", "\\u", "config_", "(_", "mapreduce", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue", "\\u", "name_", "=_", "util_", "._", "get", "\\u", "queue", "\\u", "name_", "(_", "mapreduce", "\\u", "spec_", "._", "params_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "Map", "reduce", "Spec_", "._", "PARAM", "\\u", "DON", "E", "\\u", "CALL", "BACK", "\\u", "QUEUE", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "e\\u", "callback_", "=_", "mapreduce", "\\u", "spec_", "._", "params_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "Map", "reduce", "Spec_", "._", "PARAM", "\\u", "DON", "E", "\\u", "CALL", "BACK_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "e\\u", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "don", "e\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "don", "e\\u", "task_", "=_", "task", "queue_", "._", "Task_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "don", "e\\u", "callback_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "util_", "._", "\\u", "get", "\\u", "task", "\\u", "headers_", "(_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "CALL", "BACK", "\\u", "MR", "\\u", "ID", "\\u", "TASK", "\\u", "HEADER_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "mapreduce", "\\u", "spec_", "._", "params_", "._", "get_", "(_", "\"", "don", "e\\u", "callback", "\\u", "method", "\"_", ",_", "\"", "POST", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "db_", "._", "transaction", "al_", "(_", "retries_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "put", "\\u", "state_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "to", " ", "store", " ", "state", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fresh", "\\u", "state_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "get", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fresh", "\\u", "state_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Jo", "b", " ", "%", "s", " ", "is", " ", "not", " ", "active", ".", " ", "Look", "s", " ", "like", " ", "spu", "rio", "us", " ", "task", " ", "executi", "on", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dropp", "ing", " ", "task", ".\"_", ",_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mapreduce", "\\u", "state_", "._", "put_", "(_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enque", "ue", " ", "don", "e\\u", "callback", " ", "if", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "don", "e\\u", "task_", "and_", "not_", "\\u", "run", "\\u", "task", "\\u", "hook_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "spec_", "._", "get", "\\u", "hooks_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "enqueue", "\\u", "don", "e\\u", "task", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "don", "e\\u", "task_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "don", "e\\u", "task_", "._", "add_", "(_", "queue", "\\u", "name_", ",_", "transaction", "al_", "=_", "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_", "\\u", "put", "\\u", "state_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Final", " ", "result", " ", "for", " ", "job", " ", "'%", "s", "'", " ", "is", " ", "'%", "s", "'\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ",_", "mapreduce", "\\u", "state_", "._", "result", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "clean", "\\u", "up", "\\u", "mr_", "(_", "mapreduce", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "clean", "\\u", "up", "\\u", "mr_", "(_", "cls_", ",_", "mapreduce", "\\u", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Finali", "ze", "Jo", "b", "Handler_", "._", "schedule_", "(_", "mapreduce", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\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_", "get", "\\u", "task", "\\u", "name_", "(_", "mapreduce", "\\u", "spec_", ",_", "serial", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Compute", " ", "single", " ", "controlle", "r", " ", "task", " ", "name", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "mapreduce", "\\u", "spec", ":", " ", "specifica", "tion", " ", "of", " ", "the", " ", "mapreduce", ".", "\\", "10", ";", " ", " ", "serial", "\\u", "id", ":", " ", "id", " ", "of", " ", "the", " ", "invocation", " ", "as", " ", "int", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "task", " ", "name", " ", "whi", "ch", " ", "shou", "ld", " ", "be", " ", "used", " ", "to", " ", "process", " ", "specified", " ", "shard", "/", "slice", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pref", "ix", " ", "the", " ", "task", " ", "name", " ", "with", " ", "somet", "hing", " ", "unique", " ", "to", " ", "this", " ", "frame", "work", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "namespace", " ", "so", " ", "we", " ", "don", "'", "t", " ", "confl", "ict", " ", "with", " ", "user", " ", "task", "s", " ", "on", " ", "the", " ", "queue", "._", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"", "appengine", "-", "mr", "control", "-%", "s", "-%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ",_", "serial", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\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_", "controlle", "r", "\\u", "parameters_", "(_", "mapreduce", "\\u", "spec_", ",_", "serial", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fil", "l", " ", "in", " ", " ", "controlle", "r", " ", "task", " ", "parameter", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "ed", " ", "parameter", "s", " ", "map", " ", "is", " ", "to", " ", "be", " ", "used", " ", "as", " ", "task", " ", "payload", ",", " ", "and", " ", "it", " ", "contain", "s", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "the", " ", "data", ",", " ", "require", "d", " ", "by", " ", "controlle", "r", " ", "to", " ", "perform", " ", "its", " ", "function", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "mapreduce", "\\u", "spec", ":", " ", "specifica", "tion", " ", "of", " ", "the", " ", "mapreduce", ".", "\\", "10", ";", " ", " ", "serial", "\\u", "id", ":", " ", "id", " ", "of", " ", "the", " ", "invocation", " ", "as", " ", "int", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "string", "->", "string", " ", "map", " ", "of", " ", "parameter", "s", " ", "to", " ", "be", " ", "used", " ", "as", " ", "task", " ", "payload", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "mapreduce", "\\u", "spec", "\"_", ":_", "mapreduce", "\\u", "spec_", "._", "to", "\\u", "json", "\\u", "str_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "serial", "\\u", "id", "\"_", ":_", "str_", "(_", "serial", "\\u", "id_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Controlle", "r", "Call", "back", "Handler_", "(_", "base", "\\u", "handler_", "._", "Hu", "ge", "Task", "Handler_", ")_", ":_", "\\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_", "resc", "hedule", "_", "(_", "cls_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "serial", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Schedule", " ", "new", " ", "update", " ", "status", " ", "callback", " ", "task", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "mapreduce", "\\u", "state", ":", " ", "mapreduce", " ", "state", " ", "as", " ", "model", ".", "Map", "reduce", "State", "\\", "10", ";", " ", " ", "mapreduce", "\\u", "spec", ":", " ", "mapreduce", " ", "specifica", "tion", " ", "as", " ", "Map", "reduce", "Spec", ".", "\\", "10", ";", " ", " ", "serial", "\\u", "id", ":", " ", "id", " ", "of", " ", "the", " ", "invocation", " ", "as", " ", "int", ".", "\\", "10", ";", " ", " ", "queue", "\\u", "name", ":", " ", "The", " ", "queue", " ", "to", " ", "schedule", " ", "this", " ", "task", " ", "on", ".", " ", "Wil", "l", " ", "use", " ", "the", " ", "current", "\\", "10", ";", " ", " ", " ", " ", "queue", " ", "of", " ", "executi", "on", " ", "if", " ", "not", " ", "supplie", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "name_", "=_", "Controlle", "r", "Call", "back", "Handler_", "._", "get", "\\u", "task", "\\u", "name_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "spec_", ",_", "serial", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "params_", "=_", "Controlle", "r", "Call", "back", "Handler_", "._", "controlle", "r", "\\u", "parameters_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "spec_", ",_", "serial", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "queue", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue", "\\u", "name_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "HTTP", "\\u", "X", "\\u", "APPEN", "GIN", "E", "\\u", "QUEUE", "NAME", "\"_", ",_", "\"", "default", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "controlle", "r", "\\u", "callback", "\\u", "task_", "=_", "model_", "._", "Hu", "ge", "Task_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "(_", "mapreduce", "\\u", "spec_", "._", "params_", "[_", "\"", "base", "\\u", "path", "\"_", "]_", "+_", "\"/", "controlle", "r", "\\u", "callback", "/\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "task", "\\u", "name_", ",_", "params_", "=_", "task", "\\u", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "countdown", "_", "=_", "parameters_", "._", "config_", "._", "\\u", "CONTROLLER", "\\u", "PERIOD", "\\u", "SEC", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "mapreduce", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "util_", "._", "\\u", "get", "\\u", "task", "\\u", "headers_", "(_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "\\u", "run", "\\u", "task", "\\u", "hook_", "(_", "mapreduce", "\\u", "spec_", "._", "get", "\\u", "hooks_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "enqueue", "\\u", "controlle", "r", "\\u", "task", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "controlle", "r", "\\u", "callback", "\\u", "task_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "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 ", " _", "controlle", "r", "\\u", "callback", "\\u", "task_", "._", "add_", "(_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "task", "queue_", "._", "Tom", "bst", "oned", "Task", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "queue_", "._", "Task", "Al", "read", "y", "Exist", "s", "Error_", ")_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Task", " ", "%", "r", " ", "with", " ", "params", " ", "%", "r", " ", "alr", "ead", "y", " ", "exist", "s", ".", " ", "%", "s", ":", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "name_", ",_", "task", "\\u", "params_", ",_", "e_", "._", "\\u\\u", "class\\u\\u_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Kick", "Off", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Task", "Queue", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Task", "queue", " ", "handler", " ", "whi", "ch", " ", "kick", "s", " ", "off", " ", "a", " ", "mapreduce", " ", "process", "ing", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "handler", " ", "is", " ", "idempotent", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Precon", "dition", ":", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Model", ".", "Map", "reduce", "State", " ", "entity", " ", "for", " ", "this", " ", "mr", " ", "is", " ", "alr", "ead", "y", " ", "created", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "saved", " ", "to", " ", "datast", "ore", " ", "by", " ", "Start", "Jo", "b", "Handle", "r", ".\\u", "start", "\\u", "map", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Request", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "mapreduce", "\\u", "id", ":", " ", "in", " ", "string", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Datas", "tore", " ", "key", " ", "used", " ", "to", " ", "save", " ", "json", " ", "serialize", "d", " ", "input", " ", "reader", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "SERIALIZ", "ED", "\\u", "INPUT", "\\u", "READ", "ERS", "\\u", "KEY_", "=_", "\"", "input", "\\u", "reader", "s", "\\u", "for", "\\u", "mr", "\\u", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Kick", "Off", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Task", "Queue", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", "s", " ", "kick", " ", "off", " ", "request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "and", " ", "verify", " ", "mr", " ", "state", "._", "\\u\\u\\uNL\\u\\u\\u_", "mr", "\\u", "id_", "=_", "self_", "._", "request_", "._", "get_", "(_", "\"", "mapreduce", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Log", " ", "the", " ", "mr", "\\u", "id", " ", "sinc", "e", " ", "this", " ", "is", " ", "start", "ed", " ", "in", " ", "an", " ", "unn", "ame", "d", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Process", "ing", " ", "kick", "off", " ", "for", " ", "job", " ", "%", "s", "\"_", ",_", "mr", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "get", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "mr", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "check", "\\u", "mr", "\\u", "state_", "(_", "state_", ",_", "mr", "\\u", "id_", ")_", ":_", "\\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_", "#", " ", "Creat", "e", " ", "input", " ", "reader", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "readers_", ",_", "serialize", "d\\u", "reader", "s", "\\u", "entity_", "=_", "self_", "._", "\\u", "get", "\\u", "input", "\\u", "readers_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "readers_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "don", "'", "t", " ", "have", " ", "any", " ", "data", ".", " ", "Finish", " ", "map", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Foun", "d", " ", "no", " ", "mapper", " ", "input", " ", "data", " ", "to", " ", "process", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "active_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "result", "\\u", "status_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "RESU", "LT", "\\u", "SUCCESS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Controlle", "r", "Call", "back", "Handler_", "._", "\\u", "finalize", "\\u", "job_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "._", "mapreduce", "\\u", "spec_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "output", " ", "writer", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "setup", "\\u", "output", "\\u", "writer_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "state", "s", " ", "and", " ", "make", " ", "sure", " ", "we", " ", "use", " ", "the", " ", "saved", " ", "input", " ", "reader", "s", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "subsequen", "t", " ", "operati", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "\\u", "save", "\\u", "states_", "(_", "state_", ",_", "serialize", "d\\u", "reader", "s", "\\u", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "readers_", ",_", "\\u_", "=_", "self_", "._", "\\u", "get", "\\u", "input", "\\u", "readers_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "result_", ":_", "\\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_", "queue", "\\u", "name_", "=_", "self_", "._", "request_", "._", "headers_", "._", "get_", "(_", "\"", "X", "-", "App", "Engine", "-", "Queue", "Name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Kick", "Off", "Jo", "b", "Handler_", "._", "\\u", "schedule", "\\u", "shards_", "(_", "state_", "._", "mapreduce", "\\u", "spec_", ",_", "readers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "._", "mapreduce", "\\u", "spec_", "._", "params_", "[_", "\"", "base", "\\u", "path", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Controlle", "r", "Call", "back", "Handler_", "._", "resc", "hedule", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "state_", ",_", "state_", "._", "mapreduce", "\\u", "spec_", ",_", "serial", "\\u", "id_", "=_", "0_", ",_", "queue", "\\u", "name_", "=_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kick", "Off", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Task", "Queue", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "drop", "\\u", "graceful", "ly_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "See", " ", "parent", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mr", "\\u", "id_", "=_", "self_", "._", "request_", "._", "get_", "(_", "\"", "mapreduce", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "error_", "(_", "\"", "Fail", "ed", " ", "to", " ", "kick", " ", "off", " ", "job", " ", "%", "s", "\"_", ",_", "mr", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "get", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "mr", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "check", "\\u", "mr", "\\u", "state_", "(_", "state_", ",_", "mr", "\\u", "id_", ")_", ":_", "\\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_", "#", " ", "Issue", " ", "abort", " ", "command", " ", "just", " ", "in", " ", "case", " ", "there", " ", "are", " ", "runn", "ing", " ", "task", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "=_", "util_", "._", "create", "\\u", "datast", "ore", "\\u", "write", "\\u", "config_", "(_", "state_", "._", "mapreduce", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "._", "Map", "reduce", "Control_", "._", "abort_", "(_", "mr", "\\u", "id_", ",_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Finali", "ze", " ", "job", " ", "and", " ", "invoke", " ", "callback", "._", "\\u\\u\\uNL\\u\\u\\u_", "state_", "._", "active_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "result", "\\u", "status_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "RESU", "LT", "\\u", "FAILED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Controlle", "r", "Call", "back", "Handler_", "._", "\\u", "finalize", "\\u", "job_", "(_", "state_", "._", "mapreduce", "\\u", "spec_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kick", "Off", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Task", "Queue", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "input", "\\u", "readers_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "input", " ", "reader", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "state", ":", " ", "a", " ", "Map", "reduce", "State", " ", "model", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "A", " ", "tuple", ":", " ", "(", "a", " ", "list", " ", "of", " ", "input", " ", "reader", "s", ",", " ", "a", " ", "model", ".\\u", "Hu", "ge", "Task", "Pay", "load", " ", "entity", ").", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "payload", " ", "entity", " ", "contain", "s", " ", "the", " ", "json", " ", "serialize", "d", " ", "input", " ", "reader", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "Non", "e", ",", " ", "Non", "e", ")", " ", "whe", "n", " ", "input", " ", "reader", " ", "inp", "litt", "ing", " ", "return", "ed", " ", "no", " ", "data", " ", "to", " ", "process", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serialize", "d\\u", "input", "\\u", "reader", "s", "\\u", "key_", "=_", "(_", "self_", "._", "\\u", "SERIALIZ", "ED", "\\u", "INPUT", "\\u", "READ", "ERS", "\\u", "KEY_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "._", "key_", "(_", ")_", "._", "id", "\\u", "or", "\\u", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serialize", "d\\u", "input", "\\u", "readers_", "=_", "model_", "._", "\\u", "Hu", "ge", "Task", "Payload_", "._", "get", "\\u", "by", "\\u", "key", "\\u", "name_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "serialize", "d\\u", "input", "\\u", "reader", "s", "\\u", "key_", ",_", "parent_", "=_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "input", " ", "reader", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "reader", "\\u", "class_", "=_", "state_", "._", "mapreduce", "\\u", "spec_", "._", "mapper_", "._", "input", "\\u", "reader", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "split", "\\u", "param_", "=_", "state_", "._", "mapreduce", "\\u", "spec_", "._", "mapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "issubclass_", "(_", "input", "\\u", "reader", "\\u", "class_", ",_", "map", "\\u", "job_", "._", "Inp", "ut", "Reader_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "split", "\\u", "param_", "=_", "map", "\\u", "job_", "._", "Jo", "b", "Config_", "._", "\\u", "to", "\\u", "map", "\\u", "job", "\\u", "config_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "._", "mapreduce", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "._", "get_", "(_", "\"", "HTTP", "\\u", "X", "\\u", "APPEN", "GIN", "E", "\\u", "QUEUE", "NAME", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "serialize", "d\\u", "input", "\\u", "readers_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "readers_", "=_", "input", "\\u", "reader", "\\u", "class_", "._", "split", "\\u", "input_", "(_", "split", "\\u", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "readers_", "=_", "[_", "input", "\\u", "reader", "\\u", "class_", "._", "from", "\\u", "json", "\\u", "str_", "(_", "\\u", "json_", ")_", "for_", "\\u", "json_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "._", "loads_", "(_", "zlib_", "._", "decompress_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "serialize", "d\\u", "input", "\\u", "readers_", "._", "payload_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "readers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "state", " ", "and", " ", "spec", " ", "with", " ", "actual", " ", "shard", " ", "count", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "state_", "._", "mapreduce", "\\u", "spec_", "._", "mapper_", "._", "shard", "\\u", "count_", "=_", "len_", "(_", "readers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "active", "\\u", "shards_", "=_", "len_", "(_", "readers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepare", " ", "to", " ", "save", " ", "serialize", "d", " ", "input", " ", "reader", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "serialize", "d\\u", "input", "\\u", "readers_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "mr", "\\u", "state", " ", "as", " ", "parent", " ", "so", " ", "it", " ", "can", " ", "be", " ", "easi", "ly", " ", "clean", "ed", " ", "up", " ", "late", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serialize", "d\\u", "input", "\\u", "readers_", "=_", "model_", "._", "\\u", "Hu", "ge", "Task", "Payload_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "key", "\\u", "name_", "=_", "serialize", "d\\u", "input", "\\u", "reader", "s", "\\u", "key_", ",_", "parent_", "=_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reader", "s", "\\u", "json", "\\u", "str_", "=_", "[_", "i_", "._", "to", "\\u", "json", "\\u", "str_", "(_", ")_", "for_", "i_", "in_", "readers_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serialize", "d\\u", "input", "\\u", "readers_", "._", "payload_", "=_", "zlib_", "._", "compress_", "(_", "json_", "._", "dumps_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reader", "s", "\\u", "json", "\\u", "str_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "readers_", ",_", "serialize", "d\\u", "input", "\\u", "readers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kick", "Off", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Task", "Queue", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup", "\\u", "output", "\\u", "writer_", "(_", "self_", ",_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "state_", "._", "writer", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "writer", "\\u", "class_", "=_", "state_", "._", "mapreduce", "\\u", "spec_", "._", "mapper_", "._", "output", "\\u", "writer", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output", "\\u", "writer", "\\u", "class_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "writer", "\\u", "class_", "._", "init", "\\u", "job_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kick", "Off", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Task", "Queue", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "db_", "._", "transaction", "al_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "save", "\\u", "states_", "(_", "self_", ",_", "state_", ",_", "serialize", "d\\u", "reader", "s", "\\u", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "transaction", " ", "to", " ", "save", " ", "state", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "state", ":", " ", "a", " ", "model", ".", "Map", "reduce", "State", " ", "entity", ".", "\\", "10", ";", " ", " ", "serialize", "d\\u", "reader", "s", "\\u", "entity", ":", " ", "a", " ", "model", ".\\u", "Hu", "ge", "Task", "Pay", "load", " ", "entity", " ", "contain", "ing", "\\", "10", ";", " ", " ", " ", " ", "json", " ", "serialize", "d", " ", "input", " ", "reader", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Fal", "se", " ", "if", " ", "a", " ", "fat", "al", " ", "error", " ", "is", " ", "encounter", "ed", " ", "and", " ", "this", " ", "task", " ", "shou", "ld", " ", "be", " ", "dropped", "\\", "10", ";", " ", " ", " ", " ", "immediate", "ly", ".", " ", "Tru", "e", " ", "if", " ", "transaction", " ", "is", " ", "success", "ful", ".", " ", "Non", "e", " ", "if", " ", "a", " ", "previ", "ous", "\\", "10", ";", " ", " ", " ", " ", "atte", "mpt", " ", "of", " ", "this", " ", "same", " ", "transaction", " ", "has", " ", "alr", "ead", "y", " ", "succe", "eded", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mr", "\\u", "id_", "=_", "state_", "._", "key_", "(_", ")_", "._", "id", "\\u", "or", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fresh", "\\u", "state_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "get", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "mr", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "check", "\\u", "mr", "\\u", "state_", "(_", "fresh", "\\u", "state_", ",_", "mr", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fresh", "\\u", "state_", "._", "active", "\\u", "shards_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Map", "reduce", " ", "%", "s", " ", "alr", "ead", "y", " ", "has", " ", "active", " ", "shard", "s", ".", " ", "Look", "s", " ", "like", " ", "spu", "rio", "us", " ", "task", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "executi", "on", ".\"_", ",_", "mr", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "=_", "util_", "._", "create", "\\u", "datast", "ore", "\\u", "write", "\\u", "config_", "(_", "state_", "._", "mapreduce", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "put_", "(_", "[_", "state_", ",_", "serialize", "d\\u", "reader", "s", "\\u", "entity_", "]_", ",_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kick", "Off", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Task", "Queue", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "schedule", "\\u", "shards_", "(_", "cls_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "readers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mr", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prepare", "s", " ", "shard", " ", "state", "s", " ", "and", " ", "schedules", " ", "thei", "r", " ", "executi", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Even", " ", "tho", "ugh", " ", "this", " ", "method", " ", "doe", "s", " ", "not", " ", "schedule", " ", "shard", " ", "task", " ", "and", " ", "save", " ", "shard", " ", "state", "\\", "10", ";", " ", " ", " ", " ", "transaction", "ally", ",", " ", "it", "'", "s", " ", "safe", " ", "for", " ", "task", "queue", " ", "to", " ", "retr", "y", " ", "this", " ", "logic", " ", "bec", "aus", "e", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "initial", " ", "shard", "\\u", "state", " ", "for", " ", "each", " ", "shard", " ", "is", " ", "the", " ", "same", " ", "from", " ", "any", " ", "retr", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "an", " ", "importa", "nt", " ", "ye", "t", " ", "reason", "able", " ", "assumption", " ", "on", " ", "model", ".", "Shard", "State", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "spec", ":", " ", "mapreduce", " ", "specifica", "tion", " ", "as", " ", "Map", "reduce", "Spec", ".", "\\", "10", ";", " ", " ", "reader", "s", ":", " ", "list", " ", "of", " ", "Inp", "ut", "Read", "ers", " ", "descri", "bing", " ", "shard", " ", "split", "s", ".", "\\", "10", ";", " ", " ", "queue", "\\u", "name", ":", " ", "The", " ", "queue", " ", "to", " ", "run", " ", "this", " ", "job", " ", "on", ".", "\\", "10", ";", " ", " ", "base", "\\u", "path", ":", " ", "The", " ", "base", " ", "url", " ", "path", " ", "of", " ", "mapreduce", " ", "callback", "s", ".", "\\", "10", ";", " ", " ", "mr", "\\u", "state", ":", " ", "The", " ", "Map", "Reduce", "State", " ", "of", " ", "current", " ", "job", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "shard", " ", "state", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "states_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "shard", "\\u", "number_", ",_", "input", "\\u", "reader_", "in_", "enumerate_", "(_", "readers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "state_", "=_", "model_", "._", "Shard", "State_", "._", "create", "\\u", "new_", "(_", "spec_", "._", "mapreduce", "\\u", "id_", ",_", "shard", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "state_", "._", "shard", "\\u", "description_", "=_", "str_", "(_", "input", "\\u", "reader_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shard", "\\u", "states_", "._", "append_", "(_", "shard", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Retrieve", "s", " ", "alr", "ead", "y", " ", "exist", "ing", " ", "shard", " ", "state", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exist", "ing", "\\u", "shard", "\\u", "states_", "=_", "db_", "._", "get_", "(_", "shard_", "._", "key_", "(_", ")_", "for_", "shard_", "in_", "shard", "\\u", "states_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "shard", "\\u", "keys_", "=_", "set_", "(_", "shard_", "._", "key_", "(_", ")_", "for_", "shard_", "in_", "exist", "ing", "\\u", "shard", "\\u", "states_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shard_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "non", " ", "existen", "t", " ", "shard", " ", "state", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "we", " ", "coul", "d", " ", "do", " ", "this", " ", "transaction", "ally", " ", "if", " ", "necessar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "put_", "(_", "(_", "shard_", "for_", "shard_", "in_", "shard", "\\u", "states_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "shard_", "._", "key_", "(_", ")_", "not_", "in_", "exist", "ing", "\\u", "shard", "\\u", "keys_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "util_", "._", "create", "\\u", "datast", "ore", "\\u", "write", "\\u", "config_", "(_", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "output", " ", "writer", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "writer", "\\u", "class_", "=_", "spec_", "._", "mapper_", "._", "output", "\\u", "writer", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writers_", "=_", "[_", "None_", "]_", "*_", "len_", "(_", "readers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "writer", "\\u", "class_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "shard", "\\u", "number_", ",_", "shard", "\\u", "state_", "in_", "enumerate_", "(_", "shard", "\\u", "states_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "writers_", "[_", "shard", "\\u", "number_", "]_", "=_", "writer", "\\u", "class_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mr", "\\u", "state_", "._", "mapreduce", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "state_", "._", "shard", "\\u", "number_", ",_", "shard", "\\u", "state_", "._", "retries_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mr", "\\u", "state_", "._", "writer", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Schedule", " ", "ALL", " ", "shard", " ", "task", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "each", " ", "task", " ", "is", " ", "named", ",", " ", "\\u", "add", "\\u", "task", " ", "will", " ", "fall", " ", "back", " ", "graceful", "ly", " ", "if", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "task", " ", "alr", "ead", "y", " ", "exist", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "shard", "\\u", "number_", ",_", "(_", "input", "\\u", "reader_", ",_", "output", "\\u", "writer_", ")_", "in_", "enumerate_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "zip_", "(_", "readers_", ",_", "writers_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "id_", "=_", "model_", "._", "Shard", "State_", "._", "shard", "\\u", "id", "\\u", "from", "\\u", "number_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", "._", "mapreduce", "\\u", "id_", ",_", "shard", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "=_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "._", "\\u", "state", "\\u", "to", "\\u", "task_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "Transi", "ent", "Shard", "State_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "path_", ",_", "spec_", ",_", "shard", "\\u", "id_", ",_", "0_", ",_", "input", "\\u", "reader_", ",_", "input", "\\u", "reader_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "writer_", "=_", "output", "\\u", "writer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "spec_", "._", "mapper_", "._", "handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shard", "\\u", "states_", "[_", "shard", "\\u", "number_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Map", "per", "Worke", "r", "Call", "back", "Handler_", "._", "\\u", "add", "\\u", "task_", "(_", "task_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kick", "Off", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Task", "Queue", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "check", "\\u", "mr", "\\u", "state_", "(_", "cls_", ",_", "state_", ",_", "mr", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "Map", "reduce", "State", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "state", ":", " ", "an", " ", "Map", "reduce", "State", " ", "instance", ".", "\\", "10", ";", " ", " ", "mr", "\\u", "id", ":", " ", "mapreduce", " ", "id", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Tru", "e", " ", "if", " ", "state", " ", "is", " ", "valid", ".", " ", "Fal", "se", " ", "if", " ", "not", " ", "and", " ", "this", " ", "task", " ", "shou", "ld", " ", "be", " ", "dropped", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "state_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Map", "reduce", " ", "State", " ", "for", " ", "job", " ", "%", "s", " ", "is", " ", "missi", "ng", ".", " ", "Dropp", "ing", " ", "Task", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mr", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "state_", "._", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Map", "reduce", " ", "%", "s", " ", "is", " ", "not", " ", "active", ".", " ", "Look", "s", " ", "like", " ", "spu", "rio", "us", " ", "task", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "executi", "on", ".", " ", "Dropp", "ing", " ", "Task", ".\"_", ",_", "mr", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Post", "Js", "on", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Command", " ", "handler", " ", "starts", " ", "a", " ", "mapreduce", " ", "job", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "handler", " ", "allow", "s", " ", "user", " ", "to", " ", "start", " ", "a", " ", "mr", " ", "via", " ", "a", " ", "web", " ", "form", ".", " ", "It", "'", "s", " ", "\\u", "start", "\\u", "map", "\\", "10", ";", " ", " ", "method", " ", "can", " ", "als", "o", " ", "be", " ", "used", " ", "independent", "ly", " ", "to", " ", "start", " ", "a", " ", "mapreduce", ".", "\\", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Start", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Post", "Js", "on", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", "s", " ", "start", " ", "request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Map", "per", " ", "spec", " ", "as", " ", "form", " ", "argu", "ment", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "name_", "=_", "self_", "._", "\\u", "get", "\\u", "require", "d\\u", "param_", "(_", "\"", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "input", "\\u", "reader", "\\u", "spec_", "=_", "self_", "._", "\\u", "get", "\\u", "require", "d\\u", "param_", "(_", "\"", "mapper", "\\u", "input", "\\u", "reader", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "handler", "\\u", "spec_", "=_", "self_", "._", "\\u", "get", "\\u", "require", "d\\u", "param_", "(_", "\"", "mapper", "\\u", "handler", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "output", "\\u", "writer", "\\u", "spec_", "=_", "self_", "._", "request_", "._", "get_", "(_", "\"", "mapper", "\\u", "output", "\\u", "writer", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "params_", "=_", "self_", "._", "\\u", "get", "\\u", "params_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mapper", "\\u", "params", "\\u", "validator", "\"_", ",_", "\"", "mapper", "\\u", "params", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "self_", "._", "\\u", "get", "\\u", "params_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "params", "\\u", "validator", "\"_", ",_", "\"", "params", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "mr", "\\u", "params_", "=_", "map", "\\u", "job_", "._", "Jo", "b", "Config_", "._", "\\u", "get", "\\u", "default", "\\u", "mr", "\\u", "params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mr", "\\u", "params_", "._", "update_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "queue", "\\u", "name", "\"_", "in_", "mapper", "\\u", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mr", "\\u", "params_", "[_", "\"", "queue", "\\u", "name", "\"_", "]_", "=_", "mapper", "\\u", "params_", "[_", "\"", "queue", "\\u", "name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "some", " ", "mapper", " ", "param", " ", "default", "s", " ", "if", " ", "not", " ", "presen", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mapper", "\\u", "params_", "[_", "\"", "process", "ing", "\\u", "rate", "\"_", "]_", "=_", "int_", "(_", "mapper", "\\u", "params_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "process", "ing", "\\u", "rate", "\"_", ")_", "or_", "parameters_", "._", "config_", "._", "PROCESS", "ING", "\\u", "RAT", "E", "\\u", "PER", "\\u", "SEC", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "the", " ", "Map", "per", " ", "spec", ",", " ", "handler", ",", " ", "and", " ", "input", " ", "reader", "._", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "spec_", "=_", "model_", "._", "Map", "per", "Spec_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "handler", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "input", "\\u", "reader", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "mapper", "\\u", "params_", "._", "get_", "(_", "\"", "shard", "\\u", "count", "\"_", ",_", "parameters_", "._", "config_", "._", "SHAR", "D", "\\u", "COUNT_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "writer", "\\u", "spec_", "=_", "mapper", "\\u", "output", "\\u", "writer", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "id_", "=_", "self_", "._", "\\u", "start", "\\u", "map_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mr", "\\u", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", "=_", "mr", "\\u", "params_", "[_", "\"", "queue", "\\u", "name", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "app_", "=_", "mapper", "\\u", "params_", "._", "get_", "(_", "\"\\u", "app", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "json", "\\u", "response_", "[_", "\"", "mapreduce", "\\u", "id", "\"_", "]_", "=_", "mapreduce", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Post", "Js", "on", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "params_", "(_", "self_", ",_", "validator", "\\u", "parameter_", ",_", "name", "\\u", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", "s", " ", "addition", "al", " ", "user", "-", "supplie", "d", " ", "params", " ", "for", " ", "the", " ", "job", " ", "and", " ", "validates", " ", "them", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "validator", "\\u", "parameter", ":", " ", "name", " ", "of", " ", "the", " ", "request", " ", "parameter", " ", "whi", "ch", " ", "supplie", "s", "\\", "10", ";", " ", " ", " ", " ", "validator", " ", "for", " ", "this", " ", "parameter", " ", "set", ".", "\\", "10", ";", " ", " ", "name", "\\u", "prefix", ":", " ", "common", " ", "prefix", " ", "for", " ", "all", " ", "parameter", " ", "names", " ", "in", " ", "the", " ", "request", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Any", " ", "exception", " ", "raise", "d", " ", "by", " ", "the", " ", "'", "params", "\\u", "validator", "'", " ", "request", " ", "parameter", " ", "if", "\\", "10", ";", " ", " ", "the", " ", "params", " ", "fail", " ", "to", " ", "validat", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "user", " ", "parameter", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params", "\\u", "validator_", "=_", "self_", "._", "request_", "._", "get_", "(_", "validator", "\\u", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "self_", "._", "request_", "._", "arguments_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "._", "startswith_", "(_", "name", "\\u", "prefix_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "self_", "._", "request_", "._", "get", "\\u", "all_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adjusted", "\\u", "key_", "=_", "key_", "[_", "len_", "(_", "name", "\\u", "prefix_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "values_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "params_", "[_", "adjusted", "\\u", "key_", "]_", "=_", "values_", "[_", "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 ", " _", "user", "\\u", "params_", "[_", "adjusted", "\\u", "key_", "]_", "=_", "values_", "\\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_", "params", "\\u", "validator_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resolve", "d\\u", "validator_", "=_", "util_", "._", "for", "\\u", "name_", "(_", "params", "\\u", "validator_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resolve", "d\\u", "validator_", "(_", "user", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "user", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Post", "Js", "on", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "require", "d\\u", "param_", "(_", "self_", ",_", "param", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "require", "d", " ", "request", " ", "parameter", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "param", "\\u", "name", ":", " ", "name", " ", "of", " ", "request", " ", "parameter", " ", "to", " ", "fetch", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "parameter", " ", "value", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "error", "s", ".", "Not", "En", "ou", "gh", "Arg", "ument", "s", "Error", ":", " ", "if", " ", "parameter", " ", "is", " ", "not", " ", "specified", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "request_", "._", "get_", "(_", "param", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "errors_", "._", "Not", "En", "ou", "gh", "Arg", "ument", "s", "Error_", "(_", "param", "\\u", "name_", "+_", "\"", " ", "not", " ", "specified", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Post", "Js", "on", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "start", "\\u", "map_", "(_", "cls_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eta_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "countdown", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hook", "s", "\\u", "class", "\\u", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "app_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "xg", "\\u", "transaction_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "g", "-", "doc", "-", "args_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "g", "-", "doc", "-", "return", "-", "or", "-", "yield_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "See", " ", "control", ".", "start", "\\u", "map", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Requirements", " ", "for", " ", "this", " ", "method", ":", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "The", " ", "request", " ", "tha", "t", " ", "invoke", "s", " ", "this", " ", "method", " ", "can", " ", "eit", "her", " ", "be", " ", "regular", " ", "or", "\\", "10", ";", " ", " ", " ", "from", " ", "task", "queue", ".", " ", "So", " ", "task", "queue", " ", "specific", " ", "header", "s", " ", "can", " ", "not", " ", "be", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "Ea", "ch", " ", "invocation", " ", "transaction", "ally", " ", "starts", " ", "an", " ", "isolated", " ", "mapreduce", " ", "job", " ", "with", "\\", "10", ";", " ", " ", " ", "a", " ", "unique", " ", "id", ".", " ", "Map", "reduce", "State", " ", "shou", "ld", " ", "be", " ", "immediate", "ly", " ", "avail", "able", " ", "after", "\\", "10", ";", " ", " ", " ", "return", "ing", ".", " ", "See", " ", "control", ".", "start", "\\u", "map", "'", "s", " ", "doc", " ", "on", " ", "transaction", "al", ".", "\\", "10", ";", " ", " ", " ", " ", "3", ".", " ", "Meth", "od", " ", "shou", "ld", " ", "be", " ", "light", "weight", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Validate", " ", "input", " ", "reader", "._", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "input", "\\u", "reader", "\\u", "class_", "=_", "mapper", "\\u", "spec_", "._", "input", "\\u", "reader", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapper", "\\u", "input", "\\u", "reader", "\\u", "class_", "._", "validate_", "(_", "mapper", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "output", " ", "writer", "._", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "output", "\\u", "writer", "\\u", "class_", "=_", "mapper", "\\u", "spec_", "._", "output", "\\u", "writer", "\\u", "class_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mapper", "\\u", "output", "\\u", "writer", "\\u", "class_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapper", "\\u", "output", "\\u", "writer", "\\u", "class_", "._", "validate_", "(_", "mapper", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "id", " ", "and", " ", "mr", " ", "spec", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mapreduce", "\\u", "id_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "new", "\\u", "mapreduce", "\\u", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapreduce", "\\u", "spec_", "=_", "model_", "._", "Map", "reduce", "Spec_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapper", "\\u", "spec_", "._", "to", "\\u", "json_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hook", "s", "\\u", "class", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "mapper", " ", "handler", "._", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "=_", "context_", "._", "Context_", "(_", "mapreduce", "\\u", "spec_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "Context_", "._", "\\u", "set_", "(_", "ctx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "point", "less", "-", "statement_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapper", "\\u", "spec_", "._", "handler_", "\\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 ", " _", "context_", "._", "Context_", "._", "\\u", "set_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "state", "s", " ", "and", " ", "enqueue", " ", "task", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "in", "\\u", "xg", "\\u", "transaction_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "propagat", "ion_", "=_", "db_", "._", "MAN", "DAT", "ORY", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "propagat", "ion_", "=_", "db_", "._", "INDE", "PEND", "ENT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "db_", "._", "transaction", "al_", "(_", "propagat", "ion_", "=_", "propagat", "ion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "txn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "\\u", "create", "\\u", "and", "\\u", "save", "\\u", "state_", "(_", "mapreduce", "\\u", "spec_", ",_", "\\u", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "\\u", "add", "\\u", "kick", "off", "\\u", "task_", "(_", "mapreduce", "\\u", "params_", "[_", "\"", "base", "\\u", "path", "\"_", "]_", ",_", "mapreduce", "\\u", "spec_", ",_", "eta_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "countdown", "_", ",_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "txn_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "mapreduce", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Post", "Js", "on", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "create", "\\u", "and", "\\u", "save", "\\u", "state_", "(_", "cls_", ",_", "mapreduce", "\\u", "spec_", ",_", "\\u", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Save", " ", "mapreduce", " ", "state", " ", "to", " ", "datast", "ore", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Save", " ", "state", " ", "to", " ", "datast", "ore", " ", "so", " ", "tha", "t", " ", "UI", " ", "can", " ", "see", " ", "it", " ", "immediate", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "mapreduce", "\\u", "spec", ":", " ", "model", ".", "Map", "reduce", "Spec", ",", "\\", "10", ";", " ", " ", "\\u", "app", ":", " ", "app", " ", "id", " ", "if", " ", "specified", ".", " ", "Non", "e", " ", "other", "wis", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "The", " ", "saved", " ", "Map", "reduce", " ", "state", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "create", "\\u", "new_", "(_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "mapreduce", "\\u", "spec_", "=_", "mapreduce", "\\u", "spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "active_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "active", "\\u", "shards_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "app_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "._", "app", "\\u", "id_", "=_", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "=_", "util_", "._", "create", "\\u", "datast", "ore", "\\u", "write", "\\u", "config_", "(_", "mapreduce", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "._", "put_", "(_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Start", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Post", "Js", "on", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "add", "\\u", "kick", "off", "\\u", "task_", "(_", "cls_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eta_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "countdown", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Enque", "ues", " ", "a", " ", "new", " ", "kick", "off", " ", "task", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "\"", "mapreduce", "\\u", "id", "\"_", ":_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Task", " ", "is", " ", "not", " ", "named", " ", "so", " ", "tha", "t", " ", "it", " ", "can", " ", "be", " ", "adde", "d", " ", "within", " ", "a", " ", "transaction", "._", "\\u\\u\\uNL\\u\\u\\u_", "kick", "off", "\\u", "task_", "=_", "task", "queue_", "._", "Task_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "base", "\\u", "path_", "+_", "\"/", "kick", "off", "job", "\\u", "callback", "/\"_", "+_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "util_", "._", "\\u", "get", "\\u", "task", "\\u", "headers_", "(_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eta_", "=_", "eta_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "countdown", "_", "=_", "countdown", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hooks_", "=_", "mapreduce", "\\u", "spec_", "._", "get", "\\u", "hooks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hooks_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hooks_", "._", "enqueue", "\\u", "kick", "off", "\\u", "task_", "(_", "kick", "off", "\\u", "task_", ",_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kick", "off", "\\u", "task_", "._", "add_", "(_", "queue", "\\u", "name_", ",_", "transaction", "al_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Finali", "ze", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Task", "Queue", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Finali", "ze", " ", "map", " ", "job", " ", "by", " ", "delet", "ing", " ", "all", " ", "temporar", "y", " ", "entit", "ies", ".\"\"\"_", "\\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_", "Finali", "ze", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Task", "Queue", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapreduce", "\\u", "id_", "=_", "self_", "._", "request_", "._", "get_", "(_", "\"", "mapreduce", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mapreduce", "\\u", "state_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "get", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mapreduce", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "util_", "._", "create", "\\u", "datast", "ore", "\\u", "write", "\\u", "config_", "(_", "mapreduce", "\\u", "state_", "._", "mapreduce", "\\u", "spec_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "[_", "model_", "._", "Map", "reduce", "Control_", "._", "get", "\\u", "key", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "mapreduce", "\\u", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ss_", "in_", "model_", "._", "Shard", "State_", "._", "find", "\\u", "all", "\\u", "by", "\\u", "mapreduce", "\\u", "state_", "(_", "mapreduce", "\\u", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "._", "extend_", "(_", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "\\u", "Hu", "ge", "Task", "Payload_", "._", "all_", "(_", ")_", "._", "ancestor_", "(_", "ss_", ")_", "._", "run_", "(_", "keys", "\\u", "only_", "=_", "True_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "keys_", "._", "extend_", "(_", "list_", "(_", "model_", "._", "\\u", "Hu", "ge", "Task", "Payload_", "._", "all_", "(_", ")_", "._", "ancestor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "state_", ")_", "._", "run_", "(_", "keys", "\\u", "only_", "=_", "True_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "delete_", "(_", "keys_", ",_", "config_", "=_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Finali", "ze", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Task", "Queue", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "schedule_", "(_", "cls_", ",_", "mapreduce", "\\u", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Schedule", " ", "finalize", " ", "task", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "mapreduce", "\\u", "spec", ":", " ", "mapreduce", " ", "specifica", "tion", " ", "as", " ", "Map", "reduce", "Spec", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task", "\\u", "name_", "=_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", "+_", "\"-", "finalize", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "finalize", "\\u", "task_", "=_", "task", "queue_", "._", "Task_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "task", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "(_", "mapreduce", "\\u", "spec_", "._", "params_", "[_", "\"", "base", "\\u", "path", "\"_", "]_", "+_", "\"/", "finalize", "job", "\\u", "callback", "/\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "{_", "\"", "mapreduce", "\\u", "id", "\"_", ":_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "util_", "._", "\\u", "get", "\\u", "task", "\\u", "headers_", "(_", "mapreduce", "\\u", "spec_", "._", "mapreduce", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue", "\\u", "name_", "=_", "util_", "._", "get", "\\u", "queue", "\\u", "name_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "run", "\\u", "task", "\\u", "hook_", "(_", "mapreduce", "\\u", "spec_", "._", "get", "\\u", "hooks_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "enqueue", "\\u", "controlle", "r", "\\u", "task", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "finalize", "\\u", "task_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue", "\\u", "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 ", " _", "finalize", "\\u", "task_", "._", "add_", "(_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "task", "queue_", "._", "Tom", "bst", "oned", "Task", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "queue_", "._", "Task", "Al", "read", "y", "Exist", "s", "Error_", ")_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warning_", "(_", "\"", "Task", " ", "%", "r", " ", "alr", "ead", "y", " ", "exist", "s", ".", " ", "%", "s", ":", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "name_", ",_", "e_", "._", "\\u\\u", "class\\u\\u_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Clean", "Up", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Post", "Js", "on", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Command", " ", "to", " ", "kick", " ", "off", " ", "task", "s", " ", "to", " ", "clean", " ", "up", " ", "a", " ", "job", "'", "s", " ", "data", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Clean", "Up", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Post", "Js", "on", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mapreduce", "\\u", "id_", "=_", "self_", "._", "request_", "._", "get_", "(_", "\"", "mapreduce", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "state_", "=_", "model_", "._", "Map", "reduce", "State_", "._", "get", "\\u", "by", "\\u", "job", "\\u", "id_", "(_", "mapreduce", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mapreduce", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shard", "\\u", "keys_", "=_", "model_", "._", "Shard", "State_", "._", "calcul", "ate", "\\u", "keys", "\\u", "by", "\\u", "mapreduce", "\\u", "state_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "delete_", "(_", "shard", "\\u", "keys_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "delete_", "(_", "mapreduce", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "json", "\\u", "response_", "[_", "\"", "status", "\"_", "]_", "=_", "(_", "\"", "Jo", "b", " ", "%", "s", " ", "success", "full", "y", " ", "clean", "ed", " ", "up", ".\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "mapreduce", "\\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_", "Abo", "rt", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Post", "Js", "on", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Command", " ", "to", " ", "abort", " ", "a", " ", "runn", "ing", " ", "job", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Abo", "rt", "Jo", "b", "Handler_", "(_", "base", "\\u", "handler_", "._", "Post", "Js", "on", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "._", "Map", "reduce", "Control_", "._", "abort_", "(_", "self_", "._", "request_", "._", "get_", "(_", "\"", "mapreduce", "\\u", "id", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "json", "\\u", "response_", "[_", "\"", "status", "\"_", "]_", "=_", "\"", "Abo", "rt", " ", "signal", " ", "sent", ".\"_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
bartdag/recodoc2/recodoc2/apps/codebase/management/commands/linkcode.py
[ { "content": " @recocommand\n def handle_noargs(self, **options):\n pname = smart_decode(options.get('pname'))\n bname = smart_decode(options.get('bname'))\n release = smart_decode(options.get('release'))\n linker = smart_decode(options.get('linker'))\n source = smart_decode(options.get('source'))\n srelease = smart_decode(options.get('srelease'))\n\n # Optional parts\n lid = smart_decode(options.get('lid'))\n if lid == '-1':\n lid = None\n else:\n lid = int(lid)\n f_ids_path = smart_decode(options.get('fid'))\n if f_ids_path == '-1':\n f_ids_path = None\n f_ids_level = smart_decode(options.get('flevel'))\n if f_ids_level == '-1':\n f_ids_level = None\n\n link_code(pname, bname, release, linker, source, srelease,\n local_object_id=lid, filtered_ids_path=f_ids_path,\n filtered_ids_level=f_ids_level)", "metadata": "root.Command.handle_noargs", "header": "['class', 'Command', '(', 'NoArgsCommand', ')', ':', '___EOS___']", "index": 34 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Command_", "(_", "No", "Arg", "s", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "reco", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "handle", "\\u", "noar", "gs_", "(_", "self_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pname_", "=_", "smart", "\\u", "decode_", "(_", "options_", "._", "get_", "(_", "'", "pn", "ame", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bname_", "=_", "smart", "\\u", "decode_", "(_", "options_", "._", "get_", "(_", "'", "bn", "ame", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "release_", "=_", "smart", "\\u", "decode_", "(_", "options_", "._", "get_", "(_", "'", "release", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linker", "_", "=_", "smart", "\\u", "decode_", "(_", "options_", "._", "get_", "(_", "'", "linker", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "smart", "\\u", "decode_", "(_", "options_", "._", "get_", "(_", "'", "source", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sre", "lease_", "=_", "smart", "\\u", "decode_", "(_", "options_", "._", "get_", "(_", "'", "sre", "lease", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "nal", " ", "parts_", "\\u\\u\\uNL\\u\\u\\u_", "lid_", "=_", "smart", "\\u", "decode_", "(_", "options_", "._", "get_", "(_", "'", "lid", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lid_", "==_", "'-", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lid_", "=_", "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 ", " _", "lid_", "=_", "int_", "(_", "lid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "ids", "\\u", "path_", "=_", "smart", "\\u", "decode_", "(_", "options_", "._", "get_", "(_", "'", "fid", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f", "\\u", "ids", "\\u", "path_", "==_", "'-", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "ids", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f", "\\u", "ids", "\\u", "level_", "=_", "smart", "\\u", "decode_", "(_", "options_", "._", "get_", "(_", "'", "fle", "vel", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "f", "\\u", "ids", "\\u", "level_", "==_", "'-", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f", "\\u", "ids", "\\u", "level_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link", "\\u", "code_", "(_", "pname_", ",_", "bname_", ",_", "release_", ",_", "linker", "_", ",_", "source_", ",_", "sre", "lease_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "object\\u", "id_", "=_", "lid_", ",_", "filter", "ed", "\\u", "ids", "\\u", "path_", "=_", "f", "\\u", "ids", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "ed", "\\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 2, 2, 2, 2, 2 ]
Unused import
yasoob/youtube-dl-GUI/youtube_dl/YoutubeDL.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import, unicode_literals\n\nimport collections\nimport datetime\nimport errno\nimport io\nimport itertools\nimport json\nimport locale\nimport os\nimport platform\nimport re\nimport shutil\nimport subprocess\nimport socket\nimport sys\nimport time\nimport traceback\n\nif os.name == 'nt':\n import ctypes\n\nfrom .compat import (\n compat_cookiejar,\n compat_expanduser,\n compat_http_client,\n compat_kwargs,\n compat_str,\n compat_urllib_error,\n compat_urllib_request,\n)\nfrom .utils import (\n escape_url,\n ContentTooShortError,\n date_from_str,\n DateRange,\n DEFAULT_OUTTMPL,\n determine_ext,\n DownloadError,\n encodeFilename,\n ExtractorError,\n format_bytes,\n formatSeconds,\n get_term_width,\n locked_file,\n make_HTTPS_handler,\n MaxDownloadsReached,\n PagedList,\n PostProcessingError,\n platform_name,\n preferredencoding,\n SameFileError,\n sanitize_filename,\n subtitles_filename,\n takewhile_inclusive,\n UnavailableVideoError,\n url_basename,\n version_tuple,\n write_json_file,\n write_string,\n YoutubeDLHandler,\n prepend_extension,\n args_to_str,\n age_restricted,\n)\nfrom .cache import Cache\nfrom .extractor import get_info_extractor, gen_extractors\nfrom .downloader import get_suitable_downloader\nfrom .downloader.rtmp import rtmpdump_version\nfrom .postprocessor import (\n FFmpegFixupStretchedPP,\n FFmpegMergerPP,\n FFmpegPostProcessor,\n get_postprocessor,\n)\nfrom .version import __version__\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class YoutubeDL(object):\n \"\"\"YoutubeDL class.\n\n YoutubeDL objects are the ones responsible of downloading the\n actual video file and writing it to disk if the user has requested\n it, among some other tasks. In most cases there should be one per\n program. As, given a video URL, the downloader doesn't know how to\n extract all the needed information, task that InfoExtractors do, it\n has to pass the URL to one of them.\n\n For this, YoutubeDL objects have a method that allows\n InfoExtractors to be registered in a given order. When it is passed\n a URL, the YoutubeDL object handles it to the first InfoExtractor it\n finds that reports being able to handle it. The InfoExtractor extracts\n all the information about the video or videos the URL refers to, and\n YoutubeDL process the extracted information, possibly using a File\n Downloader to download the video.\n\n YoutubeDL objects accept a lot of parameters. In order not to saturate\n the object constructor with arguments, it receives a dictionary of\n options instead. These options are available through the params\n attribute for the InfoExtractors to use. The YoutubeDL also\n registers itself as the downloader in charge for the InfoExtractors\n that are added to it, so this is a \"mutual registration\".\n\n Available options:\n\n username: Username for authentication purposes.\n password: Password for authentication purposes.\n videopassword: Password for acces a video.\n usenetrc: Use netrc for authentication instead.\n verbose: Print additional info to stdout.\n quiet: Do not print messages to stdout.\n no_warnings: Do not print out anything for warnings.\n forceurl: Force printing final URL.\n forcetitle: Force printing title.\n forceid: Force printing ID.\n forcethumbnail: Force printing thumbnail URL.\n forcedescription: Force printing description.\n forcefilename: Force printing final filename.\n forceduration: Force printing duration.\n forcejson: Force printing info_dict as JSON.\n dump_single_json: Force printing the info_dict of the whole playlist\n (or video) as a single JSON line.\n simulate: Do not download the video files.\n format: Video format code. See options.py for more information.\n format_limit: Highest quality format to try.\n outtmpl: Template for output names.\n restrictfilenames: Do not allow \"&\" and spaces in file names\n ignoreerrors: Do not stop on download errors.\n nooverwrites: Prevent overwriting files.\n playliststart: Playlist item to start at.\n playlistend: Playlist item to end at.\n playlistreverse: Download playlist items in reverse order.\n matchtitle: Download only matching titles.\n rejecttitle: Reject downloads for matching titles.\n logger: Log messages to a logging.Logger instance.\n logtostderr: Log messages to stderr instead of stdout.\n writedescription: Write the video description to a .description file\n writeinfojson: Write the video description to a .info.json file\n writeannotations: Write the video annotations to a .annotations.xml file\n writethumbnail: Write the thumbnail image to a file\n writesubtitles: Write the video subtitles to a file\n writeautomaticsub: Write the automatic subtitles to a file\n allsubtitles: Downloads all the subtitles of the video\n (requires writesubtitles or writeautomaticsub)\n listsubtitles: Lists all available subtitles for the video\n subtitlesformat: Subtitle format [srt/sbv/vtt] (default=srt)\n subtitleslangs: List of languages of the subtitles to download\n keepvideo: Keep the video file after post-processing\n daterange: A DateRange object, download only if the upload_date is in the range.\n skip_download: Skip the actual download of the video file\n cachedir: Location of the cache files in the filesystem.\n False to disable filesystem cache.\n noplaylist: Download single video instead of a playlist if in doubt.\n age_limit: An integer representing the user's age in years.\n Unsuitable videos for the given age are skipped.\n min_views: An integer representing the minimum view count the video\n must have in order to not be skipped.\n Videos without view count information are always\n downloaded. None for no limit.\n max_views: An integer representing the maximum view count.\n Videos that are more popular than that are not\n downloaded.\n Videos without view count information are always\n downloaded. None for no limit.\n download_archive: File name of a file where all downloads are recorded.\n Videos already present in the file are not downloaded\n again.\n cookiefile: File name where cookies should be read from and dumped to.\n nocheckcertificate:Do not verify SSL certificates\n prefer_insecure: Use HTTP instead of HTTPS to retrieve information.\n At the moment, this is only supported by YouTube.\n proxy: URL of the proxy server to use\n socket_timeout: Time to wait for unresponsive hosts, in seconds\n bidi_workaround: Work around buggy terminals without bidirectional text\n support, using fridibi\n debug_printtraffic:Print out sent and received HTTP traffic\n include_ads: Download ads as well\n default_search: Prepend this string if an input url is not valid.\n 'auto' for elaborate guessing\n encoding: Use this encoding instead of the system-specified.\n extract_flat: Do not resolve URLs, return the immediate result.\n Pass in 'in_playlist' to only show this behavior for\n playlist items.\n postprocessors: A list of dictionaries, each with an entry\n * key: The name of the postprocessor. See\n youtube_dl/postprocessor/__init__.py for a list.\n as well as any further keyword arguments for the\n postprocessor.\n progress_hooks: A list of functions that get called on download\n progress, with a dictionary with the entries\n * filename: The final filename\n * status: One of \"downloading\" and \"finished\"\n\n The dict may also have some of the following entries:\n\n * downloaded_bytes: Bytes on disk\n * total_bytes: Size of the whole file, None if unknown\n * tmpfilename: The filename we're currently writing to\n * eta: The estimated time in seconds, None if unknown\n * speed: The download speed in bytes/second, None if\n unknown\n\n Progress hooks are guaranteed to be called at least once\n (with status \"finished\") if the download is successful.\n merge_output_format: Extension to use when merging formats.\n fixup: Automatically correct known faults of the file.\n One of:\n - \"never\": do nothing\n - \"warn\": only emit a warning\n - \"detect_or_warn\": check whether we can do anything\n about it, warn otherwise\n source_address: (Experimental) Client-side IP address to bind to.\n call_home: Boolean, true iff we are allowed to contact the\n youtube-dl servers for debugging.\n\n\n The following parameters are not used by YoutubeDL itself, they are used by\n the FileDownloader:\n nopart, updatetime, buffersize, ratelimit, min_filesize, max_filesize, test,\n noresizebuffer, retries, continuedl, noprogress, consoletitle\n\n The following options are used by the post processors:\n prefer_ffmpeg: If True, use ffmpeg instead of avconv if both are available,\n otherwise prefer avconv.\n exec_cmd: Arbitrary command to run after downloading\n \"\"\"\n\n params = None\n _ies = []\n _pps = []\n _download_retcode = None\n _num_downloads = None\n _screen_file = 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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.YoutubeDL", "header": "['module', '___EOS___']", "index": 81 }, { "content": " def __init__(self, params=None, auto_init=True):\n \"\"\"Create a FileDownloader object with the given options.\"\"\"\n if params is None:\n params = {}\n self._ies = []\n self._ies_instances = {}\n self._pps = []\n self._progress_hooks = []\n self._download_retcode = 0\n self._num_downloads = 0\n self._screen_file = [sys.stdout, sys.stderr][params.get('logtostderr', False)]\n self._err_file = sys.stderr\n self.params = params\n self.cache = Cache(self)\n\n if params.get('bidi_workaround', False):\n try:\n import pty\n master, slave = pty.openpty()\n width = get_term_width()\n if width is None:\n width_args = []\n else:\n width_args = ['-w', str(width)]\n sp_kwargs = dict(\n stdin=subprocess.PIPE,\n stdout=slave,\n stderr=self._err_file)\n try:\n self._output_process = subprocess.Popen(\n ['bidiv'] + width_args, **sp_kwargs\n )\n except OSError:\n self._output_process = subprocess.Popen(\n ['fribidi', '-c', 'UTF-8'] + width_args, **sp_kwargs)\n self._output_channel = os.fdopen(master, 'rb')\n except OSError as ose:\n if ose.errno == 2:\n self.report_warning('Could not find fribidi executable, ignoring --bidi-workaround . Make sure that fribidi is an executable file in one of the directories in your $PATH.')\n else:\n raise\n\n if (sys.version_info >= (3,) and sys.platform != 'win32' and\n sys.getfilesystemencoding() in ['ascii', 'ANSI_X3.4-1968']\n and not params.get('restrictfilenames', False)):\n # On Python 3, the Unicode filesystem API will throw errors (#1474)\n self.report_warning(\n 'Assuming --restrict-filenames since file system encoding '\n 'cannot encode all characters. '\n 'Set the LC_ALL environment variable to fix this.')\n self.params['restrictfilenames'] = True\n\n if '%(stitle)s' in self.params.get('outtmpl', ''):\n self.report_warning('%(stitle)s is deprecated. Use the %(title)s and the --restrict-filenames flag(which also secures %(uploader)s et al) instead.')\n\n self._setup_opener()\n\n if auto_init:\n self.print_debug_header()\n self.add_default_info_extractors()\n\n for pp_def_raw in self.params.get('postprocessors', []):\n pp_class = get_postprocessor(pp_def_raw['key'])\n pp_def = dict(pp_def_raw)\n del pp_def['key']\n pp = pp_class(self, **compat_kwargs(pp_def))\n self.add_post_processor(pp)\n\n for ph in self.params.get('progress_hooks', []):\n self.add_progress_hook(ph)", "metadata": "root.YoutubeDL.__init__", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 237 }, { "content": " def warn_if_short_id(self, argv):\n # short YouTube ID starting with dash?\n idxs = [\n i for i, a in enumerate(argv)\n if re.match(r'^-[0-9A-Za-z_-]{10}$', a)]\n if idxs:\n correct_argv = (\n ['youtube-dl'] +\n [a for i, a in enumerate(argv) if i not in idxs] +\n ['--'] + [argv[i] for i in idxs]\n )\n self.report_warning(\n 'Long argument string detected. '\n 'Use -- to separate parameters and URLs, like this:\\n%s\\n' %\n args_to_str(correct_argv))", "metadata": "root.YoutubeDL.warn_if_short_id", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 308 }, { "content": " def add_info_extractor(self, ie):\n \"\"\"Add an InfoExtractor object to the end of the list.\"\"\"\n self._ies.append(ie)\n self._ies_instances[ie.ie_key()] = ie\n ie.set_downloader(self)", "metadata": "root.YoutubeDL.add_info_extractor", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 324 }, { "content": " def get_info_extractor(self, ie_key):\n \"\"\"\n Get an instance of an IE with name ie_key, it will try to get one from\n the _ies list, if there's no instance it will create a new one and add\n it to the extractor list.\n \"\"\"\n ie = self._ies_instances.get(ie_key)\n if ie is None:\n ie = get_info_extractor(ie_key)()\n self.add_info_extractor(ie)\n return ie", "metadata": "root.YoutubeDL.get_info_extractor", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 330 }, { "content": " def add_default_info_extractors(self):\n \"\"\"\n Add the InfoExtractors returned by gen_extractors to the end of the list\n \"\"\"\n for ie in gen_extractors():\n self.add_info_extractor(ie)", "metadata": "root.YoutubeDL.add_default_info_extractors", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 342 }, { "content": " def add_post_processor(self, pp):\n \"\"\"Add a PostProcessor object to the end of the chain.\"\"\"\n self._pps.append(pp)\n pp.set_downloader(self)", "metadata": "root.YoutubeDL.add_post_processor", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 349 }, { "content": " def add_progress_hook(self, ph):\n \"\"\"Add the progress hook (currently only for the file downloader)\"\"\"\n self._progress_hooks.append(ph)", "metadata": "root.YoutubeDL.add_progress_hook", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 354 }, { "content": " def _bidi_workaround(self, message):\n if not hasattr(self, '_output_channel'):\n return message\n\n assert hasattr(self, '_output_process')\n assert isinstance(message, compat_str)\n line_count = message.count('\\n') + 1\n self._output_process.stdin.write((message + '\\n').encode('utf-8'))\n self._output_process.stdin.flush()\n res = ''.join(self._output_channel.readline().decode('utf-8')\n for _ in range(line_count))\n return res[:-len('\\n')]", "metadata": "root.YoutubeDL._bidi_workaround", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 358 }, { "content": " def to_screen(self, message, skip_eol=False):\n \"\"\"Print message to stdout if not in quiet mode.\"\"\"\n return self.to_stdout(message, skip_eol, check_quiet=True)", "metadata": "root.YoutubeDL.to_screen", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 371 }, { "content": " def _write_string(self, s, out=None):\n write_string(s, out=out, encoding=self.params.get('encoding'))", "metadata": "root.YoutubeDL._write_string", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 375 }, { "content": " def to_stdout(self, message, skip_eol=False, check_quiet=False):\n \"\"\"Print message to stdout if not in quiet mode.\"\"\"\n if self.params.get('logger'):\n self.params['logger'].debug(message)\n elif not check_quiet or not self.params.get('quiet', False):\n message = self._bidi_workaround(message)\n terminator = ['\\n', ''][skip_eol]\n output = message + terminator\n\n self._write_string(output, self._screen_file)", "metadata": "root.YoutubeDL.to_stdout", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 378 }, { "content": " def to_stderr(self, message):\n \"\"\"Print message to stderr.\"\"\"\n assert isinstance(message, compat_str)\n if self.params.get('logger'):\n self.params['logger'].error(message)\n else:\n message = self._bidi_workaround(message)\n output = message + '\\n'\n self._write_string(output, self._err_file)", "metadata": "root.YoutubeDL.to_stderr", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 389 }, { "content": " def to_console_title(self, message):\n if not self.params.get('consoletitle', False):\n return\n if os.name == 'nt' and ctypes.windll.kernel32.GetConsoleWindow():\n # c_wchar_p() might not be necessary if `message` is\n # already of type unicode()\n ctypes.windll.kernel32.SetConsoleTitleW(ctypes.c_wchar_p(message))\n elif 'TERM' in os.environ:\n self._write_string('\\033]0;%s\\007' % message, self._screen_file)", "metadata": "root.YoutubeDL.to_console_title", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 399 }, { "content": " def save_console_title(self):\n if not self.params.get('consoletitle', False):\n return\n if 'TERM' in os.environ:\n # Save the title on stack\n self._write_string('\\033[22;0t', self._screen_file)", "metadata": "root.YoutubeDL.save_console_title", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 409 }, { "content": " def restore_console_title(self):\n if not self.params.get('consoletitle', False):\n return\n if 'TERM' in os.environ:\n # Restore the title from stack\n self._write_string('\\033[23;0t', self._screen_file)", "metadata": "root.YoutubeDL.restore_console_title", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 416 }, { "content": " def __enter__(self):\n self.save_console_title()\n return self", "metadata": "root.YoutubeDL.__enter__", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 423 }, { "content": " def __exit__(self, *args):\n self.restore_console_title()\n\n if self.params.get('cookiefile') is not None:\n self.cookiejar.save()", "metadata": "root.YoutubeDL.__exit__", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 427 }, { "content": " def trouble(self, message=None, tb=None):\n \"\"\"Determine action to take when a download problem appears.\n\n Depending on if the downloader has been configured to ignore\n download errors or not, this method may throw an exception or\n not when errors are found, after printing the message.\n\n tb, if given, is additional traceback information.\n \"\"\"\n if message is not None:\n self.to_stderr(message)\n if self.params.get('verbose'):\n if tb is None:\n if sys.exc_info()[0]: # if .trouble has been called from an except block\n tb = ''\n if hasattr(sys.exc_info()[1], 'exc_info') and sys.exc_info()[1].exc_info[0]:\n tb += ''.join(traceback.format_exception(*sys.exc_info()[1].exc_info))\n tb += compat_str(traceback.format_exc())\n else:\n tb_data = traceback.format_list(traceback.extract_stack())\n tb = ''.join(tb_data)\n self.to_stderr(tb)\n if not self.params.get('ignoreerrors', False):\n if sys.exc_info()[0] and hasattr(sys.exc_info()[1], 'exc_info') and sys.exc_info()[1].exc_info[0]:\n exc_info = sys.exc_info()[1].exc_info\n else:\n exc_info = sys.exc_info()\n raise DownloadError(message, exc_info)\n self._download_retcode = 1", "metadata": "root.YoutubeDL.trouble", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 433 }, { "content": " def report_warning(self, message):\n '''\n Print the message to stderr, it will be prefixed with 'WARNING:'\n If stderr is a tty file the 'WARNING:' will be colored\n '''\n if self.params.get('logger') is not None:\n self.params['logger'].warning(message)\n else:\n if self.params.get('no_warnings'):\n return\n if self._err_file.isatty() and os.name != 'nt':\n _msg_header = '\\033[0;33mWARNING:\\033[0m'\n else:\n _msg_header = 'WARNING:'\n warning_message = '%s %s' % (_msg_header, message)\n self.to_stderr(warning_message)", "metadata": "root.YoutubeDL.report_warning", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 463 }, { "content": " def report_error(self, message, tb=None):\n '''\n Do the same as trouble, but prefixes the message with 'ERROR:', colored\n in red if stderr is a tty file.\n '''\n if self._err_file.isatty() and os.name != 'nt':\n _msg_header = '\\033[0;31mERROR:\\033[0m'\n else:\n _msg_header = 'ERROR:'\n error_message = '%s %s' % (_msg_header, message)\n self.trouble(error_message, tb)", "metadata": "root.YoutubeDL.report_error", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 480 }, { "content": " def report_file_already_downloaded(self, file_name):\n \"\"\"Report file has already been fully downloaded.\"\"\"\n try:\n self.to_screen('[download] %s has already been downloaded' % file_name)\n except UnicodeEncodeError:\n self.to_screen('[download] The file has already been downloaded')", "metadata": "root.YoutubeDL.report_file_already_downloaded", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 492 }, { "content": " def prepare_filename(self, info_dict):\n \"\"\"Generate the output filename.\"\"\"\n try:\n template_dict = dict(info_dict)\n\n template_dict['epoch'] = int(time.time())\n autonumber_size = self.params.get('autonumber_size')\n if autonumber_size is None:\n autonumber_size = 5\n autonumber_templ = '%0' + str(autonumber_size) + 'd'\n template_dict['autonumber'] = autonumber_templ % self._num_downloads\n if template_dict.get('playlist_index') is not None:\n template_dict['playlist_index'] = '%0*d' % (len(str(template_dict['n_entries'])), template_dict['playlist_index'])\n if template_dict.get('resolution') is None:\n if template_dict.get('width') and template_dict.get('height'):\n template_dict['resolution'] = '%dx%d' % (template_dict['width'], template_dict['height'])\n elif template_dict.get('height'):\n template_dict['resolution'] = '%sp' % template_dict['height']\n elif template_dict.get('width'):\n template_dict['resolution'] = '?x%d' % template_dict['width']\n\n sanitize = lambda k, v: sanitize_filename(\n compat_str(v),\n restricted=self.params.get('restrictfilenames'),\n is_id=(k == 'id'))\n template_dict = dict((k, sanitize(k, v))\n for k, v in template_dict.items()\n if v is not None)\n template_dict = collections.defaultdict(lambda: 'NA', template_dict)\n\n outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)\n tmpl = compat_expanduser(outtmpl)\n filename = tmpl % template_dict\n return filename\n except ValueError as err:\n self.report_error('Error in output template: ' + str(err) + ' (encoding: ' + repr(preferredencoding()) + ')')\n return None", "metadata": "root.YoutubeDL.prepare_filename", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 499 }, { "content": " def _match_entry(self, info_dict):\n \"\"\" Returns None iff the file should be downloaded \"\"\"\n\n video_title = info_dict.get('title', info_dict.get('id', 'video'))\n if 'title' in info_dict:\n # This can happen when we're just evaluating the playlist\n title = info_dict['title']\n matchtitle = self.params.get('matchtitle', False)\n if matchtitle:\n if not re.search(matchtitle, title, re.IGNORECASE):\n return '\"' + title + '\" title did not match pattern \"' + matchtitle + '\"'\n rejecttitle = self.params.get('rejecttitle', False)\n if rejecttitle:\n if re.search(rejecttitle, title, re.IGNORECASE):\n return '\"' + title + '\" title matched reject pattern \"' + rejecttitle + '\"'\n date = info_dict.get('upload_date', None)\n if date is not None:\n dateRange = self.params.get('daterange', DateRange())\n if date not in dateRange:\n return '%s upload date is not in range %s' % (date_from_str(date).isoformat(), dateRange)\n view_count = info_dict.get('view_count', None)\n if view_count is not None:\n min_views = self.params.get('min_views')\n if min_views is not None and view_count < min_views:\n return 'Skipping %s, because it has not reached minimum view count (%d/%d)' % (video_title, view_count, min_views)\n max_views = self.params.get('max_views')\n if max_views is not None and view_count > max_views:\n return 'Skipping %s, because it has exceeded the maximum view count (%d/%d)' % (video_title, view_count, max_views)\n if age_restricted(info_dict.get('age_limit'), self.params.get('age_limit')):\n return 'Skipping \"%s\" because it is age restricted' % title\n if self.in_download_archive(info_dict):\n return '%s has already been recorded in archive' % video_title\n return None", "metadata": "root.YoutubeDL._match_entry", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 537 }, { "content": " @staticmethod\n def add_extra_info(info_dict, extra_info):\n '''Set the keys from extra_info in info dict if they are missing'''\n for key, value in extra_info.items():\n info_dict.setdefault(key, value)", "metadata": "root.YoutubeDL.add_extra_info", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 571 }, { "content": " def extract_info(self, url, download=True, ie_key=None, extra_info={},\n process=True):\n '''\n Returns a list with a dictionary for each video we find.\n If 'download', also downloads the videos.\n extra_info is a dict containing the extra values to add to each result\n '''\n\n if ie_key:\n ies = [self.get_info_extractor(ie_key)]\n else:\n ies = self._ies\n\n for ie in ies:\n if not ie.suitable(url):\n continue\n\n if not ie.working():\n self.report_warning('The program functionality for this site has been marked as broken, '\n 'and will probably not work.')\n\n try:\n ie_result = ie.extract(url)\n if ie_result is None: # Finished already (backwards compatibility; listformats and friends should be moved here)\n break\n if isinstance(ie_result, list):\n # Backwards compatibility: old IE result format\n ie_result = {\n '_type': 'compat_list',\n 'entries': ie_result,\n }\n self.add_default_extra_info(ie_result, ie, url)\n if process:\n return self.process_ie_result(ie_result, download, extra_info)\n else:\n return ie_result\n except ExtractorError as de: # An error we somewhat expected\n self.report_error(compat_str(de), de.format_traceback())\n break\n except MaxDownloadsReached:\n raise\n except Exception as e:\n if self.params.get('ignoreerrors', False):\n self.report_error(compat_str(e), tb=compat_str(traceback.format_exc()))\n break\n else:\n raise\n else:\n self.report_error('no suitable InfoExtractor for URL %s' % url)", "metadata": "root.YoutubeDL.extract_info", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 577 }, { "content": " def add_default_extra_info(self, ie_result, ie, url):\n self.add_extra_info(ie_result, {\n 'extractor': ie.IE_NAME,\n 'webpage_url': url,\n 'webpage_url_basename': url_basename(url),\n 'extractor_key': ie.ie_key(),\n })", "metadata": "root.YoutubeDL.add_default_extra_info", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 627 }, { "content": " def process_ie_result(self, ie_result, download=True, extra_info={}):\n \"\"\"\n Take the result of the ie(may be modified) and resolve all unresolved\n references (URLs, playlist items).\n\n It will also download the videos if 'download'.\n Returns the resolved ie_result.\n \"\"\"\n\n result_type = ie_result.get('_type', 'video')\n\n if result_type in ('url', 'url_transparent'):\n extract_flat = self.params.get('extract_flat', False)\n if ((extract_flat == 'in_playlist' and 'playlist' in extra_info) or\n extract_flat is True):\n if self.params.get('forcejson', False):\n self.to_stdout(json.dumps(ie_result))\n return ie_result\n\n if result_type == 'video':\n self.add_extra_info(ie_result, extra_info)\n return self.process_video_result(ie_result, download=download)\n elif result_type == 'url':\n # We have to add extra_info to the results because it may be\n # contained in a playlist\n return self.extract_info(ie_result['url'],\n download,\n ie_key=ie_result.get('ie_key'),\n extra_info=extra_info)\n elif result_type == 'url_transparent':\n # Use the information from the embedding page\n info = self.extract_info(\n ie_result['url'], ie_key=ie_result.get('ie_key'),\n extra_info=extra_info, download=False, process=False)\n\n force_properties = dict(\n (k, v) for k, v in ie_result.items() if v is not None)\n for f in ('_type', 'url'):\n if f in force_properties:\n del force_properties[f]\n new_result = info.copy()\n new_result.update(force_properties)\n\n assert new_result.get('_type') != 'url_transparent'\n\n return self.process_ie_result(\n new_result, download=download, extra_info=extra_info)\n elif result_type == 'playlist' or result_type == 'multi_video':\n # We process each entry in the playlist\n playlist = ie_result.get('title', None) or ie_result.get('id', None)\n self.to_screen('[download] Downloading playlist: %s' % playlist)\n\n playlist_results = []\n\n playliststart = self.params.get('playliststart', 1) - 1\n playlistend = self.params.get('playlistend', None)\n # For backwards compatibility, interpret -1 as whole list\n if playlistend == -1:\n playlistend = None\n\n ie_entries = ie_result['entries']\n if isinstance(ie_entries, list):\n n_all_entries = len(ie_entries)\n entries = ie_entries[playliststart:playlistend]\n n_entries = len(entries)\n self.to_screen(\n \"[%s] playlist %s: Collected %d video ids (downloading %d of them)\" %\n (ie_result['extractor'], playlist, n_all_entries, n_entries))\n elif isinstance(ie_entries, PagedList):\n entries = ie_entries.getslice(\n playliststart, playlistend)\n n_entries = len(entries)\n self.to_screen(\n \"[%s] playlist %s: Downloading %d videos\" %\n (ie_result['extractor'], playlist, n_entries))\n else: # iterable\n entries = list(itertools.islice(\n ie_entries, playliststart, playlistend))\n n_entries = len(entries)\n self.to_screen(\n \"[%s] playlist %s: Downloading %d videos\" %\n (ie_result['extractor'], playlist, n_entries))\n\n if self.params.get('playlistreverse', False):\n entries = entries[::-1]\n\n for i, entry in enumerate(entries, 1):\n self.to_screen('[download] Downloading video %s of %s' % (i, n_entries))\n extra = {\n 'n_entries': n_entries,\n 'playlist': playlist,\n 'playlist_id': ie_result.get('id'),\n 'playlist_title': ie_result.get('title'),\n 'playlist_index': i + playliststart,\n 'extractor': ie_result['extractor'],\n 'webpage_url': ie_result['webpage_url'],\n 'webpage_url_basename': url_basename(ie_result['webpage_url']),\n 'extractor_key': ie_result['extractor_key'],\n }\n\n reason = self._match_entry(entry)\n if reason is not None:\n self.to_screen('[download] ' + reason)\n continue\n\n entry_result = self.process_ie_result(entry,\n download=download,\n extra_info=extra)\n playlist_results.append(entry_result)\n ie_result['entries'] = playlist_results\n return ie_result\n elif result_type == 'compat_list':\n self.report_warning(\n 'Extractor %s returned a compat_list result. '\n 'It needs to be updated.' % ie_result.get('extractor'))\n\n def _fixup(r):\n self.add_extra_info(\n r,\n {\n 'extractor': ie_result['extractor'],\n 'webpage_url': ie_result['webpage_url'],\n 'webpage_url_basename': url_basename(ie_result['webpage_url']),\n 'extractor_key': ie_result['extractor_key'],\n }\n )\n return r\n ie_result['entries'] = [\n self.process_ie_result(_fixup(r), download, extra_info)\n for r in ie_result['entries']\n ]\n return ie_result\n else:\n raise Exception('Invalid result type: %s' % result_type)", "metadata": "root.YoutubeDL.process_ie_result", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 635 }, { "content": " def select_format(self, format_spec, available_formats):\n if format_spec == 'best' or format_spec is None:\n return available_formats[-1]\n elif format_spec == 'worst':\n return available_formats[0]\n elif format_spec == 'bestaudio':\n audio_formats = [\n f for f in available_formats\n if f.get('vcodec') == 'none']\n if audio_formats:\n return audio_formats[-1]\n elif format_spec == 'worstaudio':\n audio_formats = [\n f for f in available_formats\n if f.get('vcodec') == 'none']\n if audio_formats:\n return audio_formats[0]\n elif format_spec == 'bestvideo':\n video_formats = [\n f for f in available_formats\n if f.get('acodec') == 'none']\n if video_formats:\n return video_formats[-1]\n elif format_spec == 'worstvideo':\n video_formats = [\n f for f in available_formats\n if f.get('acodec') == 'none']\n if video_formats:\n return video_formats[0]\n else:\n extensions = ['mp4', 'flv', 'webm', '3gp', 'm4a', 'mp3', 'ogg', 'aac', 'wav']\n if format_spec in extensions:\n filter_f = lambda f: f['ext'] == format_spec\n else:\n filter_f = lambda f: f['format_id'] == format_spec\n matches = list(filter(filter_f, available_formats))\n if matches:\n return matches[-1]\n return None", "metadata": "root.YoutubeDL.select_format", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 770 }, { "content": " def process_video_result(self, info_dict, download=True):\n assert info_dict.get('_type', 'video') == 'video'\n\n if 'id' not in info_dict:\n raise ExtractorError('Missing \"id\" field in extractor result')\n if 'title' not in info_dict:\n raise ExtractorError('Missing \"title\" field in extractor result')\n\n if 'playlist' not in info_dict:\n # It isn't part of a playlist\n info_dict['playlist'] = None\n info_dict['playlist_index'] = None\n\n thumbnails = info_dict.get('thumbnails')\n if thumbnails:\n thumbnails.sort(key=lambda t: (\n t.get('width'), t.get('height'), t.get('url')))\n for t in thumbnails:\n if 'width' in t and 'height' in t:\n t['resolution'] = '%dx%d' % (t['width'], t['height'])\n\n if thumbnails and 'thumbnail' not in info_dict:\n info_dict['thumbnail'] = thumbnails[-1]['url']\n\n if 'display_id' not in info_dict and 'id' in info_dict:\n info_dict['display_id'] = info_dict['id']\n\n if info_dict.get('upload_date') is None and info_dict.get('timestamp') is not None:\n # Working around negative timestamps in Windows\n # (see http://bugs.python.org/issue1646728)\n if info_dict['timestamp'] < 0 and os.name == 'nt':\n info_dict['timestamp'] = 0\n upload_date = datetime.datetime.utcfromtimestamp(\n info_dict['timestamp'])\n info_dict['upload_date'] = upload_date.strftime('%Y%m%d')\n\n # This extractors handle format selection themselves\n if info_dict['extractor'] in ['Youku']:\n if download:\n self.process_info(info_dict)\n return info_dict\n\n # We now pick which formats have to be downloaded\n if info_dict.get('formats') is None:\n # There's only one format available\n formats = [info_dict]\n else:\n formats = info_dict['formats']\n\n if not formats:\n raise ExtractorError('No video formats found!')\n\n # We check that all the formats have the format and format_id fields\n for i, format in enumerate(formats):\n if 'url' not in format:\n raise ExtractorError('Missing \"url\" key in result (index %d)' % i)\n\n if format.get('format_id') is None:\n format['format_id'] = compat_str(i)\n if format.get('format') is None:\n format['format'] = '{id} - {res}{note}'.format(\n id=format['format_id'],\n res=self.format_resolution(format),\n note=' ({0})'.format(format['format_note']) if format.get('format_note') is not None else '',\n )\n # Automatically determine file extension if missing\n if 'ext' not in format:\n format['ext'] = determine_ext(format['url']).lower()\n\n format_limit = self.params.get('format_limit', None)\n if format_limit:\n formats = list(takewhile_inclusive(\n lambda f: f['format_id'] != format_limit, formats\n ))\n\n # TODO Central sorting goes here\n\n if formats[0] is not info_dict:\n # only set the 'formats' fields if the original info_dict list them\n # otherwise we end up with a circular reference, the first (and unique)\n # element in the 'formats' field in info_dict is info_dict itself,\n # wich can't be exported to json\n info_dict['formats'] = formats\n if self.params.get('listformats', None):\n self.list_formats(info_dict)\n return\n\n req_format = self.params.get('format')\n if req_format is None:\n req_format = 'best'\n formats_to_download = []\n # The -1 is for supporting YoutubeIE\n if req_format in ('-1', 'all'):\n formats_to_download = formats\n else:\n for rfstr in req_format.split(','):\n # We can accept formats requested in the format: 34/5/best, we pick\n # the first that is available, starting from left\n req_formats = rfstr.split('/')\n for rf in req_formats:\n if re.match(r'.+?\\+.+?', rf) is not None:\n # Two formats have been requested like '137+139'\n format_1, format_2 = rf.split('+')\n formats_info = (self.select_format(format_1, formats),\n self.select_format(format_2, formats))\n if all(formats_info):\n # The first format must contain the video and the\n # second the audio\n if formats_info[0].get('vcodec') == 'none':\n self.report_error('The first format must '\n 'contain the video, try using '\n '\"-f %s+%s\"' % (format_2, format_1))\n return\n output_ext = (\n formats_info[0]['ext']\n if self.params.get('merge_output_format') is None\n else self.params['merge_output_format'])\n selected_format = {\n 'requested_formats': formats_info,\n 'format': rf,\n 'ext': formats_info[0]['ext'],\n 'width': formats_info[0].get('width'),\n 'height': formats_info[0].get('height'),\n 'resolution': formats_info[0].get('resolution'),\n 'fps': formats_info[0].get('fps'),\n 'vcodec': formats_info[0].get('vcodec'),\n 'vbr': formats_info[0].get('vbr'),\n 'stretched_ratio': formats_info[0].get('stretched_ratio'),\n 'acodec': formats_info[1].get('acodec'),\n 'abr': formats_info[1].get('abr'),\n 'ext': output_ext,\n }\n else:\n selected_format = None\n else:\n selected_format = self.select_format(rf, formats)\n if selected_format is not None:\n formats_to_download.append(selected_format)\n break\n if not formats_to_download:\n raise ExtractorError('requested format not available',\n expected=True)\n\n if download:\n if len(formats_to_download) > 1:\n self.to_screen('[info] %s: downloading video in %s formats' % (info_dict['id'], len(formats_to_download)))\n for format in formats_to_download:\n new_info = dict(info_dict)\n new_info.update(format)\n self.process_info(new_info)\n # We update the info dict with the best quality format (backwards compatibility)\n info_dict.update(formats_to_download[-1])\n return info_dict", "metadata": "root.YoutubeDL.process_video_result", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 810 }, { "content": " def process_info(self, info_dict):\n \"\"\"Process a single resolved IE result.\"\"\"\n\n assert info_dict.get('_type', 'video') == 'video'\n\n max_downloads = self.params.get('max_downloads')\n if max_downloads is not None:\n if self._num_downloads >= int(max_downloads):\n raise MaxDownloadsReached()\n\n info_dict['fulltitle'] = info_dict['title']\n if len(info_dict['title']) > 200:\n info_dict['title'] = info_dict['title'][:197] + '...'\n\n # Keep for backwards compatibility\n info_dict['stitle'] = info_dict['title']\n\n if 'format' not in info_dict:\n info_dict['format'] = info_dict['ext']\n\n reason = self._match_entry(info_dict)\n if reason is not None:\n self.to_screen('[download] ' + reason)\n return\n\n self._num_downloads += 1\n\n filename = self.prepare_filename(info_dict)\n\n # Forced printings\n if self.params.get('forcetitle', False):\n self.to_stdout(info_dict['fulltitle'])\n if self.params.get('forceid', False):\n self.to_stdout(info_dict['id'])\n if self.params.get('forceurl', False):\n if info_dict.get('requested_formats') is not None:\n for f in info_dict['requested_formats']:\n self.to_stdout(f['url'] + f.get('play_path', ''))\n else:\n # For RTMP URLs, also include the playpath\n self.to_stdout(info_dict['url'] + info_dict.get('play_path', ''))\n if self.params.get('forcethumbnail', False) and info_dict.get('thumbnail') is not None:\n self.to_stdout(info_dict['thumbnail'])\n if self.params.get('forcedescription', False) and info_dict.get('description') is not None:\n self.to_stdout(info_dict['description'])\n if self.params.get('forcefilename', False) and filename is not None:\n self.to_stdout(filename)\n if self.params.get('forceduration', False) and info_dict.get('duration') is not None:\n self.to_stdout(formatSeconds(info_dict['duration']))\n if self.params.get('forceformat', False):\n self.to_stdout(info_dict['format'])\n if self.params.get('forcejson', False):\n info_dict['_filename'] = filename\n self.to_stdout(json.dumps(info_dict))\n if self.params.get('dump_single_json', False):\n info_dict['_filename'] = filename\n\n # Do nothing else if in simulate mode\n if self.params.get('simulate', False):\n return\n\n if filename is None:\n return\n\n try:\n dn = os.path.dirname(encodeFilename(filename))\n if dn and not os.path.exists(dn):\n os.makedirs(dn)\n except (OSError, IOError) as err:\n self.report_error('unable to create directory ' + compat_str(err))\n return\n\n if self.params.get('writedescription', False):\n descfn = filename + '.description'\n if self.params.get('nooverwrites', False) and os.path.exists(encodeFilename(descfn)):\n self.to_screen('[info] Video description is already present')\n elif info_dict.get('description') is None:\n self.report_warning('There\\'s no description to write.')\n else:\n try:\n self.to_screen('[info] Writing video description to: ' + descfn)\n with io.open(encodeFilename(descfn), 'w', encoding='utf-8') as descfile:\n descfile.write(info_dict['description'])\n except (OSError, IOError):\n self.report_error('Cannot write description file ' + descfn)\n return\n\n if self.params.get('writeannotations', False):\n annofn = filename + '.annotations.xml'\n if self.params.get('nooverwrites', False) and os.path.exists(encodeFilename(annofn)):\n self.to_screen('[info] Video annotations are already present')\n else:\n try:\n self.to_screen('[info] Writing video annotations to: ' + annofn)\n with io.open(encodeFilename(annofn), 'w', encoding='utf-8') as annofile:\n annofile.write(info_dict['annotations'])\n except (KeyError, TypeError):\n self.report_warning('There are no annotations to write.')\n except (OSError, IOError):\n self.report_error('Cannot write annotations file: ' + annofn)\n return\n\n subtitles_are_requested = any([self.params.get('writesubtitles', False),\n self.params.get('writeautomaticsub')])\n\n if subtitles_are_requested and 'subtitles' in info_dict and info_dict['subtitles']:\n # subtitles download errors are already managed as troubles in relevant IE\n # that way it will silently go on when used with unsupporting IE\n subtitles = info_dict['subtitles']\n sub_format = self.params.get('subtitlesformat', 'srt')\n for sub_lang in subtitles.keys():\n sub = subtitles[sub_lang]\n if sub is None:\n continue\n try:\n sub_filename = subtitles_filename(filename, sub_lang, sub_format)\n if self.params.get('nooverwrites', False) and os.path.exists(encodeFilename(sub_filename)):\n self.to_screen('[info] Video subtitle %s.%s is already_present' % (sub_lang, sub_format))\n else:\n self.to_screen('[info] Writing video subtitles to: ' + sub_filename)\n with io.open(encodeFilename(sub_filename), 'w', encoding='utf-8') as subfile:\n subfile.write(sub)\n except (OSError, IOError):\n self.report_error('Cannot write subtitles file ' + sub_filename)\n return\n\n if self.params.get('writeinfojson', False):\n infofn = os.path.splitext(filename)[0] + '.info.json'\n if self.params.get('nooverwrites', False) and os.path.exists(encodeFilename(infofn)):\n self.to_screen('[info] Video description metadata is already present')\n else:\n self.to_screen('[info] Writing video description metadata as JSON to: ' + infofn)\n try:\n write_json_file(info_dict, infofn)\n except (OSError, IOError):\n self.report_error('Cannot write metadata to JSON file ' + infofn)\n return\n\n if self.params.get('writethumbnail', False):\n if info_dict.get('thumbnail') is not None:\n thumb_format = determine_ext(info_dict['thumbnail'], 'jpg')\n thumb_filename = os.path.splitext(filename)[0] + '.' + thumb_format\n if self.params.get('nooverwrites', False) and os.path.exists(encodeFilename(thumb_filename)):\n self.to_screen('[%s] %s: Thumbnail is already present' %\n (info_dict['extractor'], info_dict['id']))\n else:\n self.to_screen('[%s] %s: Downloading thumbnail ...' %\n (info_dict['extractor'], info_dict['id']))\n try:\n uf = self.urlopen(info_dict['thumbnail'])\n with open(thumb_filename, 'wb') as thumbf:\n shutil.copyfileobj(uf, thumbf)\n self.to_screen('[%s] %s: Writing thumbnail to: %s' %\n (info_dict['extractor'], info_dict['id'], thumb_filename))\n except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:\n self.report_warning('Unable to download thumbnail \"%s\": %s' %\n (info_dict['thumbnail'], compat_str(err)))\n\n if not self.params.get('skip_download', False):\n try:\n def dl(name, info):\n fd = get_suitable_downloader(info)(self, self.params)\n for ph in self._progress_hooks:\n fd.add_progress_hook(ph)\n if self.params.get('verbose'):\n self.to_stdout('[debug] Invoking downloader on %r' % info.get('url'))\n return fd.download(name, info)\n if info_dict.get('requested_formats') is not None:\n downloaded = []\n success = True\n merger = FFmpegMergerPP(self, not self.params.get('keepvideo'))\n if not merger._executable:\n postprocessors = []\n self.report_warning('You have requested multiple '\n 'formats but ffmpeg or avconv are not installed.'\n ' The formats won\\'t be merged')\n else:\n postprocessors = [merger]\n for f in info_dict['requested_formats']:\n new_info = dict(info_dict)\n new_info.update(f)\n fname = self.prepare_filename(new_info)\n fname = prepend_extension(fname, 'f%s' % f['format_id'])\n downloaded.append(fname)\n partial_success = dl(fname, new_info)\n success = success and partial_success\n info_dict['__postprocessors'] = postprocessors\n info_dict['__files_to_merge'] = downloaded\n else:\n # Just a single file\n success = dl(filename, info_dict)\n except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:\n self.report_error('unable to download video data: %s' % str(err))\n return\n except (OSError, IOError) as err:\n raise UnavailableVideoError(err)\n except (ContentTooShortError, ) as err:\n self.report_error('content too short (expected %s bytes and served %s)' % (err.expected, err.downloaded))\n return\n\n if success:\n # Fixup content\n stretched_ratio = info_dict.get('stretched_ratio')\n if stretched_ratio is not None and stretched_ratio != 1:\n fixup_policy = self.params.get('fixup')\n if fixup_policy is None:\n fixup_policy = 'detect_or_warn'\n if fixup_policy == 'warn':\n self.report_warning('%s: Non-uniform pixel ratio (%s)' % (\n info_dict['id'], stretched_ratio))\n elif fixup_policy == 'detect_or_warn':\n stretched_pp = FFmpegFixupStretchedPP(self)\n if stretched_pp.available:\n info_dict.setdefault('__postprocessors', [])\n info_dict['__postprocessors'].append(stretched_pp)\n else:\n self.report_warning(\n '%s: Non-uniform pixel ratio (%s). Install ffmpeg or avconv to fix this automatically.' % (\n info_dict['id'], stretched_ratio))\n else:\n assert fixup_policy == 'ignore'\n\n try:\n self.post_process(filename, info_dict)\n except (PostProcessingError) as err:\n self.report_error('postprocessing: %s' % str(err))\n return\n self.record_download_archive(info_dict)", "metadata": "root.YoutubeDL.process_info", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 964 }, { "content": " def download(self, url_list):\n \"\"\"Download a given list of URLs.\"\"\"\n outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)\n if (len(url_list) > 1 and\n '%' not in outtmpl\n and self.params.get('max_downloads') != 1):\n raise SameFileError(outtmpl)\n\n for url in url_list:\n try:\n # It also downloads the videos\n res = self.extract_info(url)\n except UnavailableVideoError:\n self.report_error('unable to download video')\n except MaxDownloadsReached:\n self.to_screen('[info] Maximum number of downloaded files reached.')\n raise\n else:\n if self.params.get('dump_single_json', False):\n self.to_stdout(json.dumps(res))\n\n return self._download_retcode", "metadata": "root.YoutubeDL.download", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1193 }, { "content": " def download_with_info_file(self, info_filename):\n with io.open(info_filename, 'r', encoding='utf-8') as f:\n info = json.load(f)\n try:\n self.process_ie_result(info, download=True)\n except DownloadError:\n webpage_url = info.get('webpage_url')\n if webpage_url is not None:\n self.report_warning('The info failed to download, trying with \"%s\"' % webpage_url)\n return self.download([webpage_url])\n else:\n raise\n return self._download_retcode", "metadata": "root.YoutubeDL.download_with_info_file", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1216 }, { "content": " def post_process(self, filename, ie_info):\n \"\"\"Run all the postprocessors on the given file.\"\"\"\n info = dict(ie_info)\n info['filepath'] = filename\n pps_chain = []\n if ie_info.get('__postprocessors') is not None:\n pps_chain.extend(ie_info['__postprocessors'])\n pps_chain.extend(self._pps)\n for pp in pps_chain:\n keep_video = None\n old_filename = info['filepath']\n try:\n keep_video_wish, info = pp.run(info)\n if keep_video_wish is not None:\n if keep_video_wish:\n keep_video = keep_video_wish\n elif keep_video is None:\n # No clear decision yet, let IE decide\n keep_video = keep_video_wish\n except PostProcessingError as e:\n self.report_error(e.msg)\n if keep_video is False and not self.params.get('keepvideo', False):\n try:\n self.to_screen('Deleting original file %s (pass -k to keep)' % old_filename)\n os.remove(encodeFilename(old_filename))\n except (IOError, OSError):\n self.report_warning('Unable to remove downloaded video file')", "metadata": "root.YoutubeDL.post_process", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1230 }, { "content": " def _make_archive_id(self, info_dict):\n # Future-proof against any change in case\n # and backwards compatibility with prior versions\n extractor = info_dict.get('extractor_key')\n if extractor is None:\n if 'id' in info_dict:\n extractor = info_dict.get('ie_key') # key in a playlist\n if extractor is None:\n return None # Incomplete video information\n return extractor.lower() + ' ' + info_dict['id']", "metadata": "root.YoutubeDL._make_archive_id", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1258 }, { "content": " def in_download_archive(self, info_dict):\n fn = self.params.get('download_archive')\n if fn is None:\n return False\n\n vid_id = self._make_archive_id(info_dict)\n if vid_id is None:\n return False # Incomplete video information\n\n try:\n with locked_file(fn, 'r', encoding='utf-8') as archive_file:\n for line in archive_file:\n if line.strip() == vid_id:\n return True\n except IOError as ioe:\n if ioe.errno != errno.ENOENT:\n raise\n return False", "metadata": "root.YoutubeDL.in_download_archive", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1269 }, { "content": " def record_download_archive(self, info_dict):\n fn = self.params.get('download_archive')\n if fn is None:\n return\n vid_id = self._make_archive_id(info_dict)\n assert vid_id\n with locked_file(fn, 'a', encoding='utf-8') as archive_file:\n archive_file.write(vid_id + '\\n')", "metadata": "root.YoutubeDL.record_download_archive", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1288 }, { "content": " @staticmethod\n def format_resolution(format, default='unknown'):\n if format.get('vcodec') == 'none':\n return 'audio only'\n if format.get('resolution') is not None:\n return format['resolution']\n if format.get('height') is not None:\n if format.get('width') is not None:\n res = '%sx%s' % (format['width'], format['height'])\n else:\n res = '%sp' % format['height']\n elif format.get('width') is not None:\n res = '?x%d' % format['width']\n else:\n res = default\n return res", "metadata": "root.YoutubeDL.format_resolution", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1297 }, { "content": " def _format_note(self, fdict):\n res = ''\n if fdict.get('ext') in ['f4f', 'f4m']:\n res += '(unsupported) '\n if fdict.get('format_note') is not None:\n res += fdict['format_note'] + ' '\n if fdict.get('tbr') is not None:\n res += '%4dk ' % fdict['tbr']\n if fdict.get('container') is not None:\n if res:\n res += ', '\n res += '%s container' % fdict['container']\n if (fdict.get('vcodec') is not None and\n fdict.get('vcodec') != 'none'):\n if res:\n res += ', '\n res += fdict['vcodec']\n if fdict.get('vbr') is not None:\n res += '@'\n elif fdict.get('vbr') is not None and fdict.get('abr') is not None:\n res += 'video@'\n if fdict.get('vbr') is not None:\n res += '%4dk' % fdict['vbr']\n if fdict.get('fps') is not None:\n res += ', %sfps' % fdict['fps']\n if fdict.get('acodec') is not None:\n if res:\n res += ', '\n if fdict['acodec'] == 'none':\n res += 'video only'\n else:\n res += '%-5s' % fdict['acodec']\n elif fdict.get('abr') is not None:\n if res:\n res += ', '\n res += 'audio'\n if fdict.get('abr') is not None:\n res += '@%3dk' % fdict['abr']\n if fdict.get('asr') is not None:\n res += ' (%5dHz)' % fdict['asr']\n if fdict.get('filesize') is not None:\n if res:\n res += ', '\n res += format_bytes(fdict['filesize'])\n elif fdict.get('filesize_approx') is not None:\n if res:\n res += ', '\n res += '~' + format_bytes(fdict['filesize_approx'])\n return res", "metadata": "root.YoutubeDL._format_note", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1314 }, { "content": " def list_formats(self, info_dict):\n def line(format, idlen=20):\n return (('%-' + compat_str(idlen + 1) + 's%-10s%-12s%s') % (\n format['format_id'],\n format['ext'],\n self.format_resolution(format),\n self._format_note(format),\n ))\n\n formats = info_dict.get('formats', [info_dict])\n idlen = max(len('format code'),\n max(len(f['format_id']) for f in formats))\n formats_s = [\n line(f, idlen) for f in formats\n if f.get('preference') is None or f['preference'] >= -1000]\n if len(formats) > 1:\n formats_s[0] += (' ' if self._format_note(formats[0]) else '') + '(worst)'\n formats_s[-1] += (' ' if self._format_note(formats[-1]) else '') + '(best)'\n\n header_line = line({\n 'format_id': 'format code', 'ext': 'extension',\n 'resolution': 'resolution', 'format_note': 'note'}, idlen=idlen)\n self.to_screen('[info] Available formats for %s:\\n%s\\n%s' %\n (info_dict['id'], header_line, '\\n'.join(formats_s)))", "metadata": "root.YoutubeDL.list_formats", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1364 }, { "content": " def urlopen(self, req):\n \"\"\" Start an HTTP download \"\"\"\n\n # According to RFC 3986, URLs can not contain non-ASCII characters, however this is not\n # always respected by websites, some tend to give out URLs with non percent-encoded\n # non-ASCII characters (see telemb.py, ard.py [#3412])\n # urllib chokes on URLs with non-ASCII characters (see http://bugs.python.org/issue3991)\n # To work around aforementioned issue we will replace request's original URL with\n # percent-encoded one\n req_is_string = isinstance(req, basestring if sys.version_info < (3, 0) else compat_str)\n url = req if req_is_string else req.get_full_url()\n url_escaped = escape_url(url)\n\n # Substitute URL if any change after escaping\n if url != url_escaped:\n if req_is_string:\n req = url_escaped\n else:\n req = compat_urllib_request.Request(\n url_escaped, data=req.data, headers=req.headers,\n origin_req_host=req.origin_req_host, unverifiable=req.unverifiable)\n\n return self._opener.open(req, timeout=self._socket_timeout)", "metadata": "root.YoutubeDL.urlopen", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1389 }, { "content": " def print_debug_header(self):\n if not self.params.get('verbose'):\n return\n\n if type('') is not compat_str:\n # Python 2.6 on SLES11 SP1 (https://github.com/rg3/youtube-dl/issues/3326)\n self.report_warning(\n 'Your Python is broken! Update to a newer and supported version')\n\n stdout_encoding = getattr(\n sys.stdout, 'encoding', 'missing (%s)' % type(sys.stdout).__name__)\n encoding_str = (\n '[debug] Encodings: locale %s, fs %s, out %s, pref %s\\n' % (\n locale.getpreferredencoding(),\n sys.getfilesystemencoding(),\n stdout_encoding,\n self.get_encoding()))\n write_string(encoding_str, encoding=None)\n\n self._write_string('[debug] youtube-dl version ' + __version__ + '\\n')\n try:\n sp = subprocess.Popen(\n ['git', 'rev-parse', '--short', 'HEAD'],\n stdout=subprocess.PIPE, stderr=subprocess.PIPE,\n cwd=os.path.dirname(os.path.abspath(__file__)))\n out, err = sp.communicate()\n out = out.decode().strip()\n if re.match('[0-9a-f]+', out):\n self._write_string('[debug] Git HEAD: ' + out + '\\n')\n except:\n try:\n sys.exc_clear()\n except:\n pass\n self._write_string('[debug] Python version %s - %s\\n' % (\n platform.python_version(), platform_name()))\n\n exe_versions = FFmpegPostProcessor.get_versions()\n exe_versions['rtmpdump'] = rtmpdump_version()\n exe_str = ', '.join(\n '%s %s' % (exe, v)\n for exe, v in sorted(exe_versions.items())\n if v\n )\n if not exe_str:\n exe_str = 'none'\n self._write_string('[debug] exe versions: %s\\n' % exe_str)\n\n proxy_map = {}\n for handler in self._opener.handlers:\n if hasattr(handler, 'proxies'):\n proxy_map.update(handler.proxies)\n self._write_string('[debug] Proxy map: ' + compat_str(proxy_map) + '\\n')\n\n if self.params.get('call_home', False):\n ipaddr = self.urlopen('https://yt-dl.org/ip').read().decode('utf-8')\n self._write_string('[debug] Public IP address: %s\\n' % ipaddr)\n latest_version = self.urlopen(\n 'https://yt-dl.org/latest/version').read().decode('utf-8')\n if version_tuple(latest_version) > version_tuple(__version__):\n self.report_warning(\n 'You are using an outdated version (newest version: %s)! '\n 'See https://yt-dl.org/update if you need help updating.' %\n latest_version)", "metadata": "root.YoutubeDL.print_debug_header", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1413 }, { "content": " def _setup_opener(self):\n timeout_val = self.params.get('socket_timeout')\n self._socket_timeout = 600 if timeout_val is None else float(timeout_val)\n\n opts_cookiefile = self.params.get('cookiefile')\n opts_proxy = self.params.get('proxy')\n\n if opts_cookiefile is None:\n self.cookiejar = compat_cookiejar.CookieJar()\n else:\n self.cookiejar = compat_cookiejar.MozillaCookieJar(\n opts_cookiefile)\n if os.access(opts_cookiefile, os.R_OK):\n self.cookiejar.load()\n\n cookie_processor = compat_urllib_request.HTTPCookieProcessor(\n self.cookiejar)\n if opts_proxy is not None:\n if opts_proxy == '':\n proxies = {}\n else:\n proxies = {'http': opts_proxy, 'https': opts_proxy}\n else:\n proxies = compat_urllib_request.getproxies()\n # Set HTTPS proxy to HTTP one if given (https://github.com/rg3/youtube-dl/issues/805)\n if 'http' in proxies and 'https' not in proxies:\n proxies['https'] = proxies['http']\n proxy_handler = compat_urllib_request.ProxyHandler(proxies)\n\n debuglevel = 1 if self.params.get('debug_printtraffic') else 0\n https_handler = make_HTTPS_handler(self.params, debuglevel=debuglevel)\n ydlh = YoutubeDLHandler(self.params, debuglevel=debuglevel)\n opener = compat_urllib_request.build_opener(\n https_handler, proxy_handler, cookie_processor, ydlh)\n # Delete the default user-agent header, which would otherwise apply in\n # cases where our custom HTTP handler doesn't come into play\n # (See https://github.com/rg3/youtube-dl/issues/1309 for details)\n opener.addheaders = []\n self._opener = opener", "metadata": "root.YoutubeDL._setup_opener", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1478 }, { "content": " def encode(self, s):\n if isinstance(s, bytes):\n return s # Already encoded\n\n try:\n return s.encode(self.get_encoding())\n except UnicodeEncodeError as err:\n err.reason = err.reason + '. Check your system encoding configuration or use the --encoding option.'\n raise", "metadata": "root.YoutubeDL.encode", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1518 }, { "content": " def get_encoding(self):\n encoding = self.params.get('encoding')\n if encoding is None:\n encoding = preferredencoding()\n return encoding", "metadata": "root.YoutubeDL.get_encoding", "header": "['class', 'YoutubeDL', '(', 'object', ')', ':', '___EOS___']", "index": 1528 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "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_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "locale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "name_", "==_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "ctypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "._", "compat_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "compa", "t", "\\u", "cookie", "jar_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compa", "t", "\\u", "expanduser_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compa", "t", "\\u", "http", "\\u", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compa", "t", "\\u", "kwargs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compa", "t", "\\u", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compa", "t", "\\u", "url", "lib", "\\u", "error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compa", "t", "\\u", "url", "lib", "\\u", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "escape", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Conten", "t", "Too", "Short", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "date", "\\u", "from", "\\u", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Date", "Range_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "OUT", "TMP", "L_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dete", "rmin", "e\\u", "ext_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Down", "load", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "encode", "Filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Extract", "or", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format\\u", "bytes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format", "Seconds_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "term", "\\u", "width_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lock", "ed", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "make", "\\u", "HTTP", "S", "\\u", "handler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Max", "Down", "load", "s", "Reach", "ed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Page", "d", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Post", "Process", "ing", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "platform", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefer", "rede", "nco", "ding_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sam", "e", "File", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sanitize", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subtit", "les", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "take", "whi", "le", "\\u", "inclu", "sive", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Una", "vail", "able", "Vid", "eo", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url", "\\u", "basename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version", "\\u", "tuple_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "json", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "write", "\\u", "string_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "You", "tube", "DL", "Handler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prepend", "\\u", "extension_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args", "\\u", "to", "\\u", "str_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "age", "\\u", "restricted_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "cache_", "import_", "Cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "extractor_", "import_", "get", "\\u", "info", "\\u", "extractor_", ",_", "gen", "\\u", "extractors", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "downloader_", "import_", "get", "\\u", "suit", "able", "\\u", "downloader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "downloader_", "._", "rtmp", "_", "import_", "rtmp", "dump", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "postprocess", "or_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "FF", "mpeg", "Fix", "up", "Stre", "tche", "d", "PP", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "FF", "mpeg", "Merge", "r", "PP", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "FF", "mpeg", "Post", "Processor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "postprocess", "or_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "version_", "import_", "\\u\\u", "version\\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_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "You", "tube", "DL", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", "tube", "DL", " ", "object", "s", " ", "are", " ", "the", " ", "ones", " ", "responsib", "le", " ", "of", " ", "download", "ing", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "actual", " ", "video", " ", "file", " ", "and", " ", "writ", "ing", " ", "it", " ", "to", " ", "disk", " ", "if", " ", "the", " ", "user", " ", "has", " ", "request", "ed", "\\", "10", ";", " ", " ", " ", " ", "it", ",", " ", "amo", "ng", " ", "some", " ", "other", " ", "task", "s", ".", " ", "In", " ", "most", " ", "case", "s", " ", "there", " ", "shou", "ld", " ", "be", " ", "one", " ", "per", "\\", "10", ";", " ", " ", " ", " ", "program", ".", " ", "As", ",", " ", "give", "n", " ", "a", " ", "video", " ", "URL", ",", " ", "the", " ", "downloader", " ", "doe", "sn", "'", "t", " ", "know", " ", "how", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "extract", " ", "all", " ", "the", " ", "need", "ed", " ", "informati", "on", ",", " ", "task", " ", "tha", "t", " ", "Info", "Extract", "ors", " ", "do", ",", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "to", " ", "pass", " ", "the", " ", "URL", " ", "to", " ", "one", " ", "of", " ", "them", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "this", ",", " ", "You", "tube", "DL", " ", "object", "s", " ", "have", " ", "a", " ", "method", " ", "tha", "t", " ", "allow", "s", "\\", "10", ";", " ", " ", " ", " ", "Info", "Extract", "ors", " ", "to", " ", "be", " ", "register", "ed", " ", "in", " ", "a", " ", "give", "n", " ", "order", ".", " ", "Whe", "n", " ", "it", " ", "is", " ", "pass", "ed", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "URL", ",", " ", "the", " ", "You", "tube", "DL", " ", "object", " ", "handle", "s", " ", "it", " ", "to", " ", "the", " ", "first", " ", "Info", "Extract", "or", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "find", "s", " ", "tha", "t", " ", "report", "s", " ", "bei", "ng", " ", "able", " ", "to", " ", "handle", " ", "it", ".", " ", "The", " ", "Info", "Extract", "or", " ", "extracts", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "the", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "video", " ", "or", " ", "videos", " ", "the", " ", "URL", " ", "refer", "s", " ", "to", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "You", "tube", "DL", " ", "process", " ", "the", " ", "extracted", " ", "informati", "on", ",", " ", "possib", "ly", " ", "usi", "ng", " ", "a", " ", "File", "\\", "10", ";", " ", " ", " ", " ", "Downloade", "r", " ", "to", " ", "download", " ", "the", " ", "video", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", "tube", "DL", " ", "object", "s", " ", "accept", " ", "a", " ", "lot", " ", "of", " ", "parameter", "s", ".", " ", "In", " ", "order", " ", "not", " ", "to", " ", "satur", "ate", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "object", " ", "construct", "or", " ", "with", " ", "argu", "ment", "s", ",", " ", "it", " ", "receive", "s", " ", "a", " ", "dictionar", "y", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "options", " ", "inst", "ead", ".", " ", "The", "se", " ", "options", " ", "are", " ", "avail", "able", " ", "through", " ", "the", " ", "params", "\\", "10", ";", " ", " ", " ", " ", "attribute", " ", "for", " ", "the", " ", "Info", "Extract", "ors", " ", "to", " ", "use", ".", " ", "The", " ", "You", "tube", "DL", " ", "als", "o", "\\", "10", ";", " ", " ", " ", " ", "register", "s", " ", "its", "elf", " ", "as", " ", "the", " ", "downloader", " ", "in", " ", "charge", " ", "for", " ", "the", " ", "Info", "Extract", "ors", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "are", " ", "adde", "d", " ", "to", " ", "it", ",", " ", "so", " ", "this", " ", "is", " ", "a", " ", "\"", "mutual", " ", "registration", "\".\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Avail", "able", " ", "options", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", " ", " ", "User", "name", " ", "for", " ", "authenticat", "ion", " ", "purpose", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "password", ":", " ", " ", "Passw", "ord", " ", "for", " ", "authenticat", "ion", " ", "purpose", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "video", "password", ":", " ", "Passw", "ord", " ", "for", " ", "acc", "es", " ", "a", " ", "video", ".", "\\", "10", ";", " ", " ", " ", " ", "use", "net", "rc", ":", " ", " ", "Us", "e", " ", "net", "rc", " ", "for", " ", "authenticat", "ion", " ", "inst", "ead", ".", "\\", "10", ";", " ", " ", " ", " ", "verbo", "se", ":", " ", " ", " ", "Print", " ", "addition", "al", " ", "info", " ", "to", " ", "stdout", ".", "\\", "10", ";", " ", " ", " ", " ", "quie", "t", ":", " ", " ", " ", " ", " ", "Do", " ", "not", " ", "print", " ", "message", "s", " ", "to", " ", "stdout", ".", "\\", "10", ";", " ", " ", " ", " ", "no", "\\u", "warn", "ings", ":", " ", " ", " ", "Do", " ", "not", " ", "print", " ", "out", " ", "anyt", "hing", " ", "for", " ", "warn", "ings", ".", "\\", "10", ";", " ", " ", " ", " ", "force", "url", ":", " ", " ", "Force", " ", "printin", "g", " ", "final", " ", "URL", ".", "\\", "10", ";", " ", " ", " ", " ", "force", "title", ":", " ", " ", " ", " ", "Force", " ", "printin", "g", " ", "title", ".", "\\", "10", ";", " ", " ", " ", " ", "force", "id", ":", " ", " ", " ", "Force", " ", "printin", "g", " ", "ID", ".", "\\", "10", ";", " ", " ", " ", " ", "force", "thumbnail", ":", " ", " ", " ", " ", "Force", " ", "printin", "g", " ", "thumbnail", " ", "URL", ".", "\\", "10", ";", " ", " ", " ", " ", "forced", "escri", "ption", ":", " ", " ", "Force", " ", "printin", "g", " ", "description", ".", "\\", "10", ";", " ", " ", " ", " ", "force", "filename", ":", " ", "Force", " ", "printin", "g", " ", "final", " ", "filename", ".", "\\", "10", ";", " ", " ", " ", " ", "forced", "ura", "tion", ":", " ", "Force", " ", "printin", "g", " ", "duration", ".", "\\", "10", ";", " ", " ", " ", " ", "force", "json", ":", " ", " ", " ", " ", " ", "Force", " ", "printin", "g", " ", "info", "\\u", "dict", " ", "as", " ", "JSO", "N", ".", "\\", "10", ";", " ", " ", " ", " ", "dump", "\\u", "single", "\\u", "json", ":", " ", " ", "Force", " ", "printin", "g", " ", "the", " ", "info", "\\u", "dict", " ", "of", " ", "the", " ", "whole", " ", "playl", "ist", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "or", " ", "video", ")", " ", "as", " ", "a", " ", "single", " ", "JSO", "N", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "simulat", "e", ":", " ", " ", "Do", " ", "not", " ", "download", " ", "the", " ", "video", " ", "files", ".", "\\", "10", ";", " ", " ", " ", " ", "format", ":", " ", " ", " ", " ", "Vid", "eo", " ", "format", " ", "code", ".", " ", "See", " ", "options", ".", "py", " ", "for", " ", "more", " ", "informati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "format\\u", "limit", ":", " ", " ", "Highe", "st", " ", "quali", "ty", " ", "format", " ", "to", " ", "try", ".", "\\", "10", ";", " ", " ", " ", " ", "outt", "mpl", ":", " ", " ", " ", "Templa", "te", " ", "for", " ", "output", " ", "names", ".", "\\", "10", ";", " ", " ", " ", " ", "restrict", "filename", "s", ":", " ", "Do", " ", "not", " ", "allow", " ", "\"&", "\"", " ", "and", " ", "space", "s", " ", "in", " ", "file", " ", "names", "\\", "10", ";", " ", " ", " ", " ", "ignore", "error", "s", ":", " ", " ", "Do", " ", "not", " ", "stop", " ", "on", " ", "download", " ", "error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "noo", "ver", "writes", ":", " ", " ", "Prev", "ent", " ", "overwrit", "ing", " ", "files", ".", "\\", "10", ";", " ", " ", " ", " ", "playl", "ists", "tart", ":", " ", "Play", "list", " ", "item", " ", "to", " ", "start", " ", "at", ".", "\\", "10", ";", " ", " ", " ", " ", "playl", "iste", "nd", ":", " ", " ", " ", "Play", "list", " ", "item", " ", "to", " ", "end", " ", "at", ".", "\\", "10", ";", " ", " ", " ", " ", "playl", "istr", "ever", "se", ":", " ", " ", " ", "Down", "load", " ", "playl", "ist", " ", "items", " ", "in", " ", "reverse", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "match", "title", ":", " ", " ", " ", " ", "Down", "load", " ", "only", " ", "matchi", "ng", " ", "titles", ".", "\\", "10", ";", " ", " ", " ", " ", "reject", "title", ":", " ", " ", " ", "Reject", " ", "download", "s", " ", "for", " ", "matchi", "ng", " ", "titles", ".", "\\", "10", ";", " ", " ", " ", " ", "logg", "er", ":", " ", " ", " ", " ", "Log", " ", "message", "s", " ", "to", " ", "a", " ", "logg", "ing", ".", "Log", "ger", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "logt", "ost", "der", "r", ":", " ", " ", " ", "Log", " ", "message", "s", " ", "to", " ", "std", "err", " ", "inst", "ead", " ", "of", " ", "stdout", ".", "\\", "10", ";", " ", " ", " ", " ", "write", "description", ":", " ", " ", "Write", " ", "the", " ", "video", " ", "description", " ", "to", " ", "a", " ", ".", "description", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "write", "info", "json", ":", " ", "Write", " ", "the", " ", "video", " ", "description", " ", "to", " ", "a", " ", ".", "info", ".", "json", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "writea", "nno", "tation", "s", ":", " ", " ", "Write", " ", "the", " ", "video", " ", "annot", "ation", "s", " ", "to", " ", "a", " ", ".", "annot", "ation", "s", ".", "xml", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "writet", "hum", "bn", "ail", ":", " ", " ", " ", " ", "Write", " ", "the", " ", "thumbnail", " ", "image", " ", "to", " ", "a", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "writes", "ub", "titles", ":", " ", " ", " ", " ", "Write", " ", "the", " ", "video", " ", "subtit", "les", " ", "to", " ", "a", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "writea", "uto", "matics", "ub", ":", " ", "Write", " ", "the", " ", "automati", "c", " ", "subtit", "les", " ", "to", " ", "a", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "alls", "ub", "titles", ":", " ", " ", "Down", "load", "s", " ", "all", " ", "the", " ", "subtit", "les", " ", "of", " ", "the", " ", "video", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "require", "s", " ", "writes", "ub", "titles", " ", "or", " ", "writea", "uto", "matics", "ub", ")", "\\", "10", ";", " ", " ", " ", " ", "lists", "ub", "titles", ":", " ", "List", "s", " ", "all", " ", "avail", "able", " ", "subtit", "les", " ", "for", " ", "the", " ", "video", "\\", "10", ";", " ", " ", " ", " ", "subtit", "les", "format", ":", " ", " ", " ", "Subtitle", " ", "format", " ", "[", "srt", "/", "sb", "v", "/", "vt", "t", "]", " ", "(", "default", "=", "srt", ")", "\\", "10", ";", " ", " ", " ", " ", "subtit", "les", "lang", "s", ":", " ", " ", " ", " ", "List", " ", "of", " ", "language", "s", " ", "of", " ", "the", " ", "subtit", "les", " ", "to", " ", "download", "\\", "10", ";", " ", " ", " ", " ", "keep", "video", ":", " ", " ", " ", " ", " ", "Keep", " ", "the", " ", "video", " ", "file", " ", "after", " ", "post", "-", "process", "ing", "\\", "10", ";", " ", " ", " ", " ", "date", "range", ":", " ", " ", " ", " ", " ", "A", " ", "Date", "Range", " ", "object", ",", " ", "download", " ", "only", " ", "if", " ", "the", " ", "upload", "\\u", "date", " ", "is", " ", "in", " ", "the", " ", "range", ".", "\\", "10", ";", " ", " ", " ", " ", "skip", "\\u", "download", ":", " ", "Ski", "p", " ", "the", " ", "actual", " ", "download", " ", "of", " ", "the", " ", "video", " ", "file", "\\", "10", ";", " ", " ", " ", " ", "cachedir", ":", " ", " ", "Locat", "ion", " ", "of", " ", "the", " ", "cache", " ", "files", " ", "in", " ", "the", " ", "filesystem", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "Fal", "se", " ", "to", " ", "disable", " ", "filesystem", " ", "cache", ".", "\\", "10", ";", " ", " ", " ", " ", "nop", "lay", "list", ":", " ", " ", " ", " ", "Down", "load", " ", "single", " ", "video", " ", "inst", "ead", " ", "of", " ", "a", " ", "playl", "ist", " ", "if", " ", "in", " ", "dou", "bt", ".", "\\", "10", ";", " ", " ", " ", " ", "age", "\\u", "limit", ":", " ", " ", " ", " ", " ", "An", " ", "integ", "er", " ", "represent", "ing", " ", "the", " ", "user", "'", "s", " ", "age", " ", "in", " ", "year", "s", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "Unsu", "itab", "le", " ", "videos", " ", "for", " ", "the", " ", "give", "n", " ", "age", " ", "are", " ", "skip", "ped", ".", "\\", "10", ";", " ", " ", " ", " ", "min", "\\u", "views", ":", " ", " ", " ", " ", " ", "An", " ", "integ", "er", " ", "represent", "ing", " ", "the", " ", "minim", "um", " ", "view", " ", "count", " ", "the", " ", "video", "\\", "10", ";", " ", " ", " ", " ", " ", "must", " ", "have", " ", "in", " ", "order", " ", "to", " ", "not", " ", "be", " ", "skip", "ped", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "Videos", " ", "with", "out", " ", "view", " ", "count", " ", "informati", "on", " ", "are", " ", "alw", "ay", "s", "\\", "10", ";", " ", " ", " ", " ", " ", "download", "ed", ".", " ", "Non", "e", " ", "for", " ", "no", " ", "limit", ".", "\\", "10", ";", " ", " ", " ", " ", "max", "\\u", "views", ":", " ", " ", " ", " ", " ", "An", " ", "integ", "er", " ", "represent", "ing", " ", "the", " ", "maxim", "um", " ", "view", " ", "count", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "Videos", " ", "tha", "t", " ", "are", " ", "more", " ", "popular", " ", "than", " ", "tha", "t", " ", "are", " ", "not", "\\", "10", ";", " ", " ", " ", " ", " ", "download", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "Videos", " ", "with", "out", " ", "view", " ", "count", " ", "informati", "on", " ", "are", " ", "alw", "ay", "s", "\\", "10", ";", " ", " ", " ", " ", " ", "download", "ed", ".", " ", "Non", "e", " ", "for", " ", "no", " ", "limit", ".", "\\", "10", ";", " ", " ", " ", " ", "download", "\\u", "archive", ":", " ", " ", "File", " ", "name", " ", "of", " ", "a", " ", "file", " ", "where", " ", "all", " ", "download", "s", " ", "are", " ", "recorde", "d", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "Videos", " ", "alr", "ead", "y", " ", "presen", "t", " ", "in", " ", "the", " ", "file", " ", "are", " ", "not", " ", "download", "ed", "\\", "10", ";", " ", " ", " ", " ", " ", "again", ".", "\\", "10", ";", " ", " ", " ", " ", "cookie", "file", ":", " ", " ", " ", " ", "File", " ", "name", " ", "where", " ", "cookie", "s", " ", "shou", "ld", " ", "be", " ", "read", " ", "from", " ", "and", " ", "dumped", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "noc", "heck", "certifica", "te", ":", "Do", " ", "not", " ", "verify", " ", "SS", "L", " ", "certificates", "\\", "10", ";", " ", " ", " ", " ", "prefer", "\\u", "insecure", ":", " ", " ", " ", "Us", "e", " ", "HTTP", " ", "inst", "ead", " ", "of", " ", "HTTP", "S", " ", "to", " ", "retrieve", " ", "informati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "At", " ", "the", " ", "moment", ",", " ", "this", " ", "is", " ", "only", " ", "support", "ed", " ", "by", " ", "You", "Tu", "be", ".", "\\", "10", ";", " ", " ", " ", " ", "proxy", ":", " ", " ", " ", " ", " ", "URL", " ", "of", " ", "the", " ", "proxy", " ", "server", " ", "to", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "socket", "\\u", "timeo", "ut", ":", " ", " ", " ", " ", "Time", " ", "to", " ", "wait", " ", "for", " ", "unres", "pon", "sive", " ", "host", "s", ",", " ", "in", " ", "second", "s", "\\", "10", ";", " ", " ", " ", " ", "bid", "i", "\\u", "workar", "ound", ":", " ", " ", " ", "Work", " ", "aro", "und", " ", "bug", "gy", " ", "terminals", " ", "with", "out", " ", "bidirect", "ional", " ", "text", "\\", "10", ";", " ", " ", " ", " ", " ", "support", ",", " ", "usi", "ng", " ", "fri", "di", "bi", "\\", "10", ";", " ", " ", " ", " ", "debug", "\\u", "print", "traffic", ":", "Print", " ", "out", " ", "sent", " ", "and", " ", "receive", "d", " ", "HTTP", " ", "traffic", "\\", "10", ";", " ", " ", " ", " ", "include", "\\u", "ads", ":", " ", " ", " ", "Down", "load", " ", "ads", " ", "as", " ", "well", "\\", "10", ";", " ", " ", " ", " ", "default", "\\u", "search", ":", " ", " ", " ", " ", "Prep", "end", " ", "this", " ", "string", " ", "if", " ", "an", " ", "input", " ", "url", " ", "is", " ", "not", " ", "valid", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "'", "auto", "'", " ", "for", " ", "ela", "bora", "te", " ", "guess", "ing", "\\", "10", ";", " ", " ", " ", " ", "encoding", ":", " ", " ", "Us", "e", " ", "this", " ", "encoding", " ", "inst", "ead", " ", "of", " ", "the", " ", "system", "-", "specified", ".", "\\", "10", ";", " ", " ", " ", " ", "extract", "\\u", "flat", ":", " ", " ", "Do", " ", "not", " ", "resolve", " ", "URL", "s", ",", " ", "return", " ", "the", " ", "immediate", " ", "result", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "Pass", " ", "in", " ", "'", "in", "\\u", "playl", "ist", "'", " ", "to", " ", "only", " ", "show", " ", "this", " ", "behavior", " ", "for", "\\", "10", ";", " ", " ", " ", " ", " ", "playl", "ist", " ", "items", ".", "\\", "10", ";", " ", " ", " ", " ", "postprocess", "ors", ":", " ", " ", " ", " ", "A", " ", "list", " ", "of", " ", "dictionar", "ies", ",", " ", "each", " ", "with", " ", "an", " ", "entry", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "key", ":", " ", " ", "The", " ", "name", " ", "of", " ", "the", " ", "postprocess", "or", ".", " ", "See", "\\", "10", ";", " ", " ", " ", " ", " ", "youtu", "be", "\\u", "dl", "/", "postprocess", "or", "/\\u", "\\u", "init", "\\u\\u", ".", "py", " ", "for", " ", "a", " ", "list", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "as", " ", "well", " ", "as", " ", "any", " ", "fur", "ther", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", "postprocess", "or", ".", "\\", "10", ";", " ", " ", " ", " ", "progress", "\\u", "hook", "s", ":", " ", " ", " ", " ", "A", " ", "list", " ", "of", " ", "function", "s", " ", "tha", "t", " ", "get", " ", "call", "ed", " ", "on", " ", "download", "\\", "10", ";", " ", " ", " ", " ", " ", "progress", ",", " ", "with", " ", "a", " ", "dictionar", "y", " ", "with", " ", "the", " ", "entri", "es", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "filename", ":", " ", "The", " ", "final", " ", "filename", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "status", ":", " ", "One", " ", "of", " ", "\"", "download", "ing", "\"", " ", "and", " ", "\"", "finish", "ed", "\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "The", " ", "dict", " ", "may", " ", "als", "o", " ", "have", " ", "some", " ", "of", " ", "the", " ", "follow", "ing", " ", "entri", "es", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "downloaded\\u", "bytes", ":", " ", "Byte", "s", " ", "on", " ", "disk", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "total", "\\u", "bytes", ":", " ", "Size", " ", "of", " ", "the", " ", "whole", " ", "file", ",", " ", "Non", "e", " ", "if", " ", "unknown", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "tmpfile", "name", ":", " ", "The", " ", "filename", " ", "we", "'", "re", " ", "currentl", "y", " ", "writ", "ing", " ", "to", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "eta", ":", " ", "The", " ", "estimate", "d", " ", "time", " ", "in", " ", "second", "s", ",", " ", "Non", "e", " ", "if", " ", "unknown", "\\", "10", ";", " ", " ", " ", " ", " ", "*", " ", "speed", ":", " ", "The", " ", "download", " ", "speed", " ", "in", " ", "bytes", "/", "second", ",", " ", "Non", "e", " ", "if", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "unknown", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", " ", "Progres", "s", " ", "hook", "s", " ", "are", " ", "guaran", "tee", "d", " ", "to", " ", "be", " ", "call", "ed", " ", "at", " ", "leas", "t", " ", "onc", "e", "\\", "10", ";", " ", " ", " ", " ", " ", "(", "with", " ", "status", " ", "\"", "finish", "ed", "\")", " ", "if", " ", "the", " ", "download", " ", "is", " ", "success", "ful", ".", "\\", "10", ";", " ", " ", " ", " ", "merge", "\\u", "output", "\\u", "format", ":", " ", "Ext", "ensi", "on", " ", "to", " ", "use", " ", "whe", "n", " ", "mer", "ging", " ", "formats", ".", "\\", "10", ";", " ", " ", " ", " ", "fixup", ":", " ", " ", " ", " ", " ", "Automat", "ical", "ly", " ", "correct", " ", "know", "n", " ", "faults", " ", "of", " ", "the", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "One", " ", "of", ":", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "\"", "neve", "r", "\":", " ", "do", " ", "not", "hing", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "\"", "warn", "\":", " ", "only", " ", "emit", " ", "a", " ", "warn", "ing", "\\", "10", ";", " ", " ", " ", " ", " ", "-", " ", "\"", "detect", "\\u", "or", "\\u", "warn", "\":", " ", "check", " ", "whe", "ther", " ", "we", " ", "can", " ", "do", " ", "anyt", "hing", "\\", "10", ";", " ", " ", " ", "abo", "ut", " ", "it", ",", " ", "warn", " ", "other", "wis", "e", "\\", "10", ";", " ", " ", " ", " ", "source", "\\u", "address", ":", " ", " ", " ", " ", "(", "Experiment", "al", ")", " ", "Client", "-", "side", " ", "IP", " ", "address", " ", "to", " ", "bind", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "call", "\\u", "home", ":", " ", " ", " ", " ", " ", "Boo", "lean", ",", " ", "true", " ", "iff", " ", "we", " ", "are", " ", "allow", "ed", " ", "to", " ", "contact", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", "youtu", "be", "-", "dl", " ", "server", "s", " ", "for", " ", "debugg", "ing", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "follow", "ing", " ", "parameter", "s", " ", "are", " ", "not", " ", "used", " ", "by", " ", "You", "tube", "DL", " ", "its", "elf", ",", " ", "the", "y", " ", "are", " ", "used", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "File", "Downloade", "r", ":", "\\", "10", ";", " ", " ", " ", " ", "nop", "art", ",", " ", "update", "time", ",", " ", "buffer", "size", ",", " ", "ratel", "imit", ",", " ", "min", "\\u", "files", "ize", ",", " ", "max", "\\u", "files", "ize", ",", " ", "test", ",", "\\", "10", ";", " ", " ", " ", " ", "nore", "size", "buffer", ",", " ", "retrie", "s", ",", " ", "continue", "dl", ",", " ", "nop", "rogr", "ess", ",", " ", "console", "title", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "follow", "ing", " ", "options", " ", "are", " ", "used", " ", "by", " ", "the", " ", "post", " ", "process", "ors", ":", "\\", "10", ";", " ", " ", " ", " ", "prefer", "\\u", "ffmpeg", ":", " ", "If", " ", "Tru", "e", ",", " ", "use", " ", "ffmpeg", " ", "inst", "ead", " ", "of", " ", "avc", "onv", " ", "if", " ", "bot", "h", " ", "are", " ", "avail", "able", ",", "\\", "10", ";", " ", " ", " ", " ", " ", "other", "wis", "e", " ", "prefer", " ", "avc", "onv", ".", "\\", "10", ";", " ", " ", " ", " ", "exec", "\\u", "cmd", ":", " ", " ", "Arbit", "rar", "y", " ", "command", " ", "to", " ", "run", " ", "after", " ", "download", "ing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ies_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "pps", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "download", "\\u", "retcode_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "num", "\\u", "downloads_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "screen", "\\u", "file_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u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", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "params_", "=_", "None_", ",_", "auto", "\\u", "init_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "File", "Downloade", "r", " ", "object", " ", "with", " ", "the", " ", "give", "n", " ", "options", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "params_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "ies_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ies", "\\u", "instances_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pps", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "progress", "\\u", "hooks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "download", "\\u", "retcode_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "num", "\\u", "downloads_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "screen", "\\u", "file_", "=_", "[_", "sys_", "._", "stdout_", ",_", "sys_", "._", "stderr_", "]_", "[_", "params_", "._", "get_", "(_", "'", "logt", "ost", "der", "r", "'_", ",_", "False_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "err", "\\u", "file_", "=_", "sys_", "._", "stderr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache_", "=_", "Cache_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "params_", "._", "get_", "(_", "'", "bid", "i", "\\u", "workar", "ound", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pty", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "master_", ",_", "slave_", "=_", "pty", "_", "._", "openp", "ty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "get", "\\u", "term", "\\u", "width_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "width_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "widt", "h", "\\u", "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 ", " ", "_", "widt", "h", "\\u", "args_", "=_", "[_", "'-", "w", "'_", ",_", "str_", "(_", "width_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sp", "\\u", "kwargs_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "slave_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "self_", "._", "\\u", "err", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "output", "\\u", "process_", "=_", "subprocess_", "._", "Popen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "bid", "iv", "'_", "]_", "+_", "widt", "h", "\\u", "args_", ",_", "**_", "sp", "\\u", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "output", "\\u", "process_", "=_", "subprocess_", "._", "Popen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "fri", "bid", "i", "'_", ",_", "'-", "c", "'_", ",_", "'", "UT", "F", "-", "8", "'_", "]_", "+_", "widt", "h", "\\u", "args_", ",_", "**_", "sp", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "output", "\\u", "channel_", "=_", "os_", "._", "fdo", "pen_", "(_", "master_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "ose", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ose", "_", "._", "errno_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "report", "\\u", "warning_", "(_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "fri", "bid", "i", " ", "executable", ",", " ", "ign", "orin", "g", " ", "--", "bid", "i", "-", "workar", "ound", " ", ".", " ", "Make", " ", "sure", " ", "tha", "t", " ", " ", "fri", "bid", "i", " ", " ", "is", " ", "an", " ", "executable", " ", "file", " ", "in", " ", "one", " ", "of", " ", "the", " ", "director", "ies", " ", "in", " ", "your", " ", "$", "PATH", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "3_", ",_", ")_", "and_", "sys_", "._", "platform_", "!=_", "'", "win32", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "getfile", "system", "encoding_", "(_", ")_", "in_", "[_", "'", "ascii", "'_", ",_", "'", "ANSI", "\\u", "X", "3.4", "-1", "968", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "not_", "params_", "._", "get_", "(_", "'", "restrict", "filename", "s", "'_", ",_", "False_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", " ", "Pyth", "on", " ", "3", ",", " ", "the", " ", "Unic", "ode", " ", "filesystem", " ", "API", " ", "will", " ", "throw", " ", "error", "s", " ", "(", "#", "147", "4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Assu", "ming", " ", "--", "restrict", "-", "filename", "s", " ", "sinc", "e", " ", "file", " ", "system", " ", "encoding", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cann", "ot", " ", "encode", " ", "all", " ", "character", "s", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Set", " ", "the", " ", "LC", "\\u", "ALL", " ", "environ", "ment", " ", "variab", "le", " ", "to", " ", "fix", " ", "this", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "params_", "[_", "'", "restrict", "filename", "s", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'%", "(", "stit", "le", ")", "s", "'_", "in_", "self_", "._", "params_", "._", "get_", "(_", "'", "outt", "mpl", "'_", ",_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "warning_", "(_", "'%", "(", "stit", "le", ")", "s", " ", "is", " ", "depre", "cated", ".", " ", "Us", "e", " ", "the", " ", "%", "(", "title", ")", "s", " ", "and", " ", "the", " ", "--", "restrict", "-", "filename", "s", " ", "flag", "(", "whi", "ch", " ", "als", "o", " ", "secure", "s", " ", "%", "(", "uploade", "r", ")", "s", " ", "et", " ", "al", ")", " ", "inst", "ead", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "setup", "\\u", "opener_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "auto", "\\u", "init_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "print", "\\u", "debug", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "default", "\\u", "info", "\\u", "extractors", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "pp", "\\u", "def", "\\u", "raw_", "in_", "self_", "._", "params_", "._", "get_", "(_", "'", "postprocess", "ors", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pp", "\\u", "class_", "=_", "get", "\\u", "postprocess", "or_", "(_", "pp", "\\u", "def", "\\u", "raw_", "[_", "'", "key", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp", "\\u", "def_", "=_", "dict_", "(_", "pp", "\\u", "def", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "pp", "\\u", "def_", "[_", "'", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp_", "=_", "pp", "\\u", "class_", "(_", "self_", ",_", "**_", "compa", "t", "\\u", "kwargs_", "(_", "pp", "\\u", "def_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "post", "\\u", "processor_", "(_", "pp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ph_", "in_", "self_", "._", "params_", "._", "get_", "(_", "'", "progress", "\\u", "hook", "s", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "progress", "\\u", "hook_", "(_", "ph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "warn", "\\u", "if", "\\u", "short", "\\u", "id_", "(_", "self_", ",_", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "short", " ", "You", "Tu", "be", " ", "ID", " ", "startin", "g", " ", "with", " ", "dash", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idxs_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "for_", "i_", ",_", "a_", "in_", "enumerate_", "(_", "argv_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "r", "'", "^", "-[", "0", "-", "9", "A", "-", "Za", "-", "z", "\\u-]", "{", "10", "}$'_", ",_", "a_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "idxs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct", "\\u", "argv_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "youtu", "be", "-", "dl", "'_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "a_", "for_", "i_", ",_", "a_", "in_", "enumerate_", "(_", "argv_", ")_", "if_", "i_", "not_", "in_", "idxs_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'--'_", "]_", "+_", "[_", "argv_", "[_", "i_", "]_", "for_", "i_", "in_", "idxs_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "report", "\\u", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Long", " ", "argu", "ment", " ", "string", " ", "detect", "ed", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Us", "e", " ", "--", " ", "to", " ", "separate", " ", "parameter", "s", " ", "and", " ", "URL", "s", ",", " ", "like", " ", "this", ":\\\\", "n", "%", "s", "\\\\", "n", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "args", "\\u", "to", "\\u", "str_", "(_", "correct", "\\u", "argv_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "add", "\\u", "info", "\\u", "extractor_", "(_", "self_", ",_", "ie_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "an", " ", "Info", "Extract", "or", " ", "object", " ", "to", " ", "the", " ", "end", " ", "of", " ", "the", " ", "list", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ies_", "._", "append_", "(_", "ie_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ies", "\\u", "instances_", "[_", "ie_", "._", "ie", "\\u", "key_", "(_", ")_", "]_", "=_", "ie_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie_", "._", "set\\u", "downloader_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "info", "\\u", "extractor_", "(_", "self_", ",_", "ie", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "an", " ", "instance", " ", "of", " ", "an", " ", "IE", " ", "with", " ", "name", " ", "ie", "\\u", "key", ",", " ", "it", " ", "will", " ", "try", " ", "to", " ", "get", " ", "one", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "\\u", "ies", " ", "list", ",", " ", "if", " ", "there", "'", "s", " ", "no", " ", "instance", " ", "it", " ", "will", " ", "create", " ", "a", " ", "new", " ", "one", " ", "and", " ", "add", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "to", " ", "the", " ", "extract", "or", " ", "list", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie_", "=_", "self_", "._", "\\u", "ies", "\\u", "instances_", "._", "get_", "(_", "ie", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ie_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ie_", "=_", "get", "\\u", "info", "\\u", "extractor_", "(_", "ie", "\\u", "key_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "info", "\\u", "extractor_", "(_", "ie_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ie_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "default", "\\u", "info", "\\u", "extractors", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "the", " ", "Info", "Extract", "ors", " ", "return", "ed", " ", "by", " ", "gen", "\\u", "extractors", " ", "to", " ", "the", " ", "end", " ", "of", " ", "the", " ", "list", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ie_", "in_", "gen", "\\u", "extractors", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "info", "\\u", "extractor_", "(_", "ie_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "add", "\\u", "post", "\\u", "processor_", "(_", "self_", ",_", "pp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "a", " ", "Post", "Process", "or", " ", "object", " ", "to", " ", "the", " ", "end", " ", "of", " ", "the", " ", "chain", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pps", "_", "._", "append_", "(_", "pp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp_", "._", "set\\u", "downloader_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "progress", "\\u", "hook_", "(_", "self_", ",_", "ph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "the", " ", "progress", " ", "hook", " ", "(", "currentl", "y", " ", "only", " ", "for", " ", "the", " ", "file", " ", "downloader", ")\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "progress", "\\u", "hooks_", "._", "append_", "(_", "ph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "bid", "i", "\\u", "workar", "ound_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'\\u", "output", "\\u", "channel", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "hasattr_", "(_", "self_", ",_", "'\\u", "output", "\\u", "process", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "message_", ",_", "compa", "t", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "\\u", "count_", "=_", "message_", "._", "count_", "(_", "'\\\\", "n", "'_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "output", "\\u", "process_", "._", "stdin_", "._", "write_", "(_", "(_", "message_", "+_", "'\\\\", "n", "'_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "output", "\\u", "process_", "._", "stdin_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "''_", "._", "join_", "(_", "self_", "._", "\\u", "output", "\\u", "channel_", "._", "readline_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "line", "\\u", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "[_", ":_", "-_", "len_", "(_", "'\\\\", "n", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "screen_", "(_", "self_", ",_", "message_", ",_", "skip", "\\u", "eol_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Print", " ", "message", " ", "to", " ", "stdout", " ", "if", " ", "not", " ", "in", " ", "quie", "t", " ", "mode", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "to", "\\u", "stdout_", "(_", "message_", ",_", "skip", "\\u", "eol_", ",_", "check", "\\u", "quiet_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "string_", "(_", "self_", ",_", "s_", ",_", "out_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "write", "\\u", "string_", "(_", "s_", ",_", "out_", "=_", "out_", ",_", "encoding_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "encoding", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "to", "\\u", "stdout_", "(_", "self_", ",_", "message_", ",_", "skip", "\\u", "eol_", "=_", "False_", ",_", "check", "\\u", "quiet_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Print", " ", "message", " ", "to", " ", "stdout", " ", "if", " ", "not", " ", "in", " ", "quie", "t", " ", "mode", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "logg", "er", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "[_", "'", "logg", "er", "'_", "]_", "._", "debug_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "check", "\\u", "quiet_", "or_", "not_", "self_", "._", "params_", "._", "get_", "(_", "'", "quie", "t", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "self_", "._", "\\u", "bid", "i", "\\u", "workar", "ound_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "terminator", "_", "=_", "[_", "'\\\\", "n", "'_", ",_", "''_", "]_", "[_", "skip", "\\u", "eol_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "message_", "+_", "terminator", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "string_", "(_", "output_", ",_", "self_", "._", "\\u", "screen", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "to", "\\u", "stderr_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Print", " ", "message", " ", "to", " ", "std", "err", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "message_", ",_", "compa", "t", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "logg", "er", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "[_", "'", "logg", "er", "'_", "]_", "._", "error_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "self_", "._", "\\u", "bid", "i", "\\u", "workar", "ound_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "message_", "+_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "string_", "(_", "output_", ",_", "self_", "._", "\\u", "err", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "to", "\\u", "console", "\\u", "title_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "params_", "._", "get_", "(_", "'", "console", "title", "'_", ",_", "False_", ")_", ":_", "\\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_", "os_", "._", "name_", "==_", "'", "nt", "'_", "and_", "ctypes_", "._", "windll_", "._", "kernel32_", "._", "Get", "Cons", "ole", "Window_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "c\\u", "wchar", "\\u", "p", "()", " ", "mig", "ht", " ", "not", " ", "be", " ", "necessar", "y", " ", "if", " ", "`", "message", "`", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alr", "ead", "y", " ", "of", " ", "type", " ", "unicode", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctypes_", "._", "windll_", "._", "kernel32_", "._", "Set", "Cons", "ole", "Tit", "le", "W_", "(_", "ctypes_", "._", "c\\u", "wchar", "\\u", "p_", "(_", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "TERM", "'_", "in_", "os_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "string_", "(_", "'\\\\", "033", "]", "0", ";", "%", "s", "\\\\", "007", "'_", "%_", "message_", ",_", "self_", "._", "\\u", "screen", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "save", "\\u", "console", "\\u", "title_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "params_", "._", "get_", "(_", "'", "console", "title", "'_", ",_", "False_", ")_", ":_", "\\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_", "'", "TERM", "'_", "in_", "os_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Save", " ", "the", " ", "title", " ", "on", " ", "stack_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "string_", "(_", "'\\\\", "033", "[", "2", "2", ";", "0", "t", "'_", ",_", "self_", "._", "\\u", "screen", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "restore", "\\u", "console", "\\u", "title_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "params_", "._", "get_", "(_", "'", "console", "title", "'_", ",_", "False_", ")_", ":_", "\\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_", "'", "TERM", "'_", "in_", "os_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Restor", "e", " ", "the", " ", "title", " ", "from", " ", "stack_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "string_", "(_", "'\\\\", "033", "[", "23", ";", "0", "t", "'_", ",_", "self_", "._", "\\u", "screen", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "enter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "save", "\\u", "console", "\\u", "title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "exit\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "restore", "\\u", "console", "\\u", "title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "cookie", "file", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cookie", "jar_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "trouble", "_", "(_", "self_", ",_", "message_", "=_", "None_", ",_", "tb_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Det", "erm", "ine", " ", "action", " ", "to", " ", "take", " ", "whe", "n", " ", "a", " ", "download", " ", "problem", " ", "appear", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Depend", "ing", " ", "on", " ", "if", " ", "the", " ", "downloader", " ", "has", " ", "bee", "n", " ", "configur", "ed", " ", "to", " ", "ignore", "\\", "10", ";", " ", " ", " ", " ", "download", " ", "error", "s", " ", "or", " ", "not", ",", " ", "this", " ", "method", " ", "may", " ", "throw", " ", "an", " ", "exception", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "whe", "n", " ", "error", "s", " ", "are", " ", "found", ",", " ", "after", " ", "printin", "g", " ", "the", " ", "message", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "tb", ",", " ", "if", " ", "give", "n", ",", " ", "is", " ", "addition", "al", " ", "traceback", " ", "informati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "message_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "stderr_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "verbo", "se", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tb_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", ":_", "#", " ", "if", " ", ".", "trouble", " ", "has", " ", "bee", "n", " ", "call", "ed", " ", "from", " ", "an", " ", "except", " ", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tb_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ",_", "'", "exc", "\\u", "info", "'_", ")_", "and_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "._", "exc", "\\u", "info_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tb_", "+=_", "''_", "._", "join_", "(_", "traceback_", "._", "format\\u", "exception_", "(_", "*_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "._", "exc", "\\u", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tb_", "+=_", "compa", "t", "\\u", "str_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tb", "\\u", "data_", "=_", "traceback_", "._", "format\\u", "list_", "(_", "traceback_", "._", "extract", "\\u", "stack_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb_", "=_", "''_", "._", "join_", "(_", "tb", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "to", "\\u", "stderr_", "(_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "params_", "._", "get_", "(_", "'", "ignore", "error", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", "and_", "hasattr_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ",_", "'", "exc", "\\u", "info", "'_", ")_", "and_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "._", "exc", "\\u", "info_", "[_", "0_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "._", "exc", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Down", "load", "Error_", "(_", "message_", ",_", "exc", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "download", "\\u", "retcode_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "report", "\\u", "warning_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Print", " ", "the", " ", "message", " ", "to", " ", "std", "err", ",", " ", "it", " ", "will", " ", "be", " ", "prefixed", " ", "with", " ", "'", "WARN", "ING", ":'", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "std", "err", " ", "is", " ", "a", " ", "tt", "y", " ", "file", " ", "the", " ", "'", "WARN", "ING", ":'", " ", "will", " ", "be", " ", "colore", "d", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "logg", "er", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "params_", "[_", "'", "logg", "er", "'_", "]_", "._", "warning_", "(_", "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 ", " _", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "no", "\\u", "warn", "ings", "'_", ")_", ":_", "\\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_", "self_", "._", "\\u", "err", "\\u", "file_", "._", "isatty_", "(_", ")_", "and_", "os_", "._", "name_", "!=_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "msg", "\\u", "header_", "=_", "'\\\\", "033", "[", "0", ";", "3", "3", "m", "WARN", "ING", ":\\\\", "033", "[", "0", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "msg", "\\u", "header_", "=_", "'", "WARN", "ING", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "warn", "ing", "\\u", "message_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "\\u", "msg", "\\u", "header_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "to", "\\u", "stderr_", "(_", "warn", "ing", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "report", "\\u", "error_", "(_", "self_", ",_", "message_", ",_", "tb_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Do", " ", "the", " ", "same", " ", "as", " ", "trouble", ",", " ", "but", " ", "prefix", "es", " ", "the", " ", "message", " ", "with", " ", "'", "ERROR", ":'", ",", " ", "colore", "d", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "red", " ", "if", " ", "std", "err", " ", "is", " ", "a", " ", "tt", "y", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "err", "\\u", "file_", "._", "isatty_", "(_", ")_", "and_", "os_", "._", "name_", "!=_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "msg", "\\u", "header_", "=_", "'\\\\", "033", "[", "0", ";", "3", "1", "m", "ERROR", ":\\\\", "033", "[", "0", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "msg", "\\u", "header_", "=_", "'", "ERROR", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "error", "\\u", "message_", "=_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "\\u", "msg", "\\u", "header_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "trouble", "_", "(_", "error", "\\u", "message_", ",_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "report", "\\u", "file", "\\u", "alr", "ead", "y", "\\u", "downloaded_", "(_", "self_", ",_", "file", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Report", " ", "file", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "full", "y", " ", "download", "ed", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "download", "]", " ", "%", "s", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "download", "ed", "'_", "%_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Encode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "download", "]", " ", "The", " ", "file", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "download", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "prepar", "e\\u", "filename_", "(_", "self_", ",_", "info", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Generate", " ", "the", " ", "output", " ", "filename", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "dict_", "=_", "dict_", "(_", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "dict_", "[_", "'", "epoch", "'_", "]_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auto", "number", "\\u", "size_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "auto", "number", "\\u", "size", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "auto", "number", "\\u", "size_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auto", "number", "\\u", "size_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "auto", "number", "\\u", "templ", "_", "=_", "'%", "0", "'_", "+_", "str_", "(_", "auto", "number", "\\u", "size_", ")_", "+_", "'", "d", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "dict_", "[_", "'", "auto", "number", "'_", "]_", "=_", "auto", "number", "\\u", "templ", "_", "%_", "self_", "._", "\\u", "num", "\\u", "downloads_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "template", "\\u", "dict_", "._", "get_", "(_", "'", "playl", "ist", "\\u", "index", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "dict_", "[_", "'", "playl", "ist", "\\u", "index", "'_", "]_", "=_", "'%", "0", "*", "d", "'_", "%_", "(_", "len_", "(_", "str_", "(_", "template", "\\u", "dict_", "[_", "'", "n", "\\u", "entri", "es", "'_", "]_", ")_", ")_", ",_", "template", "\\u", "dict_", "[_", "'", "playl", "ist", "\\u", "index", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "template", "\\u", "dict_", "._", "get_", "(_", "'", "resolu", "tion", "'_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "template", "\\u", "dict_", "._", "get_", "(_", "'", "widt", "h", "'_", ")_", "and_", "template", "\\u", "dict_", "._", "get_", "(_", "'", "height", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "template", "\\u", "dict_", "[_", "'", "resolu", "tion", "'_", "]_", "=_", "'%", "dx", "%", "d", "'_", "%_", "(_", "template", "\\u", "dict_", "[_", "'", "widt", "h", "'_", "]_", ",_", "template", "\\u", "dict_", "[_", "'", "height", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "template", "\\u", "dict_", "._", "get_", "(_", "'", "height", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "template", "\\u", "dict_", "[_", "'", "resolu", "tion", "'_", "]_", "=_", "'%", "sp", "'_", "%_", "template", "\\u", "dict_", "[_", "'", "height", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "template", "\\u", "dict_", "._", "get_", "(_", "'", "widt", "h", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "template", "\\u", "dict_", "[_", "'", "resolu", "tion", "'_", "]_", "=_", "'?", "x", "%", "d", "'_", "%_", "template", "\\u", "dict_", "[_", "'", "widt", "h", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sanitize_", "=_", "lambda_", "k_", ",_", "v_", ":_", "sanitize", "\\u", "filename_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "compa", "t", "\\u", "str_", "(_", "v_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "restricted_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "restrict", "filename", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "id_", "=_", "(_", "k_", "==_", "'", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "dict_", "=_", "dict_", "(_", "(_", "k_", ",_", "sanitize_", "(_", "k_", ",_", "v_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "template", "\\u", "dict_", "._", "items_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "v_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "dict_", "=_", "collections_", "._", "defaultdict_", "(_", "lambda_", ":_", "'", "NA", "'_", ",_", "template", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outt", "mpl_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "outt", "mpl", "'_", ",_", "DEF", "AUL", "T", "\\u", "OUT", "TMP", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpl_", "=_", "compa", "t", "\\u", "expanduser_", "(_", "outt", "mpl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "tmpl_", "%_", "template", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "error_", "(_", "'", "Error", " ", "in", " ", "output", " ", "template", ":", " ", "'_", "+_", "str_", "(_", "err_", ")_", "+_", "'", " ", "(", "encoding", ":", " ", "'_", "+_", "repr_", "(_", "prefer", "rede", "nco", "ding_", "(_", ")_", ")_", "+_", "')'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "match", "\\u", "entry_", "(_", "self_", ",_", "info", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "Non", "e", " ", "iff", " ", "the", " ", "file", " ", "shou", "ld", " ", "be", " ", "download", "ed", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "video", "\\u", "title_", "=_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "title", "'_", ",_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "id", "'_", ",_", "'", "video", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "title", "'_", "in_", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "can", " ", "happ", "en", " ", "whe", "n", " ", "we", "'", "re", " ", "just", " ", "evaluat", "ing", " ", "the", " ", "playlist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "info", "\\u", "dict_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match", "title_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "match", "title", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "search_", "(_", "match", "title_", ",_", "title_", ",_", "re_", "._", "IGNORECASE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "'\"'_", "+_", "title_", "+_", "'\"", " ", "title", " ", "did", " ", "not", " ", "match", " ", "pattern", " ", "\"'_", "+_", "match", "title_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reject", "title_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "reject", "title", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reject", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "re_", "._", "search_", "(_", "reject", "title_", ",_", "title_", ",_", "re_", "._", "IGNORECASE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "'\"'_", "+_", "title_", "+_", "'\"", " ", "title", " ", "matche", "d", " ", "reject", " ", "pattern", " ", "\"'_", "+_", "reject", "title_", "+_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "date_", "=_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "upload", "\\u", "date", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "date_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "date", "Range_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "date", "range", "'_", ",_", "Date", "Range_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "date_", "not_", "in_", "date", "Range_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", " ", "upload", " ", "date", " ", "is", " ", "not", " ", "in", " ", "range", " ", "%", "s", "'_", "%_", "(_", "date", "\\u", "from", "\\u", "str_", "(_", "date_", ")_", "._", "isoformat_", "(_", ")_", ",_", "date", "Range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "view", "\\u", "count_", "=_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "view", "\\u", "count", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "view", "\\u", "count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "views_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "min", "\\u", "views", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "min", "\\u", "views_", "is_", "not_", "None_", "and_", "view", "\\u", "count_", "<_", "min", "\\u", "views_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Ski", "ppi", "ng", " ", "%", "s", ",", " ", "bec", "aus", "e", " ", "it", " ", "has", " ", "not", " ", "reache", "d", " ", "minim", "um", " ", "view", " ", "count", " ", "(%", "d", "/", "%", "d", ")'_", "%_", "(_", "video", "\\u", "title_", ",_", "view", "\\u", "count_", ",_", "min", "\\u", "views_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "max", "\\u", "views_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "max", "\\u", "views", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "\\u", "views_", "is_", "not_", "None_", "and_", "view", "\\u", "count_", ">_", "max", "\\u", "views_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Ski", "ppi", "ng", " ", "%", "s", ",", " ", "bec", "aus", "e", " ", "it", " ", "has", " ", "exceed", "ed", " ", "the", " ", "maxim", "um", " ", "view", " ", "count", " ", "(%", "d", "/", "%", "d", ")'_", "%_", "(_", "video", "\\u", "title_", ",_", "view", "\\u", "count_", ",_", "max", "\\u", "views_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "age", "\\u", "restricted_", "(_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "age", "\\u", "limit", "'_", ")_", ",_", "self_", "._", "params_", "._", "get_", "(_", "'", "age", "\\u", "limit", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Ski", "ppi", "ng", " ", "\"%", "s", "\"", " ", "bec", "aus", "e", " ", "it", " ", "is", " ", "age", " ", "restrict", "ed", "'_", "%_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "in", "\\u", "download", "\\u", "archive_", "(_", "info", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'%", "s", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "recorde", "d", " ", "in", " ", "archive", "'_", "%_", "video", "\\u", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "extra", "\\u", "info_", "(_", "info", "\\u", "dict_", ",_", "extra", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Set", " ", "the", " ", "keys", " ", "from", " ", "extra", "\\u", "info", " ", "in", " ", "info", " ", "dict", " ", "if", " ", "the", "y", " ", "are", " ", "missi", "ng", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "extra", "\\u", "info_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "dict_", "._", "setdefault_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "extract", "\\u", "info_", "(_", "self_", ",_", "url_", ",_", "download_", "=_", "True_", ",_", "ie", "\\u", "key_", "=_", "None_", ",_", "extra", "\\u", "info_", "=_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "process_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "list", " ", "with", " ", "a", " ", "dictionar", "y", " ", "for", " ", "each", " ", "video", " ", "we", " ", "find", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "'", "download", "',", " ", "als", "o", " ", "download", "s", " ", "the", " ", "videos", ".", "\\", "10", ";", " ", " ", " ", " ", "extra", "\\u", "info", " ", "is", " ", "a", " ", "dict", " ", "contain", "ing", " ", "the", " ", "extra", " ", "values", " ", "to", " ", "add", " ", "to", " ", "each", " ", "result", "\\", "10", ";", " ", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ie", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ies_", "=_", "[_", "self_", "._", "get", "\\u", "info", "\\u", "extractor_", "(_", "ie", "\\u", "key_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ies_", "=_", "self_", "._", "\\u", "ies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ie_", "in_", "ies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "ie_", "._", "suit", "able_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "ie_", "._", "working", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "warning_", "(_", "'", "The", " ", "program", " ", "functional", "it", "y", " ", "for", " ", "this", " ", "site", " ", "has", " ", "bee", "n", " ", "marked", " ", "as", " ", "broken", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "and", " ", "will", " ", "probab", "ly", " ", "not", " ", "work", ".'_", ")_", "\\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 ", " _", "ie", "\\u", "result_", "=_", "ie_", "._", "extract_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ie", "\\u", "result_", "is_", "None_", ":_", "#", " ", "Finish", "ed", " ", "alr", "ead", "y", " ", "(", "back", "ward", "s", " ", "compatibility", ";", " ", "list", "formats", " ", "and", " ", "friends", " ", "shou", "ld", " ", "be", " ", "moved", " ", "here", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "ie", "\\u", "result_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Backward", "s", " ", "compatibility", ":", " ", "old", " ", "IE", " ", "result", " ", "format_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ie", "\\u", "result_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "type", "'_", ":_", "'", "compa", "t", "\\u", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entri", "es", "'_", ":_", "ie", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "add", "\\u", "default", "\\u", "extra", "\\u", "info_", "(_", "ie", "\\u", "result_", ",_", "ie_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "process_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "process", "\\u", "ie", "\\u", "result_", "(_", "ie", "\\u", "result_", ",_", "download_", ",_", "extra", "\\u", "info_", ")_", "\\u\\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_", "ie", "\\u", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Extract", "or", "Error_", "as_", "de_", ":_", "#", " ", "An", " ", "error", " ", "we", " ", "some", "what", " ", "expected_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "error_", "(_", "compa", "t", "\\u", "str_", "(_", "de_", ")_", ",_", "de_", "._", "format\\u", "traceback_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Max", "Down", "load", "s", "Reach", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "ignore", "error", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "report", "\\u", "error_", "(_", "compa", "t", "\\u", "str_", "(_", "e_", ")_", ",_", "tb_", "=_", "compa", "t", "\\u", "str_", "(_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\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 ", " _", "self_", "._", "report", "\\u", "error_", "(_", "'", "no", " ", "suit", "able", " ", "Info", "Extract", "or", " ", "for", " ", "URL", " ", "%", "s", "'_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "add", "\\u", "default", "\\u", "extra", "\\u", "info_", "(_", "self_", ",_", "ie", "\\u", "result_", ",_", "ie_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "extra", "\\u", "info_", "(_", "ie", "\\u", "result_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extract", "or", "'_", ":_", "ie_", "._", "IE", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "webpage", "\\u", "url", "'_", ":_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "webpage", "\\u", "url", "\\u", "basen", "ame", "'_", ":_", "url", "\\u", "basename_", "(_", "url_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extract", "or", "\\u", "key", "'_", ":_", "ie_", "._", "ie", "\\u", "key_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "ie", "\\u", "result_", "(_", "self_", ",_", "ie", "\\u", "result_", ",_", "download_", "=_", "True_", ",_", "extra", "\\u", "info_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tak", "e", " ", "the", " ", "result", " ", "of", " ", "the", " ", "ie", "(", "may", " ", "be", " ", "modifi", "ed", ")", " ", "and", " ", "resolve", " ", "all", " ", "unresolv", "ed", "\\", "10", ";", " ", " ", " ", " ", "reference", "s", " ", "(", "URL", "s", ",", " ", "playl", "ist", " ", "items", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "will", " ", "als", "o", " ", "download", " ", "the", " ", "videos", " ", "if", " ", "'", "download", "'.", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "resolve", "d", " ", "ie", "\\u", "result", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result", "\\u", "type_", "=_", "ie", "\\u", "result_", "._", "get_", "(_", "'\\u", "type", "'_", ",_", "'", "video", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "result", "\\u", "type_", "in_", "(_", "'", "url", "'_", ",_", "'", "url", "\\u", "transp", "arent", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extract", "\\u", "flat_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "extract", "\\u", "flat", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "(_", "extract", "\\u", "flat_", "==_", "'", "in", "\\u", "playl", "ist", "'_", "and_", "'", "playl", "ist", "'_", "in_", "extra", "\\u", "info_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "extract", "\\u", "flat_", "is_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "force", "json", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "to", "\\u", "stdout_", "(_", "json_", "._", "dumps_", "(_", "ie", "\\u", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ie", "\\u", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "result", "\\u", "type_", "==_", "'", "video", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "extra", "\\u", "info_", "(_", "ie", "\\u", "result_", ",_", "extra", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "process", "\\u", "video", "\\u", "result_", "(_", "ie", "\\u", "result_", ",_", "download_", "=_", "download_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result", "\\u", "type_", "==_", "'", "url", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "have", " ", "to", " ", "add", " ", "extra", "\\u", "info", " ", "to", " ", "the", " ", "results", " ", "bec", "aus", "e", " ", "it", " ", "may", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", "ed", " ", "in", " ", "a", " ", "playlist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "extract", "\\u", "info_", "(_", "ie", "\\u", "result_", "[_", "'", "url", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ie", "\\u", "key_", "=_", "ie", "\\u", "result_", "._", "get_", "(_", "'", "ie", "\\u", "key", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "info_", "=_", "extra", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result", "\\u", "type_", "==_", "'", "url", "\\u", "transp", "arent", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "informati", "on", " ", "from", " ", "the", " ", "embed", "ding", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "self_", "._", "extract", "\\u", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ie", "\\u", "result_", "[_", "'", "url", "'_", "]_", ",_", "ie", "\\u", "key_", "=_", "ie", "\\u", "result_", "._", "get_", "(_", "'", "ie", "\\u", "key", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "info_", "=_", "extra", "\\u", "info_", ",_", "download_", "=_", "False_", ",_", "process_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "force", "\\u", "properties_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "k_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "ie", "\\u", "result_", "._", "items_", "(_", ")_", "if_", "v_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "(_", "'\\u", "type", "'_", ",_", "'", "url", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "in_", "force", "\\u", "properties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "force", "\\u", "properties_", "[_", "f_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "result_", "=_", "info_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "result_", "._", "update_", "(_", "force", "\\u", "properties_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "new", "\\u", "result_", "._", "get_", "(_", "'\\u", "type", "'_", ")_", "!=_", "'", "url", "\\u", "transp", "arent", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "process", "\\u", "ie", "\\u", "result_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "result_", ",_", "download_", "=_", "download_", ",_", "extra", "\\u", "info_", "=_", "extra", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result", "\\u", "type_", "==_", "'", "playl", "ist", "'_", "or_", "result", "\\u", "type_", "==_", "'", "multi", "\\u", "video", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "process", " ", "each", " ", "entry", " ", "in", " ", "the", " ", "playlist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "playlist_", "=_", "ie", "\\u", "result_", "._", "get_", "(_", "'", "title", "'_", ",_", "None_", ")_", "or_", "ie", "\\u", "result_", "._", "get_", "(_", "'", "id", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "download", "]", " ", "Down", "load", "ing", " ", "playl", "ist", ":", " ", "%", "s", "'_", "%_", "playlist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "playl", "ist", "\\u", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "playl", "ists", "tart_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "playl", "ists", "tart", "'_", ",_", "1_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "playl", "iste", "nd_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "playl", "iste", "nd", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "back", "ward", "s", " ", "compatibility", ",", " ", "interpret", " ", "-1", " ", "as", " ", "whole", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "playl", "iste", "nd_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "playl", "iste", "nd_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ie", "\\u", "entries_", "=_", "ie", "\\u", "result_", "[_", "'", "entri", "es", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "ie", "\\u", "entries_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n", "\\u", "all", "\\u", "entries_", "=_", "len_", "(_", "ie", "\\u", "entries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entries_", "=_", "ie", "\\u", "entries_", "[_", "playl", "ists", "tart_", ":_", "playl", "iste", "nd_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "entries_", "=_", "len_", "(_", "entries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "to", "\\u", "screen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "s", "]", " ", "playl", "ist", " ", "%", "s", ":", " ", "Collect", "ed", " ", "%", "d", " ", "video", " ", "ids", " ", "(", "download", "ing", " ", "%", "d", " ", "of", " ", "them", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ie", "\\u", "result_", "[_", "'", "extract", "or", "'_", "]_", ",_", "playlist_", ",_", "n", "\\u", "all", "\\u", "entries_", ",_", "n", "\\u", "entries_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "ie", "\\u", "entries_", ",_", "Page", "d", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entries_", "=_", "ie", "\\u", "entries_", "._", "gets", "lice", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "playl", "ists", "tart_", ",_", "playl", "iste", "nd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "entries_", "=_", "len_", "(_", "entries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "to", "\\u", "screen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "s", "]", " ", "playl", "ist", " ", "%", "s", ":", " ", "Down", "load", "ing", " ", "%", "d", " ", "videos", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ie", "\\u", "result_", "[_", "'", "extract", "or", "'_", "]_", ",_", "playlist_", ",_", "n", "\\u", "entries_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "iterable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entries_", "=_", "list_", "(_", "itertools_", "._", "islice_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ie", "\\u", "entries_", ",_", "playl", "ists", "tart_", ",_", "playl", "iste", "nd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "entries_", "=_", "len_", "(_", "entries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "to", "\\u", "screen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "%", "s", "]", " ", "playl", "ist", " ", "%", "s", ":", " ", "Down", "load", "ing", " ", "%", "d", " ", "videos", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ie", "\\u", "result_", "[_", "'", "extract", "or", "'_", "]_", ",_", "playlist_", ",_", "n", "\\u", "entries_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "playl", "istr", "ever", "se", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entries_", "=_", "entries_", "[_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "entry_", "in_", "enumerate_", "(_", "entries_", ",_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "download", "]", " ", "Down", "load", "ing", " ", "video", " ", "%", "s", " ", "of", " ", "%", "s", "'_", "%_", "(_", "i_", ",_", "n", "\\u", "entries_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "n", "\\u", "entri", "es", "'_", ":_", "n", "\\u", "entries_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "playl", "ist", "'_", ":_", "playlist_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "playl", "ist", "\\u", "id", "'_", ":_", "ie", "\\u", "result_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "playl", "ist", "\\u", "title", "'_", ":_", "ie", "\\u", "result_", "._", "get_", "(_", "'", "title", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "playl", "ist", "\\u", "index", "'_", ":_", "i_", "+_", "playl", "ists", "tart_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extract", "or", "'_", ":_", "ie", "\\u", "result_", "[_", "'", "extract", "or", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "webpage", "\\u", "url", "'_", ":_", "ie", "\\u", "result_", "[_", "'", "webpage", "\\u", "url", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "webpage", "\\u", "url", "\\u", "basen", "ame", "'_", ":_", "url", "\\u", "basename_", "(_", "ie", "\\u", "result_", "[_", "'", "webpage", "\\u", "url", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extract", "or", "\\u", "key", "'_", ":_", "ie", "\\u", "result_", "[_", "'", "extract", "or", "\\u", "key", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reason_", "=_", "self_", "._", "\\u", "match", "\\u", "entry_", "(_", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reason_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "download", "]", " ", "'_", "+_", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entry", "\\u", "result_", "=_", "self_", "._", "process", "\\u", "ie", "\\u", "result_", "(_", "entry_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download_", "=_", "download_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "info_", "=_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "playl", "ist", "\\u", "results_", "._", "append_", "(_", "entry", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ie", "\\u", "result_", "[_", "'", "entri", "es", "'_", "]_", "=_", "playl", "ist", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ie", "\\u", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result", "\\u", "type_", "==_", "'", "compa", "t", "\\u", "list", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Extract", "or", " ", "%", "s", " ", "return", "ed", " ", "a", " ", "compa", "t", "\\u", "list", " ", "result", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "It", " ", "need", "s", " ", "to", " ", "be", " ", "update", "d", ".'_", "%_", "ie", "\\u", "result_", "._", "get_", "(_", "'", "extract", "or", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "fixup", "_", "(_", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "extra", "\\u", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extract", "or", "'_", ":_", "ie", "\\u", "result_", "[_", "'", "extract", "or", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "webpage", "\\u", "url", "'_", ":_", "ie", "\\u", "result_", "[_", "'", "webpage", "\\u", "url", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "webpage", "\\u", "url", "\\u", "basen", "ame", "'_", ":_", "url", "\\u", "basename_", "(_", "ie", "\\u", "result_", "[_", "'", "webpage", "\\u", "url", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extract", "or", "\\u", "key", "'_", ":_", "ie", "\\u", "result_", "[_", "'", "extract", "or", "\\u", "key", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ie", "\\u", "result_", "[_", "'", "entri", "es", "'_", "]_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "process", "\\u", "ie", "\\u", "result_", "(_", "\\u", "fixup", "_", "(_", "r_", ")_", ",_", "download_", ",_", "extra", "\\u", "info_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "r_", "in_", "ie", "\\u", "result_", "[_", "'", "entri", "es", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ie", "\\u", "result_", "\\u\\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_", "(_", "'", "Inva", "lid", " ", "result", " ", "type", ":", " ", "%", "s", "'_", "%_", "result", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "select", "\\u", "format_", "(_", "self_", ",_", "format\\u", "spec_", ",_", "avail", "able", "\\u", "formats_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "format\\u", "spec_", "==_", "'", "best", "'_", "or_", "format\\u", "spec_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "avail", "able", "\\u", "formats_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "format\\u", "spec_", "==_", "'", "worst", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "avail", "able", "\\u", "formats_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "format\\u", "spec_", "==_", "'", "best", "audio", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "audio", "\\u", "formats_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "for_", "f_", "in_", "avail", "able", "\\u", "formats_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "f_", "._", "get_", "(_", "'", "vco", "dec", "'_", ")_", "==_", "'", "none", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "audio", "\\u", "formats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "audio", "\\u", "formats_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "format\\u", "spec_", "==_", "'", "worst", "audio", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "audio", "\\u", "formats_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "for_", "f_", "in_", "avail", "able", "\\u", "formats_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "f_", "._", "get_", "(_", "'", "vco", "dec", "'_", ")_", "==_", "'", "none", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "audio", "\\u", "formats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "audio", "\\u", "formats_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "format\\u", "spec_", "==_", "'", "best", "video", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "video", "\\u", "formats_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "for_", "f_", "in_", "avail", "able", "\\u", "formats_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "f_", "._", "get_", "(_", "'", "acode", "c", "'_", ")_", "==_", "'", "none", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "video", "\\u", "formats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "video", "\\u", "formats_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "format\\u", "spec_", "==_", "'", "worst", "video", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "video", "\\u", "formats_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "for_", "f_", "in_", "avail", "able", "\\u", "formats_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "f_", "._", "get_", "(_", "'", "acode", "c", "'_", ")_", "==_", "'", "none", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "video", "\\u", "formats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "video", "\\u", "formats_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extensions_", "=_", "[_", "'", "mp", "4", "'_", ",_", "'", "fl", "v", "'_", ",_", "'", "webm", "'_", ",_", "'", "3", "gp", "'_", ",_", "'", "m4", "a", "'_", ",_", "'", "mp3", "'_", ",_", "'", "ogg", "'_", ",_", "'", "aac", "'_", ",_", "'", "wav", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "format\\u", "spec_", "in_", "extensions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "\\u", "f_", "=_", "lambda_", "f_", ":_", "f_", "[_", "'", "ext", "'_", "]_", "==_", "format\\u", "spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filter", "\\u", "f_", "=_", "lambda_", "f_", ":_", "f_", "[_", "'", "format\\u", "id", "'_", "]_", "==_", "format\\u", "spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "matches_", "=_", "list_", "(_", "filter_", "(_", "filter", "\\u", "f_", ",_", "avail", "able", "\\u", "formats_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "matches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "matches_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "video", "\\u", "result_", "(_", "self_", ",_", "info", "\\u", "dict_", ",_", "download_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "info", "\\u", "dict_", "._", "get_", "(_", "'\\u", "type", "'_", ",_", "'", "video", "'_", ")_", "==_", "'", "video", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "id", "'_", "not_", "in_", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Extract", "or", "Error_", "(_", "'", "Missing", " ", "\"", "id", "\"", " ", "field", " ", "in", " ", "extract", "or", " ", "result", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "title", "'_", "not_", "in_", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Extract", "or", "Error_", "(_", "'", "Missing", " ", "\"", "title", "\"", " ", "field", " ", "in", " ", "extract", "or", " ", "result", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "playl", "ist", "'_", "not_", "in_", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", " ", "isn", "'", "t", " ", "part", " ", "of", " ", "a", " ", "playlist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "dict_", "[_", "'", "playl", "ist", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "\\u", "dict_", "[_", "'", "playl", "ist", "\\u", "index", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "thumbnail", "s_", "=_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "thumbnail", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumbnail", "s_", "._", "sort_", "(_", "key_", "=_", "lambda_", "t_", ":_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "._", "get_", "(_", "'", "widt", "h", "'_", ")_", ",_", "t_", "._", "get_", "(_", "'", "height", "'_", ")_", ",_", "t_", "._", "get_", "(_", "'", "url", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "thumbnail", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "widt", "h", "'_", "in_", "t_", "and_", "'", "height", "'_", "in_", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "t_", "[_", "'", "resolu", "tion", "'_", "]_", "=_", "'%", "dx", "%", "d", "'_", "%_", "(_", "t_", "[_", "'", "widt", "h", "'_", "]_", ",_", "t_", "[_", "'", "height", "'_", "]_", ")_", "\\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_", "thumbnail", "s_", "and_", "'", "thumbnail", "'_", "not_", "in_", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "dict_", "[_", "'", "thumbnail", "'_", "]_", "=_", "thumbnail", "s_", "[_", "-_", "1_", "]_", "[_", "'", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "display", "\\u", "id", "'_", "not_", "in_", "info", "\\u", "dict_", "and_", "'", "id", "'_", "in_", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "dict_", "[_", "'", "display", "\\u", "id", "'_", "]_", "=_", "info", "\\u", "dict_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "upload", "\\u", "date", "'_", ")_", "is_", "None_", "and_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "timestamp", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Work", "ing", " ", "aro", "und", " ", "negati", "ve", " ", "timestamp", "s", " ", "in", " ", "Windows_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "see", " ", "http", "://", "bug", "s", ".", "python", ".", "org", "/", "issue", "164", "672", "8", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "info", "\\u", "dict_", "[_", "'", "timestamp", "'_", "]_", "<_", "0_", "and_", "os_", "._", "name_", "==_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "dict_", "[_", "'", "timestamp", "'_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "upload", "\\u", "date_", "=_", "datetime_", "._", "datetime_", "._", "utc", "fromtimestamp_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "info", "\\u", "dict_", "[_", "'", "timestamp", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "\\u", "dict_", "[_", "'", "upload", "\\u", "date", "'_", "]_", "=_", "upload", "\\u", "date_", "._", "strftime_", "(_", "'%", "Y", "%", "m", "%", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "extractors", " ", "handle", " ", "format", " ", "selection", " ", "them", "sel", "ves_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "info", "\\u", "dict_", "[_", "'", "extract", "or", "'_", "]_", "in_", "[_", "'", "You", "ku", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "download_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "process", "\\u", "info_", "(_", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "info", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "now", " ", "pick", " ", "whi", "ch", " ", "formats", " ", "have", " ", "to", " ", "be", " ", "downloaded_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "formats", "'_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "There", "'", "s", " ", "only", " ", "one", " ", "format", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formats_", "=_", "[_", "info", "\\u", "dict_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formats_", "=_", "info", "\\u", "dict_", "[_", "'", "formats", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "formats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Extract", "or", "Error_", "(_", "'", "No", " ", "video", " ", "formats", " ", "found", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "check", " ", "tha", "t", " ", "all", " ", "the", " ", "formats", " ", "have", " ", "the", " ", "format", " ", "and", " ", "format\\u", "id", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "format_", "in_", "enumerate_", "(_", "formats_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "url", "'_", "not_", "in_", "format_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Extract", "or", "Error_", "(_", "'", "Missing", " ", "\"", "url", "\"", " ", "key", " ", "in", " ", "result", " ", "(", "index", " ", "%", "d", ")'_", "%_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "format_", "._", "get_", "(_", "'", "format\\u", "id", "'_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format_", "[_", "'", "format\\u", "id", "'_", "]_", "=_", "compa", "t", "\\u", "str_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "format_", "._", "get_", "(_", "'", "format", "'_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format_", "[_", "'", "format", "'_", "]_", "=_", "'{", "id", "}", " ", "-", " ", "{", "res", "}{", "note", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "format_", "[_", "'", "format\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "format\\u", "resolution_", "(_", "format_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "note_", "=_", "'", " ", "({", "0", "})'_", "._", "format_", "(_", "format_", "[_", "'", "format\\u", "note", "'_", "]_", ")_", "if_", "format_", "._", "get_", "(_", "'", "format\\u", "note", "'_", ")_", "is_", "not_", "None_", "else_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Automat", "ical", "ly", " ", "dete", "rmin", "e", " ", "file", " ", "extensi", "on", " ", "if", " ", "missing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "ext", "'_", "not_", "in_", "format_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "format_", "[_", "'", "ext", "'_", "]_", "=_", "dete", "rmin", "e\\u", "ext_", "(_", "format_", "[_", "'", "url", "'_", "]_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "format\\u", "limit_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "format\\u", "limit", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "format\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formats_", "=_", "list_", "(_", "take", "whi", "le", "\\u", "inclu", "sive", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "f_", ":_", "f_", "[_", "'", "format\\u", "id", "'_", "]_", "!=_", "format\\u", "limit_", ",_", "formats_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "Cent", "ral", " ", "sorting", " ", "go", "es", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "formats_", "[_", "0_", "]_", "is_", "not_", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "set", " ", "the", " ", "'", "formats", "'", " ", "fields", " ", "if", " ", "the", " ", "original", " ", "info", "\\u", "dict", " ", "list", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", "wis", "e", " ", "we", " ", "end", " ", "up", " ", "with", " ", "a", " ", "circular", " ", "reference", ",", " ", "the", " ", "first", " ", "(", "and", " ", "unique", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "element", " ", "in", " ", "the", " ", "'", "formats", "'", " ", "field", " ", "in", " ", "info", "\\u", "dict", " ", "is", " ", "info", "\\u", "dict", " ", "its", "elf", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wic", "h", " ", "can", "'", "t", " ", "be", " ", "exported", " ", "to", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "dict_", "[_", "'", "formats", "'_", "]_", "=_", "formats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "list", "formats", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "list", "\\u", "formats_", "(_", "info", "\\u", "dict_", ")_", "\\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_", "req", "\\u", "format_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "format", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "req", "\\u", "format_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req", "\\u", "format_", "=_", "'", "best", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "formats", "\\u", "to", "\\u", "download_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "-1", " ", "is", " ", "for", " ", "support", "ing", " ", "You", "tube", "IE_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "req", "\\u", "format_", "in_", "(_", "'-", "1", "'_", ",_", "'", "all", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formats", "\\u", "to", "\\u", "download_", "=_", "formats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "rf", "str_", "in_", "req", "\\u", "format_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "can", " ", "accept", " ", "formats", " ", "request", "ed", " ", "in", " ", "the", " ", "format", ":", " ", "3", "4", "/", "5", "/", "best", ",", " ", "we", " ", "pick_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "first", " ", "tha", "t", " ", "is", " ", "avail", "able", ",", " ", "startin", "g", " ", "from", " ", "left_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req", "\\u", "formats_", "=_", "rf", "str_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rf_", "in_", "req", "\\u", "formats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "re_", "._", "match_", "(_", "r", "'.", "+?", "\\\\+", ".+?", "'_", ",_", "rf_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tw", "o", " ", "formats", " ", "have", " ", "bee", "n", " ", "request", "ed", " ", "like", " ", "'", "137", "+", "139", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "format\\u", "1_", ",_", "format\\u", "2_", "=_", "rf_", "._", "split_", "(_", "'+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats", "\\u", "info_", "=_", "(_", "self_", "._", "select", "\\u", "format_", "(_", "format\\u", "1_", ",_", "formats_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "select", "\\u", "format_", "(_", "format\\u", "2_", ",_", "formats_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "all_", "(_", "formats", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "first", " ", "format", " ", "must", " ", "contain", " ", "the", " ", "video", " ", "and", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "second", " ", "the", " ", "audio_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "formats", "\\u", "info_", "[_", "0_", "]_", "._", "get_", "(_", "'", "vco", "dec", "'_", ")_", "==_", "'", "none", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "report", "\\u", "error_", "(_", "'", "The", " ", "first", " ", "format", " ", "must", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contain", " ", "the", " ", "video", ",", " ", "try", " ", "usi", "ng", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "-", "f", " ", "%", "s", "+", "%", "s", "\"'_", "%_", "(_", "format\\u", "2_", ",_", "format\\u", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output", "\\u", "ext_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "formats", "\\u", "info_", "[_", "0_", "]_", "[_", "'", "ext", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "merge", "\\u", "output", "\\u", "format", "'_", ")_", "is_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "self_", "._", "params_", "[_", "'", "merge", "\\u", "output", "\\u", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selecte", "d\\u", "format_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "ed", "\\u", "formats", "'_", ":_", "formats", "\\u", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format", "'_", ":_", "rf_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ext", "'_", ":_", "formats", "\\u", "info_", "[_", "0_", "]_", "[_", "'", "ext", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "widt", "h", "'_", ":_", "formats", "\\u", "info_", "[_", "0_", "]_", "._", "get_", "(_", "'", "widt", "h", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "height", "'_", ":_", "formats", "\\u", "info_", "[_", "0_", "]_", "._", "get_", "(_", "'", "height", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resolu", "tion", "'_", ":_", "formats", "\\u", "info_", "[_", "0_", "]_", "._", "get_", "(_", "'", "resolu", "tion", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fp", "s", "'_", ":_", "formats", "\\u", "info_", "[_", "0_", "]_", "._", "get_", "(_", "'", "fp", "s", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vco", "dec", "'_", ":_", "formats", "\\u", "info_", "[_", "0_", "]_", "._", "get_", "(_", "'", "vco", "dec", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vbr", "'_", ":_", "formats", "\\u", "info_", "[_", "0_", "]_", "._", "get_", "(_", "'", "vbr", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stretch", "ed", "\\u", "ratio", "'_", ":_", "formats", "\\u", "info_", "[_", "0_", "]_", "._", "get_", "(_", "'", "stretch", "ed", "\\u", "ratio", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "acode", "c", "'_", ":_", "formats", "\\u", "info_", "[_", "1_", "]_", "._", "get_", "(_", "'", "acode", "c", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "abr", "'_", ":_", "formats", "\\u", "info_", "[_", "1_", "]_", "._", "get_", "(_", "'", "abr", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ext", "'_", ":_", "output", "\\u", "ext_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "selecte", "d\\u", "format_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "selecte", "d\\u", "format_", "=_", "self_", "._", "select", "\\u", "format_", "(_", "rf_", ",_", "formats_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "selecte", "d\\u", "format_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "formats", "\\u", "to", "\\u", "download_", "._", "append_", "(_", "selecte", "d\\u", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "formats", "\\u", "to", "\\u", "download_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Extract", "or", "Error_", "(_", "'", "request", "ed", " ", "format", " ", "not", " ", "avail", "able", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "download_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "formats", "\\u", "to", "\\u", "download_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "info", "]", " ", "%", "s", ":", " ", "download", "ing", " ", "video", " ", "in", " ", "%", "s", " ", "formats", "'_", "%_", "(_", "info", "\\u", "dict_", "[_", "'", "id", "'_", "]_", ",_", "len_", "(_", "formats", "\\u", "to", "\\u", "download_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "format_", "in_", "formats", "\\u", "to", "\\u", "download_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "info_", "=_", "dict_", "(_", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "info_", "._", "update_", "(_", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "process", "\\u", "info_", "(_", "new", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "update", " ", "the", " ", "info", " ", "dict", " ", "with", " ", "the", " ", "best", " ", "quali", "ty", " ", "format", " ", "(", "back", "ward", "s", " ", "compatibility", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info", "\\u", "dict_", "._", "update_", "(_", "formats", "\\u", "to", "\\u", "download_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "info", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "info_", "(_", "self_", ",_", "info", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Process", " ", "a", " ", "single", " ", "resolve", "d", " ", "IE", " ", "result", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "info", "\\u", "dict_", "._", "get_", "(_", "'\\u", "type", "'_", ",_", "'", "video", "'_", ")_", "==_", "'", "video", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "downloads_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "max", "\\u", "download", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "max", "\\u", "downloads_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "num", "\\u", "downloads_", ">=_", "int_", "(_", "max", "\\u", "downloads_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Max", "Down", "load", "s", "Reach", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info", "\\u", "dict_", "[_", "'", "fullt", "itle", "'_", "]_", "=_", "info", "\\u", "dict_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "info", "\\u", "dict_", "[_", "'", "title", "'_", "]_", ")_", ">_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "dict_", "[_", "'", "title", "'_", "]_", "=_", "info", "\\u", "dict_", "[_", "'", "title", "'_", "]_", "[_", ":_", "197_", "]_", "+_", "'...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Keep", " ", "for", " ", "back", "ward", "s", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info", "\\u", "dict_", "[_", "'", "stit", "le", "'_", "]_", "=_", "info", "\\u", "dict_", "[_", "'", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "format", "'_", "not_", "in_", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "dict_", "[_", "'", "format", "'_", "]_", "=_", "info", "\\u", "dict_", "[_", "'", "ext", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reason_", "=_", "self_", "._", "\\u", "match", "\\u", "entry_", "(_", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reason_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "download", "]", " ", "'_", "+_", "reason_", ")_", "\\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_", "self_", "._", "\\u", "num", "\\u", "downloads_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "self_", "._", "prepar", "e\\u", "filename_", "(_", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Force", "d", " ", "printin", "gs_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "force", "title", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "stdout_", "(_", "info", "\\u", "dict_", "[_", "'", "fullt", "itle", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "force", "id", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "stdout_", "(_", "info", "\\u", "dict_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "force", "url", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "request", "ed", "\\u", "formats", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "f_", "in_", "info", "\\u", "dict_", "[_", "'", "request", "ed", "\\u", "formats", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "to", "\\u", "stdout_", "(_", "f_", "[_", "'", "url", "'_", "]_", "+_", "f_", "._", "get_", "(_", "'", "play", "\\u", "path", "'_", ",_", "''_", ")_", ")_", "\\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_", "#", " ", "For", " ", "RTM", "P", " ", "URL", "s", ",", " ", "als", "o", " ", "include", " ", "the", " ", "play", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "stdout_", "(_", "info", "\\u", "dict_", "[_", "'", "url", "'_", "]_", "+_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "play", "\\u", "path", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "force", "thumbnail", "'_", ",_", "False_", ")_", "and_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "thumbnail", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "stdout_", "(_", "info", "\\u", "dict_", "[_", "'", "thumbnail", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "forced", "escri", "ption", "'_", ",_", "False_", ")_", "and_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "description", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "stdout_", "(_", "info", "\\u", "dict_", "[_", "'", "description", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "force", "filename", "'_", ",_", "False_", ")_", "and_", "filename_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "stdout_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "forced", "ura", "tion", "'_", ",_", "False_", ")_", "and_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "duration", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "stdout_", "(_", "format", "Seconds_", "(_", "info", "\\u", "dict_", "[_", "'", "duration", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "force", "format", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "stdout_", "(_", "info", "\\u", "dict_", "[_", "'", "format", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "force", "json", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "dict_", "[_", "'\\u", "filename", "'_", "]_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "to", "\\u", "stdout_", "(_", "json_", "._", "dumps_", "(_", "info", "\\u", "dict_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "dump", "\\u", "single", "\\u", "json", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "dict_", "[_", "'\\u", "filename", "'_", "]_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "not", "hing", " ", "else", " ", "if", " ", "in", " ", "simulat", "e", " ", "mode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "simulat", "e", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filename_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dn_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "encode", "Filename_", "(_", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dn_", "and_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "dn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "dn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "error_", "(_", "'", "una", "ble", " ", "to", " ", "create", " ", "director", "y", " ", "'_", "+_", "compa", "t", "\\u", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "write", "description", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "desc", "fn_", "=_", "filename_", "+_", "'.", "description", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "noo", "ver", "writes", "'_", ",_", "False_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "encode", "Filename_", "(_", "desc", "fn_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "info", "]", " ", "Vid", "eo", " ", "description", " ", "is", " ", "alr", "ead", "y", " ", "presen", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "description", "'_", ")_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "warning_", "(_", "'", "There", "\\\\'", "s", " ", "no", " ", "description", " ", "to", " ", "write", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "info", "]", " ", "Writ", "ing", " ", "video", " ", "description", " ", "to", ":", " ", "'_", "+_", "desc", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "io_", "._", "open_", "(_", "encode", "Filename_", "(_", "desc", "fn_", ")_", ",_", "'", "w", "'_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "as_", "desc", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "desc", "file_", "._", "write_", "(_", "info", "\\u", "dict_", "[_", "'", "description", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "report", "\\u", "error_", "(_", "'", "Cann", "ot", " ", "write", " ", "description", " ", "file", " ", "'_", "+_", "desc", "fn_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "writea", "nno", "tation", "s", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "anno", "fn_", "=_", "filename_", "+_", "'.", "annot", "ation", "s", ".", "xml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "noo", "ver", "writes", "'_", ",_", "False_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "encode", "Filename_", "(_", "anno", "fn_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "info", "]", " ", "Vid", "eo", " ", "annot", "ation", "s", " ", "are", " ", "alr", "ead", "y", " ", "presen", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "info", "]", " ", "Writ", "ing", " ", "video", " ", "annot", "ation", "s", " ", "to", ":", " ", "'_", "+_", "anno", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "io_", "._", "open_", "(_", "encode", "Filename_", "(_", "anno", "fn_", ")_", ",_", "'", "w", "'_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "as_", "anno", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "anno", "file_", "._", "write_", "(_", "info", "\\u", "dict_", "[_", "'", "annot", "ation", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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 ", " ", "_", "self_", "._", "report", "\\u", "warning_", "(_", "'", "There", " ", "are", " ", "no", " ", "annot", "ation", "s", " ", "to", " ", "write", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "report", "\\u", "error_", "(_", "'", "Cann", "ot", " ", "write", " ", "annot", "ation", "s", " ", "file", ":", " ", "'_", "+_", "anno", "fn_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subtit", "les", "\\u", "are", "\\u", "requested_", "=_", "any_", "(_", "[_", "self_", "._", "params_", "._", "get_", "(_", "'", "writes", "ub", "titles", "'_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "params_", "._", "get_", "(_", "'", "writea", "uto", "matics", "ub", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "subtit", "les", "\\u", "are", "\\u", "requested_", "and_", "'", "subtit", "les", "'_", "in_", "info", "\\u", "dict_", "and_", "info", "\\u", "dict_", "[_", "'", "subtit", "les", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "subtit", "les", " ", "download", " ", "error", "s", " ", "are", " ", "alr", "ead", "y", " ", "manage", "d", " ", "as", " ", "trouble", "s", " ", "in", " ", "rele", "van", "t", " ", "IE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "way", " ", "it", " ", "will", " ", "silently", " ", "go", " ", "on", " ", "whe", "n", " ", "used", " ", "with", " ", "unsup", "porti", "ng", " ", "IE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subtitles_", "=_", "info", "\\u", "dict_", "[_", "'", "subtit", "les", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub\\u", "format_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "subtit", "les", "format", "'_", ",_", "'", "srt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sub\\u", "lang_", "in_", "subtitles_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub_", "=_", "subtitles_", "[_", "sub\\u", "lang_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sub_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sub\\u", "filename_", "=_", "subtit", "les", "\\u", "filename_", "(_", "filename_", ",_", "sub\\u", "lang_", ",_", "sub\\u", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "noo", "ver", "writes", "'_", ",_", "False_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "encode", "Filename_", "(_", "sub\\u", "filename_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "info", "]", " ", "Vid", "eo", " ", "subtit", "le", " ", "%", "s", ".", "%", "s", " ", "is", " ", "alr", "ead", "y", "\\u", "presen", "t", "'_", "%_", "(_", "sub\\u", "lang_", ",_", "sub\\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 ", " ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "info", "]", " ", "Writ", "ing", " ", "video", " ", "subtit", "les", " ", "to", ":", " ", "'_", "+_", "sub\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "io_", "._", "open_", "(_", "encode", "Filename_", "(_", "sub\\u", "filename_", ")_", ",_", "'", "w", "'_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "as_", "subf", "ile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subf", "ile_", "._", "write_", "(_", "sub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "report", "\\u", "error_", "(_", "'", "Cann", "ot", " ", "write", " ", "subtit", "les", " ", "file", " ", "'_", "+_", "sub\\u", "filename_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "write", "info", "json", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "fn_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "filename_", ")_", "[_", "0_", "]_", "+_", "'.", "info", ".", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "noo", "ver", "writes", "'_", ",_", "False_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "encode", "Filename_", "(_", "info", "fn_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "info", "]", " ", "Vid", "eo", " ", "description", " ", "metadata", " ", "is", " ", "alr", "ead", "y", " ", "presen", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "info", "]", " ", "Writ", "ing", " ", "video", " ", "description", " ", "metadata", " ", "as", " ", "JSO", "N", " ", "to", ":", " ", "'_", "+_", "info", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "write", "\\u", "json", "\\u", "file_", "(_", "info", "\\u", "dict_", ",_", "info", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "report", "\\u", "error_", "(_", "'", "Cann", "ot", " ", "write", " ", "metadata", " ", "to", " ", "JSO", "N", " ", "file", " ", "'_", "+_", "info", "fn_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "writet", "hum", "bn", "ail", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "thumbnail", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thumb", "\\u", "format_", "=_", "dete", "rmin", "e\\u", "ext_", "(_", "info", "\\u", "dict_", "[_", "'", "thumbnail", "'_", "]_", ",_", "'", "jp", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thumb", "\\u", "filename_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "filename_", ")_", "[_", "0_", "]_", "+_", "'.'_", "+_", "thumb", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "noo", "ver", "writes", "'_", ",_", "False_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "encode", "Filename_", "(_", "thumb", "\\u", "filename_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "%", "s", "]", " ", "%", "s", ":", " ", "Thumb", "nail", " ", "is", " ", "alr", "ead", "y", " ", "presen", "t", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "info", "\\u", "dict_", "[_", "'", "extract", "or", "'_", "]_", ",_", "info", "\\u", "dict_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "%", "s", "]", " ", "%", "s", ":", " ", "Down", "load", "ing", " ", "thumbnail", " ", "...'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "info", "\\u", "dict_", "[_", "'", "extract", "or", "'_", "]_", ",_", "info", "\\u", "dict_", "[_", "'", "id", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "uf_", "=_", "self_", "._", "urlopen_", "(_", "info", "\\u", "dict_", "[_", "'", "thumbnail", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "thumb", "\\u", "filename_", ",_", "'", "wb", "'_", ")_", "as_", "thumb", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "shutil_", "._", "copy", "fileobj_", "(_", "uf_", ",_", "thumb", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "%", "s", "]", " ", "%", "s", ":", " ", "Writ", "ing", " ", "thumbnail", " ", "to", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "info", "\\u", "dict_", "[_", "'", "extract", "or", "'_", "]_", ",_", "info", "\\u", "dict_", "[_", "'", "id", "'_", "]_", ",_", "thumb", "\\u", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "compa", "t", "\\u", "url", "lib", "\\u", "error_", "._", "URL", "Error_", ",_", "compa", "t", "\\u", "http", "\\u", "client_", "._", "HTTP", "Exception_", ",_", "socket_", "._", "error_", ")_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "report", "\\u", "warning_", "(_", "'", "Una", "ble", " ", "to", " ", "download", " ", "thumbnail", " ", "\"%", "s", "\":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "info", "\\u", "dict_", "[_", "'", "thumbnail", "'_", "]_", ",_", "compa", "t", "\\u", "str_", "(_", "err_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "params_", "._", "get_", "(_", "'", "skip", "\\u", "download", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "dl_", "(_", "name_", ",_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fd_", "=_", "get", "\\u", "suit", "able", "\\u", "downloader_", "(_", "info_", ")_", "(_", "self_", ",_", "self_", "._", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ph_", "in_", "self_", "._", "\\u", "progress", "\\u", "hooks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fd_", "._", "add", "\\u", "progress", "\\u", "hook_", "(_", "ph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "verbo", "se", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "to", "\\u", "stdout_", "(_", "'[", "debug", "]", " ", "Invok", "ing", " ", "downloader", " ", "on", " ", "%", "r", "'_", "%_", "info_", "._", "get_", "(_", "'", "url", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fd_", "._", "download_", "(_", "name_", ",_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "request", "ed", "\\u", "formats", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "downloaded_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merger", "_", "=_", "FF", "mpeg", "Merge", "r", "PP", "_", "(_", "self_", ",_", "not_", "self_", "._", "params_", "._", "get_", "(_", "'", "keep", "video", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "merger", "_", "._", "\\u", "executable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "postprocess", "ors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "report", "\\u", "warning_", "(_", "'", "You", " ", "have", " ", "request", "ed", " ", "multiple", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "formats", " ", "but", " ", "ffmpeg", " ", "or", " ", "avc", "onv", " ", "are", " ", "not", " ", "install", "ed", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "The", " ", "formats", " ", "won", "\\\\'", "t", " ", "be", " ", "merge", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "postprocess", "ors_", "=_", "[_", "merger", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "f_", "in_", "info", "\\u", "dict_", "[_", "'", "request", "ed", "\\u", "formats", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "new", "\\u", "info_", "=_", "dict_", "(_", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "info_", "._", "update_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname_", "=_", "self_", "._", "prepar", "e\\u", "filename_", "(_", "new", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname_", "=_", "prepend", "\\u", "extension_", "(_", "fname_", ",_", "'", "f", "%", "s", "'_", "%_", "f_", "[_", "'", "format\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "downloaded_", "._", "append_", "(_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "partial", "\\u", "success_", "=_", "dl_", "(_", "fname_", ",_", "new", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "success_", "and_", "partial", "\\u", "success_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info", "\\u", "dict_", "[_", "'\\u", "\\u", "postprocess", "ors", "'_", "]_", "=_", "postprocess", "ors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "\\u", "dict_", "[_", "'\\u", "\\u", "files", "\\u", "to", "\\u", "merge", "'_", "]_", "=_", "downloaded_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "a", " ", "single", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "success_", "=_", "dl_", "(_", "filename_", ",_", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "compa", "t", "\\u", "url", "lib", "\\u", "error_", "._", "URL", "Error_", ",_", "compa", "t", "\\u", "http", "\\u", "client_", "._", "HTTP", "Exception_", ",_", "socket_", "._", "error_", ")_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "error_", "(_", "'", "una", "ble", " ", "to", " ", "download", " ", "video", " ", "data", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "OSE", "rror_", ",_", "IO", "Error_", ")_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Una", "vail", "able", "Vid", "eo", "Error_", "(_", "err_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Conten", "t", "Too", "Short", "Error_", ",_", ")_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "error_", "(_", "'", "content", " ", "too", " ", "short", " ", "(", "expected", " ", "%", "s", " ", "bytes", " ", "and", " ", "serve", "d", " ", "%", "s", ")'_", "%_", "(_", "err_", "._", "expected_", ",_", "err_", "._", "downloaded_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fix", "up", " ", "content_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stretch", "ed", "\\u", "ratio_", "=_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "stretch", "ed", "\\u", "ratio", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stretch", "ed", "\\u", "ratio_", "is_", "not_", "None_", "and_", "stretch", "ed", "\\u", "ratio_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fixup", "\\u", "policy_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "fixup", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fixup", "\\u", "policy_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fixup", "\\u", "policy_", "=_", "'", "detect", "\\u", "or", "\\u", "warn", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fixup", "\\u", "policy_", "==_", "'", "warn", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "report", "\\u", "warning_", "(_", "'%", "s", ":", " ", "Non", "-", "uniform", " ", "pixel", " ", "ratio", " ", "(%", "s", ")'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "info", "\\u", "dict_", "[_", "'", "id", "'_", "]_", ",_", "stretch", "ed", "\\u", "ratio_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fixup", "\\u", "policy_", "==_", "'", "detect", "\\u", "or", "\\u", "warn", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "stretch", "ed", "\\u", "pp_", "=_", "FF", "mpeg", "Fix", "up", "Stre", "tche", "d", "PP", "_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stretch", "ed", "\\u", "pp_", "._", "available_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "info", "\\u", "dict_", "._", "setdefault_", "(_", "'\\u", "\\u", "postprocess", "ors", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info", "\\u", "dict_", "[_", "'\\u", "\\u", "postprocess", "ors", "'_", "]_", "._", "append_", "(_", "stretch", "ed", "\\u", "pp_", ")_", "\\u\\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_", "._", "report", "\\u", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ":", " ", "Non", "-", "uniform", " ", "pixel", " ", "ratio", " ", "(%", "s", ").", " ", "Install", " ", "ffmpeg", " ", "or", " ", "avc", "onv", " ", "to", " ", "fix", " ", "this", " ", "automati", "call", "y", ".'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "info", "\\u", "dict_", "[_", "'", "id", "'_", "]_", ",_", "stretch", "ed", "\\u", "ratio_", ")_", ")_", "\\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 ", " ", " _", "assert_", "fixup", "\\u", "policy_", "==_", "'", "ignore", "'_", "\\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 ", " ", "_", "self_", "._", "post", "\\u", "process_", "(_", "filename_", ",_", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Post", "Process", "ing", "Error_", ")_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "report", "\\u", "error_", "(_", "'", "postprocess", "ing", ":", " ", "%", "s", "'_", "%_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "record", "\\u", "download", "\\u", "archive_", "(_", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "download_", "(_", "self_", ",_", "url", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Down", "load", " ", "a", " ", "give", "n", " ", "list", " ", "of", " ", "URL", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outt", "mpl_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "outt", "mpl", "'_", ",_", "DEF", "AUL", "T", "\\u", "OUT", "TMP", "L_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "url", "\\u", "list_", ")_", ">_", "1_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'%'_", "not_", "in_", "outt", "mpl_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "params_", "._", "get_", "(_", "'", "max", "\\u", "download", "s", "'_", ")_", "!=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sam", "e", "File", "Error_", "(_", "outt", "mpl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "url_", "in_", "url", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", " ", "als", "o", " ", "download", "s", " ", "the", " ", "videos_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "extract", "\\u", "info_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Una", "vail", "able", "Vid", "eo", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "error_", "(_", "'", "una", "ble", " ", "to", " ", "download", " ", "video", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Max", "Down", "load", "s", "Reach", "ed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "info", "]", " ", "Maxim", "um", " ", "number", " ", "of", " ", "download", "ed", " ", "files", " ", "reache", "d", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "dump", "\\u", "single", "\\u", "json", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "to", "\\u", "stdout_", "(_", "json_", "._", "dumps_", "(_", "res_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "download", "\\u", "retcode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download", "\\u", "with", "\\u", "info", "\\u", "file_", "(_", "self_", ",_", "info", "\\u", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "io_", "._", "open_", "(_", "info", "\\u", "filename_", ",_", "'", "r", "'_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "json_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "process", "\\u", "ie", "\\u", "result_", "(_", "info_", ",_", "download_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Down", "load", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "webpage", "\\u", "url_", "=_", "info_", "._", "get_", "(_", "'", "webpage", "\\u", "url", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "webpage", "\\u", "url_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "warning_", "(_", "'", "The", " ", "info", " ", "fail", "ed", " ", "to", " ", "download", ",", " ", "try", "ing", " ", "with", " ", "\"%", "s", "\"'_", "%_", "webpage", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "download_", "(_", "[_", "webpage", "\\u", "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 ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "download", "\\u", "retcode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "process_", "(_", "self_", ",_", "filename_", ",_", "ie", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "all", " ", "the", " ", "postprocess", "ors", " ", "on", " ", "the", " ", "give", "n", " ", "file", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "dict_", "(_", "ie", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "[_", "'", "filepath", "'_", "]_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pps", "\\u", "chain_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ie", "\\u", "info_", "._", "get_", "(_", "'\\u", "\\u", "postprocess", "ors", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pps", "\\u", "chain_", "._", "extend_", "(_", "ie", "\\u", "info_", "[_", "'\\u", "\\u", "postprocess", "ors", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pps", "\\u", "chain_", "._", "extend_", "(_", "self_", "._", "\\u", "pps", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "pp_", "in_", "pps", "\\u", "chain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keep", "\\u", "video_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "filename_", "=_", "info_", "[_", "'", "filepath", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keep", "\\u", "video", "\\u", "wish", "_", ",_", "info_", "=_", "pp_", "._", "run_", "(_", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "keep", "\\u", "video", "\\u", "wish", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "keep", "\\u", "video", "\\u", "wish", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "keep", "\\u", "video_", "=_", "keep", "\\u", "video", "\\u", "wish", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "keep", "\\u", "video_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "clear", " ", "decision", " ", "ye", "t", ",", " ", "let", " ", "IE", " ", "decide", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "keep", "\\u", "video_", "=_", "keep", "\\u", "video", "\\u", "wish", "_", "\\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_", "Post", "Process", "ing", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "error_", "(_", "e_", "._", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "keep", "\\u", "video_", "is_", "False_", "and_", "not_", "self_", "._", "params_", "._", "get_", "(_", "'", "keep", "video", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "to", "\\u", "screen_", "(_", "'", "Del", "eti", "ng", " ", "original", " ", "file", " ", "%", "s", " ", "(", "pass", " ", "-", "k", " ", "to", " ", "keep", ")'_", "%_", "old", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "encode", "Filename_", "(_", "old", "\\u", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "IO", "Error_", ",_", "OSE", "rror_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "report", "\\u", "warning_", "(_", "'", "Una", "ble", " ", "to", " ", "remove", " ", "download", "ed", " ", "video", " ", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "make", "\\u", "archive", "\\u", "id_", "(_", "self_", ",_", "info", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fu", "ture", "-", "proof", " ", "against", " ", "any", " ", "change", " ", "in", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "back", "ward", "s", " ", "compatibility", " ", "with", " ", "prior", " ", "versions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extractor_", "=_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "extract", "or", "\\u", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "extractor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "id", "'_", "in_", "info", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extractor_", "=_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "ie", "\\u", "key", "'_", ")_", "#", " ", "key", " ", "in", " ", "a", " ", "playlist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extractor_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "#", " ", "Incomp", "lete", " ", "video", " ", "information_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "extractor_", "._", "lower_", "(_", ")_", "+_", "'", " ", "'_", "+_", "info", "\\u", "dict_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "in", "\\u", "download", "\\u", "archive_", "(_", "self_", ",_", "info", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fn_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "download", "\\u", "archive", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fn_", "is_", "None_", ":_", "\\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_", "vid", "\\u", "id_", "=_", "self_", "._", "\\u", "make", "\\u", "archive", "\\u", "id_", "(_", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "vid", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "#", " ", "Incomp", "lete", " ", "video", " ", "information_", "\\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 ", " _", "with_", "lock", "ed", "\\u", "file_", "(_", "fn_", ",_", "'", "r", "'_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "as_", "archive", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "archive", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "line_", "._", "strip_", "(_", ")_", "==_", "vid", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", "as_", "io", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "io", "e_", "._", "errno_", "!=_", "errno_", "._", "ENOENT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "record", "\\u", "download", "\\u", "archive_", "(_", "self_", ",_", "info", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fn_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "download", "\\u", "archive", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fn_", "is_", "None_", ":_", "\\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_", "vid", "\\u", "id_", "=_", "self_", "._", "\\u", "make", "\\u", "archive", "\\u", "id_", "(_", "info", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "vid", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "lock", "ed", "\\u", "file_", "(_", "fn_", ",_", "'", "a", "'_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "as_", "archive", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "archive", "\\u", "file_", "._", "write_", "(_", "vid", "\\u", "id_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "format\\u", "resolution_", "(_", "format_", ",_", "default_", "=_", "'", "unknown", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "format_", "._", "get_", "(_", "'", "vco", "dec", "'_", ")_", "==_", "'", "none", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "audio", " ", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "format_", "._", "get_", "(_", "'", "resolu", "tion", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "format_", "[_", "'", "resolu", "tion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "format_", "._", "get_", "(_", "'", "height", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "format_", "._", "get_", "(_", "'", "widt", "h", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "'%", "sx", "%", "s", "'_", "%_", "(_", "format_", "[_", "'", "widt", "h", "'_", "]_", ",_", "format_", "[_", "'", "height", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "'%", "sp", "'_", "%_", "format_", "[_", "'", "height", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "format_", "._", "get_", "(_", "'", "widt", "h", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "'?", "x", "%", "d", "'_", "%_", "format_", "[_", "'", "widt", "h", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "format\\u", "note_", "(_", "self_", ",_", "fdi", "ct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fdi", "ct_", "._", "get_", "(_", "'", "ext", "'_", ")_", "in_", "[_", "'", "f4", "f", "'_", ",_", "'", "f4", "m", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "'(", "unsup", "porte", "d", ")", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fdi", "ct_", "._", "get_", "(_", "'", "format\\u", "note", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "fdi", "ct_", "[_", "'", "format\\u", "note", "'_", "]_", "+_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fdi", "ct_", "._", "get_", "(_", "'", "tb", "r", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "'%", "4d", "k", " ", "'_", "%_", "fdi", "ct_", "[_", "'", "tb", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fdi", "ct_", "._", "get_", "(_", "'", "container", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "',", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "+=_", "'%", "s", " ", "container", "'_", "%_", "fdi", "ct_", "[_", "'", "container", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "fdi", "ct_", "._", "get_", "(_", "'", "vco", "dec", "'_", ")_", "is_", "not_", "None_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "fdi", "ct_", "._", "get_", "(_", "'", "vco", "dec", "'_", ")_", "!=_", "'", "none", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "',", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "+=_", "fdi", "ct_", "[_", "'", "vco", "dec", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fdi", "ct_", "._", "get_", "(_", "'", "vbr", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "'@'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fdi", "ct_", "._", "get_", "(_", "'", "vbr", "'_", ")_", "is_", "not_", "None_", "and_", "fdi", "ct_", "._", "get_", "(_", "'", "abr", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "'", "video", "@'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fdi", "ct_", "._", "get_", "(_", "'", "vbr", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "'%", "4d", "k", "'_", "%_", "fdi", "ct_", "[_", "'", "vbr", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fdi", "ct_", "._", "get_", "(_", "'", "fp", "s", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "',", " ", "%", "sf", "ps", "'_", "%_", "fdi", "ct_", "[_", "'", "fp", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fdi", "ct_", "._", "get_", "(_", "'", "acode", "c", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "',", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fdi", "ct_", "[_", "'", "acode", "c", "'_", "]_", "==_", "'", "none", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "'", "video", " ", "only", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "'%", "-", "5", "s", "'_", "%_", "fdi", "ct_", "[_", "'", "acode", "c", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fdi", "ct_", "._", "get_", "(_", "'", "abr", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "',", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "+=_", "'", "audio", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fdi", "ct_", "._", "get_", "(_", "'", "abr", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "'@", "%", "3d", "k", "'_", "%_", "fdi", "ct_", "[_", "'", "abr", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fdi", "ct_", "._", "get_", "(_", "'", "as", "r", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "'", " ", "(%", "5d", "H", "z", ")'_", "%_", "fdi", "ct_", "[_", "'", "as", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fdi", "ct_", "._", "get_", "(_", "'", "files", "ize", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "',", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "+=_", "format\\u", "bytes_", "(_", "fdi", "ct_", "[_", "'", "files", "ize", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "fdi", "ct_", "._", "get_", "(_", "'", "files", "ize", "\\u", "approx", "'_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "+=_", "',", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "+=_", "'~'_", "+_", "format\\u", "bytes_", "(_", "fdi", "ct_", "[_", "'", "files", "ize", "\\u", "approx", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list", "\\u", "formats_", "(_", "self_", ",_", "info", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "line_", "(_", "format_", ",_", "idle", "n_", "=_", "20_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "(_", "'%", "-'_", "+_", "compa", "t", "\\u", "str_", "(_", "idle", "n_", "+_", "1_", ")_", "+_", "'", "s", "%", "-1", "0", "s", "%", "-1", "2s", "%", "s", "'_", ")_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "format_", "[_", "'", "format\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format_", "[_", "'", "ext", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "format\\u", "resolution_", "(_", "format_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "format\\u", "note_", "(_", "format_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "formats_", "=_", "info", "\\u", "dict_", "._", "get_", "(_", "'", "formats", "'_", ",_", "[_", "info", "\\u", "dict_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idle", "n_", "=_", "max_", "(_", "len_", "(_", "'", "format", " ", "code", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max_", "(_", "len_", "(_", "f_", "[_", "'", "format\\u", "id", "'_", "]_", ")_", "for_", "f_", "in_", "formats_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats", "\\u", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "line_", "(_", "f_", ",_", "idle", "n_", ")_", "for_", "f_", "in_", "formats_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "f_", "._", "get_", "(_", "'", "preference", "'_", ")_", "is_", "None_", "or_", "f_", "[_", "'", "preference", "'_", "]_", ">=_", "-_", "1000_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "formats_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formats", "\\u", "s_", "[_", "0_", "]_", "+=_", "(_", "'", " ", "'_", "if_", "self_", "._", "\\u", "format\\u", "note_", "(_", "formats_", "[_", "0_", "]_", ")_", "else_", "''_", ")_", "+_", "'(", "worst", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats", "\\u", "s_", "[_", "-_", "1_", "]_", "+=_", "(_", "'", " ", "'_", "if_", "self_", "._", "\\u", "format\\u", "note_", "(_", "formats_", "[_", "-_", "1_", "]_", ")_", "else_", "''_", ")_", "+_", "'(", "best", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header", "\\u", "line_", "=_", "line_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format\\u", "id", "'_", ":_", "'", "format", " ", "code", "'_", ",_", "'", "ext", "'_", ":_", "'", "extensi", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resolu", "tion", "'_", ":_", "'", "resolu", "tion", "'_", ",_", "'", "format\\u", "note", "'_", ":_", "'", "note", "'_", "}_", ",_", "idle", "n_", "=_", "idle", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "to", "\\u", "screen_", "(_", "'[", "info", "]", " ", "Avail", "able", " ", "formats", " ", "for", " ", "%", "s", ":\\\\", "n", "%", "s", "\\\\", "n", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "info", "\\u", "dict_", "[_", "'", "id", "'_", "]_", ",_", "header", "\\u", "line_", ",_", "'\\\\", "n", "'_", "._", "join_", "(_", "formats", "\\u", "s_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "urlopen_", "(_", "self_", ",_", "req_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Start", " ", "an", " ", "HTTP", " ", "download", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Acco", "rdin", "g", " ", "to", " ", "RF", "C", " ", "398", "6", ",", " ", "URL", "s", " ", "can", " ", "not", " ", "contain", " ", "non", "-", "ASCII", " ", "character", "s", ",", " ", "how", "ever", " ", "this", " ", "is", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alw", "ay", "s", " ", "respec", "ted", " ", "by", " ", "webs", "ites", ",", " ", "some", " ", "tend", " ", "to", " ", "give", " ", "out", " ", "URL", "s", " ", "with", " ", "non", " ", "percent", "-", "encoded_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "ASCII", " ", "character", "s", " ", "(", "see", " ", "tele", "mb", ".", "py", ",", " ", "ard", ".", "py", " ", "[", "#", "341", "2", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "url", "lib", " ", "cho", "kes", " ", "on", " ", "URL", "s", " ", "with", " ", "non", "-", "ASCII", " ", "character", "s", " ", "(", "see", " ", "http", "://", "bug", "s", ".", "python", ".", "org", "/", "issue", "399", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "work", " ", "aro", "und", " ", "af", "ore", "mentioned", " ", "issue", " ", "we", " ", "will", " ", "replace", " ", "request", "'", "s", " ", "original", " ", "URL", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "percent", "-", "encode", "d", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "req", "\\u", "is", "\\u", "string_", "=_", "isinstance_", "(_", "req_", ",_", "basestring_", "if_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "3_", ",_", "0_", ")_", "else_", "compa", "t", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "req_", "if_", "req", "\\u", "is", "\\u", "string_", "else_", "req_", "._", "get", "\\u", "full", "\\u", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "\\u", "escaped", "_", "=_", "escape", "\\u", "url_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Subst", "itut", "e", " ", "URL", " ", "if", " ", "any", " ", "change", " ", "after", " ", "esca", "ping_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "url_", "!=_", "url", "\\u", "escaped", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "req", "\\u", "is", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "url", "\\u", "escaped", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "compa", "t", "\\u", "url", "lib", "\\u", "request_", "._", "Request_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url", "\\u", "escaped", "_", ",_", "data_", "=_", "req_", "._", "data_", ",_", "headers_", "=_", "req_", "._", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "orig", "in", "\\u", "req", "\\u", "host_", "=_", "req_", "._", "orig", "in", "\\u", "req", "\\u", "host_", ",_", "unver", "ifi", "able_", "=_", "req_", "._", "unver", "ifi", "able_", ")_", "\\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_", "self_", "._", "\\u", "opener_", "._", "open_", "(_", "req_", ",_", "timeout_", "=_", "self_", "._", "\\u", "socket", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "print", "\\u", "debug", "\\u", "header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "params_", "._", "get_", "(_", "'", "verbo", "se", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "''_", ")_", "is_", "not_", "compa", "t", "\\u", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.6", " ", "on", " ", "SL", "ES", "11", " ", "SP", "1", " ", "(", "https", "://", "git", "hub", ".", "com", "/", "rg", "3", "/", "youtu", "be", "-", "dl", "/", "issue", "s", "/", "332", "6", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", "r", " ", "Pyth", "on", " ", "is", " ", "broken", "!", " ", "Update", " ", "to", " ", "a", " ", "newe", "r", " ", "and", " ", "support", "ed", " ", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stdout", "\\u", "encoding_", "=_", "getattr_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "stdout_", ",_", "'", "encoding", "'_", ",_", "'", "missi", "ng", " ", "(%", "s", ")'_", "%_", "type_", "(_", "sys_", "._", "stdout_", ")_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoding", "\\u", "str_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'[", "debug", "]", " ", "Enco", "dings", ":", " ", "locale", " ", "%", "s", ",", " ", "fs", " ", "%", "s", ",", " ", "out", " ", "%", "s", ",", " ", "pref", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "locale_", "._", "getpr", "efer", "rede", "nco", "ding_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "getfile", "system", "encoding_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout", "\\u", "encoding_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "encoding_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "string_", "(_", "encoding", "\\u", "str_", ",_", "encoding_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "string_", "(_", "'[", "debug", "]", " ", "youtu", "be", "-", "dl", " ", "version", " ", "'_", "+_", "\\u\\u", "version\\u\\u_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sp_", "=_", "subprocess_", "._", "Popen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "git", "'_", ",_", "'", "rev", "-", "parse", "'_", ",_", "'--", "short", "'_", ",_", "'", "HEAD", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", ",_", "err_", "=_", "sp_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "out_", "._", "decode_", "(_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "'[", "0", "-", "9", "a", "-", "f", "]+'_", ",_", "out_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "string_", "(_", "'[", "debug", "]", " ", "Git", " ", "HEAD", ":", " ", "'_", "+_", "out_", "+_", "'\\\\", "n", "'_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exc", "\\u", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "string_", "(_", "'[", "debug", "]", " ", "Pyth", "on", " ", "version", " ", "%", "s", " ", "-", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "platform_", "._", "python", "\\u", "version_", "(_", ")_", ",_", "platform", "\\u", "name_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exe", "\\u", "versions_", "=_", "FF", "mpeg", "Post", "Processor_", "._", "get", "\\u", "versions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exe", "\\u", "versions_", "[_", "'", "rtmp", "dump", "'_", "]_", "=_", "rtmp", "dump", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exe", "\\u", "str_", "=_", "',", " ", "'_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "exe_", ",_", "v_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "exe_", ",_", "v_", "in_", "sorted_", "(_", "exe", "\\u", "versions_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "v_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "exe", "\\u", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exe", "\\u", "str_", "=_", "'", "none", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "string_", "(_", "'[", "debug", "]", " ", "exe", " ", "version", "s", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "exe", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proxy", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "handler_", "in_", "self_", "._", "\\u", "opener_", "._", "handlers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "handler_", ",_", "'", "prox", "ies", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proxy", "\\u", "map_", "._", "update_", "(_", "handler_", "._", "proxies_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "string_", "(_", "'[", "debug", "]", " ", "Pro", "xy", " ", "map", ":", " ", "'_", "+_", "compa", "t", "\\u", "str_", "(_", "proxy", "\\u", "map_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "call", "\\u", "home", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipaddr_", "=_", "self_", "._", "urlopen_", "(_", "'", "https", "://", "yt", "-", "dl", ".", "org", "/", "ip", "'_", ")_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "string_", "(_", "'[", "debug", "]", " ", "Public", " ", "IP", " ", "address", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "ipaddr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "late", "st", "\\u", "version_", "=_", "self_", "._", "urlopen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "https", "://", "yt", "-", "dl", ".", "org", "/", "late", "st", "/", "version", "'_", ")_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "version", "\\u", "tuple_", "(_", "late", "st", "\\u", "version_", ")_", ">_", "version", "\\u", "tuple_", "(_", "\\u\\u", "version\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "report", "\\u", "warning_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", " ", "are", " ", "usi", "ng", " ", "an", " ", "outdate", "d", " ", "version", " ", "(", "newest", " ", "version", ":", " ", "%", "s", ")!", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "See", " ", "https", "://", "yt", "-", "dl", ".", "org", "/", "update", " ", "if", " ", "you", " ", "need", " ", "help", " ", "updat", "ing", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "late", "st", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "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_", "\\u", "setup", "\\u", "opener_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeo", "ut", "\\u", "val_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "socket", "\\u", "timeo", "ut", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "socket", "\\u", "timeout_", "=_", "600_", "if_", "timeo", "ut", "\\u", "val_", "is_", "None_", "else_", "float_", "(_", "timeo", "ut", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "opts", "\\u", "cookie", "file_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "cookie", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts", "\\u", "proxy_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "proxy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "opts", "\\u", "cookie", "file_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cookie", "jar_", "=_", "compa", "t", "\\u", "cookie", "jar_", "._", "Cooki", "e", "Jar_", "(_", ")_", "\\u\\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_", "._", "cookie", "jar_", "=_", "compa", "t", "\\u", "cookie", "jar_", "._", "Mo", "zilla", "Cooki", "e", "Jar_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "opts", "\\u", "cookie", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "access_", "(_", "opts", "\\u", "cookie", "file_", ",_", "os_", "._", "R", "\\u", "OK_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cookie", "jar_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cookie", "\\u", "processor_", "=_", "compa", "t", "\\u", "url", "lib", "\\u", "request_", "._", "HTTP", "Cooki", "e", "Processor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cookie", "jar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opts", "\\u", "proxy_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opts", "\\u", "proxy_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proxies_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proxies_", "=_", "{_", "'", "http", "'_", ":_", "opts", "\\u", "proxy_", ",_", "'", "https", "'_", ":_", "opts", "\\u", "proxy_", "}_", "\\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 ", " _", "proxies_", "=_", "compa", "t", "\\u", "url", "lib", "\\u", "request_", "._", "getpr", "oxi", "es_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "HTTP", "S", " ", "proxy", " ", "to", " ", "HTTP", " ", "one", " ", "if", " ", "give", "n", " ", "(", "https", "://", "git", "hub", ".", "com", "/", "rg", "3", "/", "youtu", "be", "-", "dl", "/", "issue", "s", "/", "805", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "http", "'_", "in_", "proxies_", "and_", "'", "https", "'_", "not_", "in_", "proxies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proxies_", "[_", "'", "https", "'_", "]_", "=_", "proxies_", "[_", "'", "http", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proxy", "\\u", "handler_", "=_", "compa", "t", "\\u", "url", "lib", "\\u", "request_", "._", "Pro", "xy", "Handler_", "(_", "proxies_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "debugl", "evel_", "=_", "1_", "if_", "self_", "._", "params_", "._", "get_", "(_", "'", "debug", "\\u", "print", "traffic", "'_", ")_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "https", "\\u", "handler_", "=_", "make", "\\u", "HTTP", "S", "\\u", "handler_", "(_", "self_", "._", "params_", ",_", "debugl", "evel_", "=_", "debugl", "evel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yd", "lh", "_", "=_", "You", "tube", "DL", "Handler_", "(_", "self_", "._", "params_", ",_", "debugl", "evel_", "=_", "debugl", "evel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opener_", "=_", "compa", "t", "\\u", "url", "lib", "\\u", "request_", "._", "build", "\\u", "opener_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "https", "\\u", "handler_", ",_", "proxy", "\\u", "handler_", ",_", "cookie", "\\u", "processor_", ",_", "yd", "lh", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Delete", " ", "the", " ", "default", " ", "user", "-", "agent", " ", "header", ",", " ", "whi", "ch", " ", "wou", "ld", " ", "other", "wis", "e", " ", "appl", "y", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", "s", " ", "where", " ", "our", " ", "custom", " ", "HTTP", " ", "handler", " ", "doe", "sn", "'", "t", " ", "come", " ", "int", "o", " ", "play_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "See", " ", "https", "://", "git", "hub", ".", "com", "/", "rg", "3", "/", "youtu", "be", "-", "dl", "/", "issue", "s", "/", "130", "9", " ", "for", " ", "deta", "il", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "opener_", "._", "add", "headers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "opener_", "=_", "opener_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "encode_", "(_", "self_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "s_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "#", " ", "Al", "read", "y", " ", "encoded_", "\\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 ", " _", "return_", "s_", "._", "encode_", "(_", "self_", "._", "get", "\\u", "encoding_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Encode", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "._", "reason_", "=_", "err_", "._", "reason_", "+_", "'.", " ", "Check", " ", "your", " ", "system", " ", "encoding", " ", "configura", "tion", " ", "or", " ", "use", " ", "the", " ", "--", "encoding", " ", "option", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "You", "tube", "DL_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "encoding_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoding_", "=_", "self_", "._", "params_", "._", "get_", "(_", "'", "encoding", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "encoding_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoding_", "=_", "prefer", "rede", "nco", "ding_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "encoding_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
sunlightlabs/read_FEC/fecreader/reconciliation/fec_reconciler.py
[ { "content": "def hash_lookup(name, state=None, office=None, cycle=None):\n result_array = []\n print \"1. running hash lookup with name='%s' and cycle='%s' and state='%s' office='%s'\" % (name, cycle, state, office)\n # try to short circuit with the alias table. For now we're using a default cycle--but maybe we should only do this when a cycle is present ?\n # Again, cycle is a string. \n hashname = str(name).upper().strip().strip('\"')\n print \"Hash lookup name = %s\" % (hashname)\n if cycle and len(str(cycle)) > 3:\n hash_lookup_cycle = str(cycle)\n else:\n hash_lookup_cycle = default_cycle\n \n # Our lookup hash is only for 2012 for now, so... \n # This doesn't address bootstrapping 2012 lookups for 2014...\n\n ### Need to cleanly remove this logic for multicycle\n if hash_lookup_cycle==default_cycle:\n \n try:\n found_candidate = candidate_hash[hash_lookup_cycle][hashname]\n except KeyError:\n return None\n if found_candidate:\n valid_candidate = True\n \n # If we have additional identifiers, insure that they're right. \n if office and len(office) > 0:\n if office.upper()[:1] != found_candidate['cand_office'].upper()[:1]:\n valid_candidate = False\n \n # ignore states for president.\n if state and len(state) > 1:\n if state.upper() != found_candidate['cand_office_st']:\n if office and office.upper()[:1] == 'P':\n pass\n else:\n valid_candidate = False\n \n if valid_candidate:\n name_standardized = standardize_name_from_dict(found_candidate)\n \n result_array.append({'name':name_standardized, 'id':found_candidate['cand_id'], 'score':1, 'type':[], 'match':True})\n return result_array\n return None", "metadata": "root.hash_lookup", "header": "['module', '___EOS___']", "index": 98 } ]
[]
[]
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_", "hash", "\\u", "lookup_", "(_", "name_", ",_", "state_", "=_", "None_", ",_", "office", "_", "=_", "None_", ",_", "cycle_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result", "\\u", "array_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "1", ".", " ", "runn", "ing", " ", "hash", " ", "look", "up", " ", "with", " ", "name", "='", "%", "s", "'", " ", "and", " ", "cycle", "='", "%", "s", "'", " ", "and", " ", "state", "='", "%", "s", "'", " ", "office", "='", "%", "s", "'\"_", "%_", "(_", "name_", ",_", "cycle_", ",_", "state_", ",_", "office", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "short", " ", "circuit", " ", "with", " ", "the", " ", "alias", " ", "table", ".", " ", "For", " ", "now", " ", "we", "'", "re", " ", "usi", "ng", " ", "a", " ", "default", " ", "cycle", "--", "but", " ", "may", "be", " ", "we", " ", "shou", "ld", " ", "only", " ", "do", " ", "this", " ", "whe", "n", " ", "a", " ", "cycle", " ", "is", " ", "presen", "t", " ", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Again", ",", " ", "cycle", " ", "is", " ", "a", " ", "string", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "hash", "name_", "=_", "str_", "(_", "name_", ")_", "._", "upper_", "(_", ")_", "._", "strip_", "(_", ")_", "._", "strip_", "(_", "'\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Hash", " ", "look", "up", " ", "name", " ", "=", " ", "%", "s", "\"_", "%_", "(_", "hash", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cycle_", "and_", "len_", "(_", "str_", "(_", "cycle_", ")_", ")_", ">_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hash", "\\u", "look", "up", "\\u", "cycle_", "=_", "str_", "(_", "cycle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hash", "\\u", "look", "up", "\\u", "cycle_", "=_", "default", "\\u", "cycle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ou", "r", " ", "look", "up", " ", "hash", " ", "is", " ", "only", " ", "for", " ", "2012", " ", "for", " ", "now", ",", " ", "so", "...", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "doe", "sn", "'", "t", " ", "address", " ", "bootstrapp", "ing", " ", "2012", " ", "lookups", " ", "for", " ", "2014", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Ne", "ed", " ", "to", " ", "clean", "ly", " ", "remove", " ", "this", " ", "logic", " ", "for", " ", "multic", "ycle", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hash", "\\u", "look", "up", "\\u", "cycle_", "==_", "default", "\\u", "cycle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "\\u", "candidate_", "=_", "candidate", "\\u", "hash_", "[_", "hash", "\\u", "look", "up", "\\u", "cycle_", "]_", "[_", "hash", "name_", "]_", "\\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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "found", "\\u", "candidate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid", "\\u", "candidate_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "have", " ", "addition", "al", " ", "identifi", "ers", ",", " ", "insu", "re", " ", "tha", "t", " ", "the", "y", "'", "re", " ", "right", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "office", "_", "and_", "len_", "(_", "office", "_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "office", "_", "._", "upper_", "(_", ")_", "[_", ":_", "1_", "]_", "!=_", "found", "\\u", "candidate_", "[_", "'", "cand", "\\u", "office", "'_", "]_", "._", "upper_", "(_", ")_", "[_", ":_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "valid", "\\u", "candidate_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ignore", " ", "state", "s", " ", "for", " ", "presi", "dent", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "and_", "len_", "(_", "state_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "state_", "._", "upper_", "(_", ")_", "!=_", "found", "\\u", "candidate_", "[_", "'", "cand", "\\u", "office", "\\u", "st", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "office", "_", "and_", "office", "_", "._", "upper_", "(_", ")_", "[_", ":_", "1_", "]_", "==_", "'", "P", "'_", ":_", "\\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 ", " ", " _", "valid", "\\u", "candidate_", "=_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "valid", "\\u", "candidate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "standardize", "d_", "=_", "standardize", "\\u", "name", "\\u", "from", "\\u", "dict_", "(_", "found", "\\u", "candidate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result", "\\u", "array_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name", "\\u", "standardize", "d_", ",_", "'", "id", "'_", ":_", "found", "\\u", "candidate_", "[_", "'", "cand", "\\u", "id", "'_", "]_", ",_", "'", "score", "'_", ":_", "1_", ",_", "'", "type", "'_", ":_", "[_", "]_", ",_", "'", "match", "'_", ":_", "True_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result", "\\u", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
mozilla/kitsune/kitsune/questions/tests/__init__.py
[ { "content": "class AnswerFactory(factory.DjangoModelFactory):\n class Meta:\n model = Answer\n\n content = FuzzyUnicode()\n created = factory.LazyAttribute(lambda a: datetime.now())\n creator = factory.SubFactory(UserFactory)\n question = factory.SubFactory(QuestionFactory)", "metadata": "root.AnswerFactory", "header": "['module', '___EOS___']", "index": 73 } ]
[]
[]
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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Answer", "Factory_", "(_", "factory_", "._", "Dj", "ang", "o", "Model", "Factory_", ")_", ":_", "\\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_", "=_", "Answer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "content_", "=_", "Fuzzy", "Unicode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "factory_", "._", "La", "zy", "Attribute_", "(_", "lambda_", "a_", ":_", "datetime_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "creator_", "=_", "factory_", "._", "Sub", "Factory_", "(_", "User", "Factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "question_", "=_", "factory_", "._", "Sub", "Factory_", "(_", "Quest", "ion", "Factory_", ")_", "\\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 ]
Variable defined multiple times
azoft-dev-team/imagrium/env/Lib/test/test_cfgparser.py
[ { "content": " def test_basic(self):\n config_string = (\n \"[Foo Bar]\\n\"\n \"foo=bar\\n\"\n \"[Spacey Bar]\\n\"\n \"foo = bar\\n\"\n \"[Commented Bar]\\n\"\n \"foo: bar ; comment\\n\"\n \"[Long Line]\\n\"\n \"foo: this line is much, much longer than my editor\\n\"\n \" likes it.\\n\"\n \"[Section\\\\with$weird%characters[\\t]\\n\"\n \"[Internationalized Stuff]\\n\"\n \"foo[bg]: Bulgarian\\n\"\n \"foo=Default\\n\"\n \"foo[en]=English\\n\"\n \"foo[de]=Deutsch\\n\"\n \"[Spaces]\\n\"\n \"key with spaces : value\\n\"\n \"another with spaces = splat!\\n\"\n )\n if self.allow_no_value:\n config_string += (\n \"[NoValue]\\n\"\n \"option-without-value\\n\"\n )\n\n cf = self.fromstring(config_string)\n L = cf.sections()\n L.sort()\n E = [r'Commented Bar',\n r'Foo Bar',\n r'Internationalized Stuff',\n r'Long Line',\n r'Section\\with$weird%characters[' '\\t',\n r'Spaces',\n r'Spacey Bar',\n ]\n if self.allow_no_value:\n E.append(r'NoValue')\n E.sort()\n eq = self.assertEqual\n eq(L, E)\n\n # The use of spaces in the section names serves as a\n # regression test for SourceForge bug #583248:\n # http://www.python.org/sf/583248\n eq(cf.get('Foo Bar', 'foo'), 'bar')\n eq(cf.get('Spacey Bar', 'foo'), 'bar')\n eq(cf.get('Commented Bar', 'foo'), 'bar')\n eq(cf.get('Spaces', 'key with spaces'), 'value')\n eq(cf.get('Spaces', 'another with spaces'), 'splat!')\n if self.allow_no_value:\n eq(cf.get('NoValue', 'option-without-value'), None)\n\n self.assertNotIn('__name__', cf.options(\"Foo Bar\"),\n '__name__ \"option\" should not be exposed by the API!')\n\n # Make sure the right things happen for remove_option();\n # added to include check for SourceForge bug #123324:\n self.assertTrue(cf.remove_option('Foo Bar', 'foo'),\n \"remove_option() failed to report existence of option\")\n self.assertFalse(cf.has_option('Foo Bar', 'foo'),\n \"remove_option() failed to remove option\")\n self.assertFalse(cf.remove_option('Foo Bar', 'foo'),\n \"remove_option() failed to report non-existence of option\"\n \" that was removed\")\n\n self.assertRaises(ConfigParser.NoSectionError,\n cf.remove_option, 'No Such Section', 'foo')\n\n eq(cf.get('Long Line', 'foo'),\n 'this line is much, much longer than my editor\\nlikes it.')", "metadata": "root.TestCaseBase.test_basic", "header": "['class', 'TestCaseBase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 48 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Case", "Base_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "string_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "Foo", " ", "Bar", "]\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "foo", "=", "bar", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "Spac", "ey", " ", "Bar", "]\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "foo", " ", "=", " ", "bar", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "Comme", "nte", "d", " ", "Bar", "]\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "foo", ":", " ", "bar", " ", ";", " ", "comment", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "Long", " ", "Line", "]\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "foo", ":", " ", "this", " ", "line", " ", "is", " ", "muc", "h", ",", " ", "muc", "h", " ", "long", "er", " ", "than", " ", "my", " ", "editor", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", " ", " ", "likes", " ", "it", ".\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "Sect", "ion", "\\\\\\\\", "with", "$", "weird", "%", "character", "s", "[\\\\", "t", "]\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "Intern", "ation", "alize", "d", " ", "Stuff", "]\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "foo", "[", "bg", "]:", " ", "Bul", "garia", "n", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "foo", "=", "Default", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "foo", "[", "en", "]=", "Eng", "lish", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "foo", "[", "de", "]=", "De", "uts", "ch", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "Spaces", "]\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "key", " ", "with", " ", "space", "s", " ", ":", " ", "value", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "anot", "her", " ", "with", " ", "space", "s", " ", "=", " ", "spla", "t", "!\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "allow", "\\u", "no", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "string_", "+=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "No", "Value", "]\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "option", "-", "with", "out", "-", "value", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cf_", "=_", "self_", "._", "fromstring_", "(_", "config", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "cf_", "._", "sections_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "E_", "=_", "[_", "r", "'", "Comme", "nte", "d", " ", "Bar", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'", "Foo", " ", "Bar", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'", "Intern", "ation", "alize", "d", " ", "Stuff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'", "Long", " ", "Line", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'", "Sect", "ion", "\\\\", "with", "$", "weird", "%", "character", "s", "['_", "'\\\\", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'", "Spaces", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'", "Spac", "ey", " ", "Bar", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "allow", "\\u", "no", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "E_", "._", "append_", "(_", "r", "'", "No", "Value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "E_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "=_", "self_", "._", "assert", "Equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "L_", ",_", "E_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "use", " ", "of", " ", "space", "s", " ", "in", " ", "the", " ", "section", " ", "names", " ", "serve", "s", " ", "as", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "regress", "ion", " ", "test", " ", "for", " ", "Sou", "rce", "Forg", "e", " ", "bug", " ", "#", "583", "248", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "python", ".", "org", "/", "sf", "/", "583", "248_", "\\u\\u\\uNL\\u\\u\\u_", "eq_", "(_", "cf_", "._", "get_", "(_", "'", "Foo", " ", "Bar", "'_", ",_", "'", "foo", "'_", ")_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "cf_", "._", "get_", "(_", "'", "Spac", "ey", " ", "Bar", "'_", ",_", "'", "foo", "'_", ")_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "cf_", "._", "get_", "(_", "'", "Comme", "nte", "d", " ", "Bar", "'_", ",_", "'", "foo", "'_", ")_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "cf_", "._", "get_", "(_", "'", "Spaces", "'_", ",_", "'", "key", " ", "with", " ", "space", "s", "'_", ")_", ",_", "'", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq_", "(_", "cf_", "._", "get_", "(_", "'", "Spaces", "'_", ",_", "'", "anot", "her", " ", "with", " ", "space", "s", "'_", ")_", ",_", "'", "spla", "t", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "allow", "\\u", "no", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eq_", "(_", "cf_", "._", "get_", "(_", "'", "No", "Value", "'_", ",_", "'", "option", "-", "with", "out", "-", "value", "'_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Not", "In_", "(_", "'\\u", "\\u", "name", "\\u\\u'_", ",_", "cf_", "._", "options_", "(_", "\"", "Foo", " ", "Bar", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "name", "\\u\\u", " ", "\"", "option", "\"", " ", "shou", "ld", " ", "not", " ", "be", " ", "exposed", " ", "by", " ", "the", " ", "API", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "right", " ", "thing", "s", " ", "happ", "en", " ", "for", " ", "remove", "\\u", "option", "();", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "adde", "d", " ", "to", " ", "include", " ", "check", " ", "for", " ", "Sou", "rce", "Forg", "e", " ", "bug", " ", "#", "123", "324", ":_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cf_", "._", "remove", "\\u", "option_", "(_", "'", "Foo", " ", "Bar", "'_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "remove", "\\u", "option", "()", " ", "fail", "ed", " ", "to", " ", "report", " ", "existence", " ", "of", " ", "option", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "cf_", "._", "has", "\\u", "option_", "(_", "'", "Foo", " ", "Bar", "'_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "remove", "\\u", "option", "()", " ", "fail", "ed", " ", "to", " ", "remove", " ", "option", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "cf_", "._", "remove", "\\u", "option_", "(_", "'", "Foo", " ", "Bar", "'_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "remove", "\\u", "option", "()", " ", "fail", "ed", " ", "to", " ", "report", " ", "non", "-", "existence", " ", "of", " ", "option", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "tha", "t", " ", "was", " ", "remove", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Config", "Parser_", "._", "No", "Sect", "ion", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cf_", "._", "remove", "\\u", "option_", ",_", "'", "No", " ", "Suc", "h", " ", "Sect", "ion", "'_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "eq_", "(_", "cf_", "._", "get_", "(_", "'", "Long", " ", "Line", "'_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "this", " ", "line", " ", "is", " ", "muc", "h", ",", " ", "muc", "h", " ", "long", "er", " ", "than", " ", "my", " ", "editor", "\\\\", "nli", "kes", " ", "it", ".'_", ")_", "\\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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Akagi201/learning-python/hashlib/hashlib_new.py
[ { "content": "#!/usr/bin/env python\n# encoding: utf-8\n\n\"\"\"Naming the hash type using a string.\n\"\"\"\n\nimport hashlib\nimport sys\n\ntry:\n hash_name = sys.argv[1]\nexcept IndexError:\n print 'Specify the hash name as the first argument.'\nelse:\n try:\n data = sys.argv[2]\n except IndexError:\n from hashlib_data import lorem as data\n\n h = hashlib.new(hash_name)\n h.update(data)\n print h.hexdigest()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Naming", " ", "the", " ", "hash", " ", "type", " ", "usi", "ng", " ", "a", " ", "string", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hash", "\\u", "name_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Speci", "fy", " ", "the", " ", "hash", " ", "name", " ", "as", " ", "the", " ", "first", " ", "argu", "ment", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "sys_", "._", "argv_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "hash", "lib", "\\u", "data_", "import_", "lore", "m_", "as_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "h_", "=_", "hashlib_", "._", "new_", "(_", "hash", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "h_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
circuits/circuits/circuits/net/sockets.py
[ { "content": " def _close(self, sock):\n if sock is None:\n return\n\n if sock != self._sock and sock not in self._clients:\n return\n\n self._poller.discard(sock)\n\n if sock in self._buffers:\n del self._buffers[sock]\n\n if sock in self._clients:\n self._clients.remove(sock)\n else:\n self._sock = None\n\n try:\n sock.shutdown(2)\n sock.close()\n except SocketError:\n pass\n\n self.fire(disconnect(sock))", "metadata": "root.Server._close", "header": "['class', 'Server', '(', 'BaseComponent', ')', ':', '___EOS___']", "index": 480 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Server_", "(_", "Base", "Component_", ")_", ":_", "\\u\\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", "close_", "(_", "self_", ",_", "sock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sock_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sock_", "!=_", "self_", "._", "\\u", "sock_", "and_", "sock_", "not_", "in_", "self_", "._", "\\u", "clients_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "poller_", "._", "discard_", "(_", "sock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sock_", "in_", "self_", "._", "\\u", "buffers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u", "buffers_", "[_", "sock_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sock_", "in_", "self_", "._", "\\u", "clients_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "clients_", "._", "remove_", "(_", "sock_", ")_", "\\u\\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", "sock_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "._", "shutdown_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sock", "et", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fire_", "(_", "disconnect_", "(_", "sock_", ")_", ")_", "\\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 ]