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
list
label_sequence
list
Unused import
kayhayen/Nuitka/tests/programs/reimport_main_static/ImportItselfStaticMain.py
[ { "content": "# Copyright 2016, Kay Hayen, mailto:[email protected]\n#\n# Python tests originally created or extracted from other peoples work. The\n# parts were too small to be protected.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nimport sys\n\nprint(\"Here I am before import\", __name__)\n\nimport ImportItselfStaticMain\nprint(\"Here I am after import\", __name__)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 10 }, { "span": "import ImportItselfStaticMain", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2016", ",", " ", "Ka", "y", " ", "Ha", "yen", ",", " ", "mail", "to", ":", "ka", "y", ".", "hay", "en", "@", "gma", "il", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "tests", " ", "original", "ly", " ", "created", " ", "or", " ", "extracted", " ", "from", " ", "other", " ", "people", "s", " ", "work", ".", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "part", "s", " ", "wer", "e", " ", "too", " ", "small", " ", "to", " ", "be", " ", "protect", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Her", "e", " ", "I", " ", "am", " ", "bef", "ore", " ", "import", "\"_", ",_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Import", "It", "self", "Static", "Main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Her", "e", " ", "I", " ", "am", " ", "after", " ", "import", "\"_", ",_", "\\u\\u", "name\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
ProgVal/Limnoria/plugins/Conditional/config.py
[ { "content": "###\n# Copyright (c) 2010, Daniel Folkinshteyn\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#\n# * Redistributions of source code must retain the above copyright notice,\n# this list of conditions, and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright notice,\n# this list of conditions, and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n# * Neither the name of the author of this software nor the name of\n# contributors to this software may be used to endorse or promote products\n# derived from this software without specific prior written consent.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n\n###\n\nimport supybot.conf as conf\nimport supybot.registry as registry\n\ntry:\n from supybot.i18n import PluginInternationalization\n from supybot.i18n import internationalizeDocstring\n _ = PluginInternationalization('Conditional')\nexcept:\n # This are useless functions that's allow to run the plugin on a bot\n # without the i18n plugin\n _ = lambda x:x\n internationalizeDocstring = lambda x:x\n\n\n\nConditional = conf.registerPlugin('Conditional')\n# This is where your configuration variables (if any) should go. For example:\n# conf.registerGlobalValue(Conditional, 'someConfigVariableName',\n# registry.Boolean(False, \"\"\"Help for someConfigVariableName.\"\"\"))\n\n\n# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", ",", " ", "Dan", "iel", " ", "Fo", "lk", "ins", "hte", "yn_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", ",", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", ",", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "author", " ", "of", " ", "this", " ", "software", " ", "nor", " ", "the", " ", "name", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "consent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "conf_", "as_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "registry_", "as_", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sup", "ybo", "t_", "._", "i18n_", "import_", "Plug", "in", "Intern", "ation", "ali", "zation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sup", "ybo", "t_", "._", "i18n_", "import_", "international", "ize", "Docs", "tring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", "=_", "Plug", "in", "Intern", "ation", "ali", "zation_", "(_", "'", "Cond", "itional", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "are", " ", "usel", "ess", " ", "function", "s", " ", "tha", "t", "'", "s", " ", "allow", " ", "to", " ", "run", " ", "the", " ", "plugin", " ", "on", " ", "a", " ", "bot_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", "out", " ", "the", " ", "i18n", " ", "plugin_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", "=_", "lambda_", "x_", ":_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "international", "ize", "Docs", "tring_", "=_", "lambda_", "x_", ":_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Cond", "itional", "_", "=_", "conf_", "._", "register", "Plugin_", "(_", "'", "Cond", "itional", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "where", " ", "your", " ", "configura", "tion", " ", "variab", "les", " ", "(", "if", " ", "any", ")", " ", "shou", "ld", " ", "go", ".", " ", " ", "For", " ", "example", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "conf", ".", "register", "Global", "Value", "(", "Cond", "itional", ",", " ", "'", "some", "Config", "Varia", "ble", "Name", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "registr", "y", ".", "Boo", "lean", "(", "Fal", "se", ",", " ", "\"\"\"", "Help", " ", "for", " ", "some", "Config", "Varia", "ble", "Name", ".\"", "\"\"", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "set", " ", "shift", "widt", "h", "=", "4", " ", "tabs", "top", "=", "4", " ", "expand", "tab", " ", "text", "widt", "h", "=", "7", "9", ":_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
rtucker-mozilla/mozilla_inventory/dhcp/views.py
[ { "content": "def showall(request):\n dhcp_scopes = models.DHCP.objects.all()\n h = KeyValueHandler()\n request = factory.get('/en-US/api/keyvalue/?key=is_dhcp_scope', follow=True)\n obj = h.read(request)\n dhcp_scopes = []\n for key in obj.iterkeys():\n dhcp_scopes.append(key.split(\":\")[1])\n\n return jinja_render_to_response('dhcp/index.html', {\n 'dhcp_scopes': dhcp_scopes,\n })", "metadata": "root.showall", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def edit(request, dhcp_scope):\n h = KeyValueHandler()\n trequest = factory.get('/api/keyvalue/?keystore=%s' % dhcp_scope, follow=True)\n instance = h.read(trequest)\n initial = {}\n initial['scope_name'] = dhcp_scope\n ##A bunch of try/catch blocks to create key/value pairs if one does not exist\n try:\n initial['scope_start'] = instance['dhcp.scope.start']\n except:\n trequest = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.scope.start', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['scope_start'] = ''\n try:\n initial['scope_end'] = instance['dhcp.scope.end']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.scope.end', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['scope_end'] = ''\n try:\n initial['scope_netmask'] = instance['dhcp.scope.netmask']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.scope.netmask', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['scope_netmask'] = ''\n try:\n initial['pool_start'] = instance['dhcp.pool.start']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.pool.start', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['pool_start'] = ''\n try:\n initial['pool_end'] = instance['dhcp.pool.end']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.pool.end', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['pool_end'] = ''\n try:\n initial['ntp_server1'] = instance['dhcp.option.ntp_server.0']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.option.ntp_server.0', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['ntp_server1'] = ''\n try:\n initial['ntp_server2'] = instance['dhcp.option.ntp_server.1']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.option.ntp_server.1', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['ntp_server2'] = ''\n try:\n initial['router'] = instance['dhcp.option.router.0']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.option.router.0', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['router'] = ''\n try:\n initial['domain_name'] = instance['dhcp.option.domain_name.0']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.option.domain_name.0', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['domain_name'] = ''\n try:\n initial['dns_server1'] = instance['dhcp.dns_server.0']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.dns_server.0', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['dns_server1'] = ''\n try:\n initial['dns_server2'] = instance['dhcp.dns_server.1']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.dns_server.1', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['dns_server2'] = ''\n try:\n initial['allow_booting'] = instance['dhcp.pool.allow_booting.0']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.pool.allow_booting.0', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['allow_booting'] = ''\n try:\n initial['allow_bootp'] = instance['dhcp.pool.allow_bootp.0']\n except:\n treqeust = factory.post('/en-US/api/keyvalue/%s/' % dhcp_scope, {'key':'dhcp.pool.allow_bootp.0', 'value':'', 'truth_name':dhcp_scope}, follow=True)\n h.create(trequest)\n initial['allow_bootp'] = ''\n\n if request.method == 'POST':\n form = forms.EditDHCPScopeForm(request.POST)\n if form.is_valid():\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.scope.start', 'value':form.cleaned_data['scope_start']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.scope.end', 'value':form.cleaned_data['scope_end']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.scope.netmask', 'value':form.cleaned_data['scope_netmask']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.pool.start', 'value':form.cleaned_data['pool_start']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.pool.end', 'value':form.cleaned_data['pool_end']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.option.ntp_server.0', 'value':form.cleaned_data['ntp_server1']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.option.ntp_server.1', 'value':form.cleaned_data['ntp_server2']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.dns_server.0', 'value':form.cleaned_data['dns_server1']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.dns_server.1', 'value':form.cleaned_data['dns_server2']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.option.domain_name.0', 'value':form.cleaned_data['domain_name']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.option.router.0', 'value':form.cleaned_data['router']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.pool.allow_booting.0', 'value':form.cleaned_data['allow_booting']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n trequest = factory.post('/en-US/api/v2/keyvalue/%s/' % dhcp_scope, {'truth_id': dhcp_scope, 'key':'dhcp.pool.allow_bootp.0', 'value':form.cleaned_data['allow_bootp']}, follow=True)\n h.update(trequest, dhcp_scope)\n\n else:\n form = forms.EditDHCPScopeForm(initial=initial)\n\n return jinja_render_to_response('dhcp/edit.html', {\n \"form\": form,\n 'dhcp_scope': dhcp_scope\n })", "metadata": "root.edit", "header": "['module', '___EOS___']", "index": 128 } ]
[ { "span": "dhcp_scopes ", "start_line": 34, "start_column": 4, "end_line": 34, "end_column": 15 }, { "span": "treqeust ", "start_line": 144, "start_column": 8, "end_line": 144, "end_column": 16 }, { "span": "treqeust ", "start_line": 150, "start_column": 8, "end_line": 150, "end_column": 16 }, { "span": "treqeust ", "start_line": 156, "start_column": 8, "end_line": 156, "end_column": 16 }, { "span": "treqeust ", "start_line": 162, "start_column": 8, "end_line": 162, "end_column": 16 }, { "span": "treqeust ", "start_line": 168, "start_column": 8, "end_line": 168, "end_column": 16 }, { "span": "treqeust ", "start_line": 174, "start_column": 8, "end_line": 174, "end_column": 16 }, { "span": "treqeust ", "start_line": 180, "start_column": 8, "end_line": 180, "end_column": 16 }, { "span": "treqeust ", "start_line": 186, "start_column": 8, "end_line": 186, "end_column": 16 }, { "span": "treqeust ", "start_line": 192, "start_column": 8, "end_line": 192, "end_column": 16 }, { "span": "treqeust ", "start_line": 198, "start_column": 8, "end_line": 198, "end_column": 16 }, { "span": "treqeust ", "start_line": 204, "start_column": 8, "end_line": 204, "end_column": 16 } ]
[ { "span": "dhcp_scopes ", "start_line": 38, "start_column": 4, "end_line": 38, "end_column": 15 }, { "span": "treqeust ", "start_line": 210, "start_column": 8, "end_line": 210, "end_column": 16 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "show", "all_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dhcp", "\\u", "scopes_", "=_", "models_", "._", "DHC", "P_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "Key", "Value", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "factory_", "._", "get_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/?", "key", "=", "is", "\\u", "dhcp", "\\u", "scope", "'_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "h_", "._", "read_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dhcp", "\\u", "scopes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "obj_", "._", "iterkeys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dhcp", "\\u", "scopes_", "._", "append_", "(_", "key_", "._", "split_", "(_", "\":\"_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "jin", "ja", "\\u", "render", "\\u", "to", "\\u", "response_", "(_", "'", "dhcp", "/", "index", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dhcp", "\\u", "scope", "s", "'_", ":_", "dhcp", "\\u", "scopes_", ",_", "\\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_", "edit_", "(_", "request_", ",_", "dhcp", "\\u", "scope_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "Key", "Value", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "get_", "(_", "'/", "api", "/", "keyval", "ue", "/?", "keystore", "=", "%", "s", "'_", "%_", "dhcp", "\\u", "scope_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "h_", "._", "read_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "scope", "\\u", "name", "'_", "]_", "=_", "dhcp", "\\u", "scope_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "A", " ", "bunch", " ", "of", " ", "try", "/", "catch", " ", "blocks", " ", "to", " ", "create", " ", "key", "/", "value", " ", "pair", "s", " ", "if", " ", "one", " ", "doe", "s", " ", "not", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "[_", "'", "scope", "\\u", "start", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "scope", ".", "start", "'_", "]_", "\\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 ", " _", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "scope", ".", "start", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "scope", "\\u", "start", "'_", "]_", "=_", "''_", "\\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 ", " _", "initial_", "[_", "'", "scope", "\\u", "end", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "scope", ".", "end", "'_", "]_", "\\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 ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "scope", ".", "end", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "scope", "\\u", "end", "'_", "]_", "=_", "''_", "\\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 ", " _", "initial_", "[_", "'", "scope", "\\u", "net", "mask", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "scope", ".", "net", "mask", "'_", "]_", "\\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 ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "scope", ".", "net", "mask", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "scope", "\\u", "net", "mask", "'_", "]_", "=_", "''_", "\\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 ", " _", "initial_", "[_", "'", "pool", "\\u", "start", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "pool", ".", "start", "'_", "]_", "\\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 ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "pool", ".", "start", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "pool", "\\u", "start", "'_", "]_", "=_", "''_", "\\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 ", " _", "initial_", "[_", "'", "pool", "\\u", "end", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "pool", ".", "end", "'_", "]_", "\\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 ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "pool", ".", "end", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "pool", "\\u", "end", "'_", "]_", "=_", "''_", "\\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 ", " _", "initial_", "[_", "'", "ntp", "\\u", "server", "1", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "option", ".", "ntp", "\\u", "server", ".0", "'_", "]_", "\\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 ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "option", ".", "ntp", "\\u", "server", ".0", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "ntp", "\\u", "server", "1", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "[_", "'", "ntp", "\\u", "server", "2", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "option", ".", "ntp", "\\u", "server", ".1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "option", ".", "ntp", "\\u", "server", ".1", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "ntp", "\\u", "server", "2", "'_", "]_", "=_", "''_", "\\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 ", " _", "initial_", "[_", "'", "router", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "option", ".", "router", ".0", "'_", "]_", "\\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 ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "option", ".", "router", ".0", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "router", "'_", "]_", "=_", "''_", "\\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 ", " _", "initial_", "[_", "'", "domain", "\\u", "name", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "option", ".", "domain", "\\u", "name", ".0", "'_", "]_", "\\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 ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "option", ".", "domain", "\\u", "name", ".0", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "domain", "\\u", "name", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "[_", "'", "dns", "\\u", "server", "1", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "dns", "\\u", "server", ".0", "'_", "]_", "\\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 ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "dns", "\\u", "server", ".0", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "dns", "\\u", "server", "1", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial_", "[_", "'", "dns", "\\u", "server", "2", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "dns", "\\u", "server", ".1", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "dns", "\\u", "server", ".1", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "dns", "\\u", "server", "2", "'_", "]_", "=_", "''_", "\\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 ", " _", "initial_", "[_", "'", "allow", "\\u", "boot", "ing", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "pool", ".", "allow", "\\u", "boot", "ing", ".0", "'_", "]_", "\\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 ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "pool", ".", "allow", "\\u", "boot", "ing", ".0", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "allow", "\\u", "boot", "ing", "'_", "]_", "=_", "''_", "\\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 ", " _", "initial_", "[_", "'", "allow", "\\u", "boot", "p", "'_", "]_", "=_", "instance_", "[_", "'", "dhcp", ".", "pool", ".", "allow", "\\u", "boot", "p", ".0", "'_", "]_", "\\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 ", " _", "tre", "qe", "ust", "_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "key", "'_", ":_", "'", "dhcp", ".", "pool", ".", "allow", "\\u", "boot", "p", ".0", "'_", ",_", "'", "value", "'_", ":_", "''_", ",_", "'", "truth", "\\u", "name", "'_", ":_", "dhcp", "\\u", "scope_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "create_", "(_", "tre", "quest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial_", "[_", "'", "allow", "\\u", "boot", "p", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "forms_", "._", "Edit", "DHC", "PS", "cope", "Form_", "(_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "scope", ".", "start", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "scope", "\\u", "start", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "scope", ".", "end", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "scope", "\\u", "end", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "scope", ".", "net", "mask", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "scope", "\\u", "net", "mask", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "pool", ".", "start", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "pool", "\\u", "start", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "pool", ".", "end", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "pool", "\\u", "end", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "option", ".", "ntp", "\\u", "server", ".0", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "ntp", "\\u", "server", "1", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "option", ".", "ntp", "\\u", "server", ".1", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "ntp", "\\u", "server", "2", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "dns", "\\u", "server", ".0", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "dns", "\\u", "server", "1", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "dns", "\\u", "server", ".1", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "dns", "\\u", "server", "2", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "option", ".", "domain", "\\u", "name", ".0", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "domain", "\\u", "name", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "option", ".", "router", ".0", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "router", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "pool", ".", "allow", "\\u", "boot", "ing", ".0", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "allow", "\\u", "boot", "ing", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tre", "quest_", "=_", "factory_", "._", "post_", "(_", "'/", "en", "-", "US", "/", "api", "/", "v2", "/", "keyval", "ue", "/", "%", "s", "/'_", "%_", "dhcp", "\\u", "scope_", ",_", "{_", "'", "truth", "\\u", "id", "'_", ":_", "dhcp", "\\u", "scope_", ",_", "'", "key", "'_", ":_", "'", "dhcp", ".", "pool", ".", "allow", "\\u", "boot", "p", ".0", "'_", ",_", "'", "value", "'_", ":_", "form_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "allow", "\\u", "boot", "p", "'_", "]_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "._", "update_", "(_", "tre", "quest_", ",_", "dhcp", "\\u", "scope_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "forms_", "._", "Edit", "DHC", "PS", "cope", "Form_", "(_", "initial_", "=_", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "jin", "ja", "\\u", "render", "\\u", "to", "\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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
enthought/depsolver/depsolver/solver/rule.py
[ { "content": "import hashlib\nimport re\n\nimport six\n\nfrom ..bundled.traitlets \\\n import \\\n HasTraits, Bool, Enum, Instance, List, Long, Unicode\nfrom ..errors \\\n import \\\n DepSolverError, MissingPackageInfoInPool\nfrom .._package_utils \\\n import \\\n is_valid_package_name\nfrom ..package \\\n import \\\n PackageInfo\nfrom ..pool \\\n import \\\n Pool\nfrom ..request \\\n import \\\n _Job\nfrom ..requirement \\\n import \\\n Requirement\nfrom ..version \\\n import \\\n SemanticVersion, Version\n\n_RULE_REASONS = [\n \"internal_allow_update\",\n \"job_install\",\n \"job_remove\",\n \"package_conflict\",\n \"package_requires\",\n \"package_obsoletes\",\n \"rule_installed_package_obsoletes\",\n \"rule_package_same_name\",\n \"rule_package_implicit_obsoletes\",\n \"rule_learned\",\n \"rule_package_alias\",\n]\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PackageRule(HasTraits):\n \"\"\"A Rule where literals are package ids attached to a pool.\n\n It essentially allows for pretty-printing package names instead of internal\n ids as used by the SAT solver underneath.\n \"\"\"\n pool = Instance(Pool)\n literals = List(Long)\n\n reason = Enum(_RULE_REASONS)\n reason_details = Unicode(\"\")\n\n job = Instance(_Job)\n\n enabled = Bool(True)\n\n id = Long(-1)\n rule_type = Enum([\"unknown\", \"packages\", \"job\", \"learnt\"])\n\n _rule_hash = Unicode(\"\")\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.PackageRule", "header": "['module', '___EOS___']", "index": 44 }, { "content": " @classmethod\n def from_string(cls, pool, rule_string, reason, reason_details=\"\", job=None, id=-1):\n \"\"\"\n Creates a PackageRule from a rule string, e.g. '-numpy-1.6.0 | numpy-1.7.0'\n\n Because package full name -> id is not 1-to-1 mapping, this may fail\n when a package has multiple ids. This is mostly used for testing, to\n write reference rules a bit more easily.\n \"\"\"\n packages_string = (s.strip() for s in rule_string.split(\"|\"))\n package_literals = []\n for package_string in packages_string:\n if package_string.startswith(\"-\"):\n positive = False\n package_string = package_string[1:]\n else:\n positive = True\n\n requirement = Requirement.from_package_string(package_string)\n package_candidates = pool.what_provides(requirement)\n if len(package_candidates) == 0:\n raise ValueError(\"No candidate for package %s\" % package_string)\n elif len(package_candidates) > 1:\n msg = \"> 1 candidate for package %s requirement, cannot \" \\\n \"create rule from it\" % package_string\n raise ValueError(msg)\n else:\n if positive:\n package_literals.append(package_candidates[0].id)\n else:\n package_literals.append(-package_candidates[0].id)\n\n return cls(pool, package_literals, reason, reason_details, job, id)", "metadata": "root.PackageRule.from_string", "header": "['class', 'PackageRule', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 65 }, { "content": " @classmethod\n def from_packages(cls, pool, packages, reason, reason_details=\"\", job=None, id=-1):\n literals = [p.id for p in packages]\n if len(packages) > 0:\n return cls(pool, literals, reason, reason_details, job, id, packages[0].version_factory)\n else:\n return cls(pool, literals, reason, reason_details, job, id)", "metadata": "root.PackageRule.from_packages", "header": "['class', 'PackageRule', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 99 }, { "content": " def __init__(self, pool, literals, reason, reason_details=\"\", job=None,\n id=-1, version_factory=SemanticVersion.from_string, **kw):\n if reason == \"job_install\":\n if not is_valid_package_name(reason_details):\n raise DepSolverError(\n \"reason_details must be a valid package name for \"\n \"'job_install' rule\")\n elif reason == \"package_requires\":\n try:\n Requirement.from_string(reason_details, version_factory=version_factory)\n except Exception:\n raise DepSolverError(\"Invalid requirement string '%s'\" % (reason_details,))\n\n literals = sorted(literals)\n super(PackageRule, self).__init__(pool=pool, literals=literals,\n reason=reason, reason_details=reason_details, job=job, id=id,\n **kw)", "metadata": "root.PackageRule.__init__", "header": "['class', 'PackageRule', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 107 }, { "content": " @property\n def rule_hash(self):\n # The exact rule hash algorithm is copied from composer\n data = \",\".join(str(i) for i in self.literals)\n return hashlib.md5(data.encode('ascii')).hexdigest()[:5]", "metadata": "root.PackageRule.rule_hash", "header": "['class', 'PackageRule', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 125 }, { "content": " @property\n def is_assertion(self):\n return len(self.literals) == 1", "metadata": "root.PackageRule.is_assertion", "header": "['class', 'PackageRule', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 131 }, { "content": " @property\n def required_package_name(self):\n if self.reason == \"job_install\":\n return self.reason_data\n elif self.reason == \"package_requires\":\n return Requirement.from_string(self.reason_data)\n else:\n return \"\"", "metadata": "root.PackageRule.required_package_name", "header": "['class', 'PackageRule', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 135 }, { "content": " def is_equivalent(self, other):\n \"\"\"Two rules are considered equivalent if they have the same\n literals.\"\"\"\n if not isinstance(other, PackageRule):\n return NotImplemented\n return self.literals == other.literals", "metadata": "root.PackageRule.is_equivalent", "header": "['class', 'PackageRule', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 144 }, { "content": " def __str__(self):\n return \"(%s)\" % \" | \".join(self.pool.id_to_string(l) for l in self.literals)", "metadata": "root.PackageRule.__str__", "header": "['class', 'PackageRule', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 151 }, { "content": " def __repr__(self):\n return \"PackageRule('%s', '%s', '%s')\" % \\\n (\" | \".join(self.pool.id_to_string(l) for l in self.literals),\n self.reason, self.reason_details)", "metadata": "root.PackageRule.__repr__", "header": "['class', 'PackageRule', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 154 }, { "content": " def __eq__(self, other):\n return repr(self) == repr(other) and self.reason == other.reason \\\n and self.reason_details == other.reason_details", "metadata": "root.PackageRule.__eq__", "header": "['class', 'PackageRule', '(', 'HasTraits', ')', ':', '___EOS___']", "index": 160 } ]
[ { "span": "import re", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 9 }, { "span": "import six", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "bundle", "d_", "._", "tra", "itle", "ts_", "import_", "Has", "Trait", "s_", ",_", "Bool_", ",_", "Enum_", ",_", "Instance_", ",_", "List_", ",_", "Long_", ",_", "Unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "errors_", "import_", "Dep", "Solve", "r", "Error_", ",_", "Missing", "Packa", "ge", "Info", "In", "Pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "\\u", "package", "\\u", "utils_", "import_", "is", "\\u", "valid", "\\u", "package", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "package_", "import_", "Packa", "ge", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "pool_", "import_", "Pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "request_", "import_", "\\u", "Job_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "requirement_", "import_", "Requirement", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "version_", "import_", "Semantic", "Version_", ",_", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "RULE", "\\u", "REASON", "S_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "internal", "\\u", "allow", "\\u", "update", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "job", "\\u", "install", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "job", "\\u", "remove", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "package", "\\u", "confl", "ict", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "package", "\\u", "require", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "package", "\\u", "obsolete", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rule", "\\u", "install", "ed", "\\u", "package", "\\u", "obsolete", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rule", "\\u", "package", "\\u", "same", "\\u", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rule", "\\u", "package", "\\u", "implicit", "\\u", "obsolete", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rule", "\\u", "learned", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rule", "\\u", "package", "\\u", "alias", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Packa", "ge", "Rule_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "Rule", " ", "where", " ", "literal", "s", " ", "are", " ", "package", " ", "ids", " ", "attache", "d", " ", "to", " ", "a", " ", "pool", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "essential", "ly", " ", "allow", "s", " ", "for", " ", "pretty", "-", "printin", "g", " ", "package", " ", "names", " ", "inst", "ead", " ", "of", " ", "internal", "\\", "10", ";", " ", " ", " ", " ", "ids", " ", "as", " ", "used", " ", "by", " ", "the", " ", "SAT", " ", "solve", "r", " ", "under", "nea", "th", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pool_", "=_", "Instance_", "(_", "Pool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "literals_", "=_", "List_", "(_", "Long_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reason_", "=_", "Enum_", "(_", "\\u", "RULE", "\\u", "REASON", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reason", "\\u", "details_", "=_", "Unicode_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "job_", "=_", "Instance_", "(_", "\\u", "Job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "enabled_", "=_", "Bool_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "Long_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "type_", "=_", "Enum_", "(_", "[_", "\"", "unknown", "\"_", ",_", "\"", "package", "s", "\"_", ",_", "\"", "job", "\"_", ",_", "\"", "learn", "t", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "rule", "\\u", "hash_", "=_", "Unicode_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Packa", "ge", "Rule_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "string_", "(_", "cls_", ",_", "pool_", ",_", "rule", "\\u", "string_", ",_", "reason_", ",_", "reason", "\\u", "details_", "=_", "\"\"_", ",_", "job_", "=_", "None_", ",_", "id_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "Packa", "ge", "Rule", " ", "from", " ", "a", " ", "rule", " ", "string", ",", " ", "e", ".", "g", ".", " ", "'-", "nump", "y", "-1", ".6", ".0", " ", "|", " ", "nump", "y", "-1", ".7", ".0", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Be", "caus", "e", " ", "package", " ", "full", " ", "name", " ", "->", " ", "id", " ", "is", " ", "not", " ", "1", "-", "to", "-1", " ", "mapping", ",", " ", "this", " ", "may", " ", "fail", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "a", " ", "package", " ", "has", " ", "multiple", " ", "ids", ".", " ", "Thi", "s", " ", "is", " ", "most", "ly", " ", "used", " ", "for", " ", "testi", "ng", ",", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "write", " ", "reference", " ", "rule", "s", " ", "a", " ", "bit", " ", "more", " ", "easi", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package", "s", "\\u", "string_", "=_", "(_", "s_", "._", "strip_", "(_", ")_", "for_", "s_", "in_", "rule", "\\u", "string_", "._", "split_", "(_", "\"|\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package", "\\u", "literals_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "package", "\\u", "string_", "in_", "package", "s", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "package", "\\u", "string_", "._", "startswith_", "(_", "\"-\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "positive_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package", "\\u", "string_", "=_", "package", "\\u", "string_", "[_", "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 ", " _", "positive_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "requirement_", "=_", "Requirement", "_", "._", "from", "\\u", "package", "\\u", "string_", "(_", "package", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package", "\\u", "candidates_", "=_", "pool_", "._", "what", "\\u", "provides_", "(_", "requirement_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "package", "\\u", "candidates_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "No", " ", "candidate", " ", "for", " ", "package", " ", "%", "s", "\"_", "%_", "package", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "package", "\\u", "candidates_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\">", " ", "1", " ", "candidate", " ", "for", " ", "package", " ", "%", "s", " ", "require", "ment", ",", " ", "cann", "ot", " ", "\"_", "\"", "create", " ", "rule", " ", "from", " ", "it", "\"_", "%_", "package", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "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 ", " _", "if_", "positive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "package", "\\u", "literals_", "._", "append_", "(_", "package", "\\u", "candidates_", "[_", "0_", "]_", "._", "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 ", " ", "_", "package", "\\u", "literals_", "._", "append_", "(_", "-_", "package", "\\u", "candidates_", "[_", "0_", "]_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "(_", "pool_", ",_", "package", "\\u", "literals_", ",_", "reason_", ",_", "reason", "\\u", "details_", ",_", "job_", ",_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Packa", "ge", "Rule_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "packages_", "(_", "cls_", ",_", "pool_", ",_", "packages_", ",_", "reason_", ",_", "reason", "\\u", "details_", "=_", "\"\"_", ",_", "job_", "=_", "None_", ",_", "id_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "literals_", "=_", "[_", "p_", "._", "id_", "for_", "p_", "in_", "packages_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "packages_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "(_", "pool_", ",_", "literals_", ",_", "reason_", ",_", "reason", "\\u", "details_", ",_", "job_", ",_", "id_", ",_", "packages_", "[_", "0_", "]_", "._", "version", "\\u", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "(_", "pool_", ",_", "literals_", ",_", "reason_", ",_", "reason", "\\u", "details_", ",_", "job_", ",_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Packa", "ge", "Rule_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "pool_", ",_", "literals_", ",_", "reason_", ",_", "reason", "\\u", "details_", "=_", "\"\"_", ",_", "job_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "-_", "1_", ",_", "version", "\\u", "factory_", "=_", "Semantic", "Version_", "._", "from", "\\u", "string_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "reason_", "==_", "\"", "job", "\\u", "install", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "is", "\\u", "valid", "\\u", "package", "\\u", "name_", "(_", "reason", "\\u", "details_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Dep", "Solve", "r", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reason", "\\u", "deta", "il", "s", " ", "must", " ", "be", " ", "a", " ", "valid", " ", "package", " ", "name", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"'", "job", "\\u", "install", "'", " ", "rule", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "reason_", "==_", "\"", "package", "\\u", "require", "s", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Requirement", "_", "._", "from", "\\u", "string_", "(_", "reason", "\\u", "details_", ",_", "version", "\\u", "factory_", "=_", "version", "\\u", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Dep", "Solve", "r", "Error_", "(_", "\"", "Inva", "lid", " ", "require", "ment", " ", "string", " ", "'%", "s", "'\"_", "%_", "(_", "reason", "\\u", "details_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "literals_", "=_", "sorted_", "(_", "literals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Packa", "ge", "Rule_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "pool_", "=_", "pool_", ",_", "literals_", "=_", "literals_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reason_", "=_", "reason_", ",_", "reason", "\\u", "details_", "=_", "reason", "\\u", "details_", ",_", "job_", "=_", "job_", ",_", "id_", "=_", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Packa", "ge", "Rule_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rule", "\\u", "hash_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "exact", " ", "rule", " ", "hash", " ", "algo", "rit", "hm", " ", "is", " ", "copie", "d", " ", "from", " ", "composer", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "\",\"_", "._", "join_", "(_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "self_", "._", "literals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "hashlib_", "._", "md5_", "(_", "data_", "._", "encode_", "(_", "'", "ascii", "'_", ")_", ")_", "._", "hexdigest_", "(_", ")_", "[_", ":_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Packa", "ge", "Rule_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "is", "\\u", "assertion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "literals_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Packa", "ge", "Rule_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "require", "d\\u", "package", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "reason_", "==_", "\"", "job", "\\u", "install", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "reason", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "reason_", "==_", "\"", "package", "\\u", "require", "s", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Requirement", "_", "._", "from", "\\u", "string_", "(_", "self_", "._", "reason", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Packa", "ge", "Rule_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "equivalent", "_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Tw", "o", " ", "rule", "s", " ", "are", " ", "consider", "ed", " ", "equivalent", " ", "if", " ", "the", "y", " ", "have", " ", "the", " ", "same", "\\", "10", ";", " ", " ", " ", " ", "literal", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "other_", ",_", "Packa", "ge", "Rule_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "literals_", "==_", "other_", "._", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Packa", "ge", "Rule_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\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_", "\"(", "%", "s", ")\"_", "%_", "\"", " ", "|", " ", "\"_", "._", "join_", "(_", "self_", "._", "pool_", "._", "id", "\\u", "to", "\\u", "string_", "(_", "l_", ")_", "for_", "l_", "in_", "self_", "._", "literals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Packa", "ge", "Rule_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\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_", "\"", "Packa", "ge", "Rule", "('", "%", "s", "',", " ", "'%", "s", "',", " ", "'%", "s", "')\"_", "%_", "(_", "\"", " ", "|", " ", "\"_", "._", "join_", "(_", "self_", "._", "pool_", "._", "id", "\\u", "to", "\\u", "string_", "(_", "l_", ")_", "for_", "l_", "in_", "self_", "._", "literals_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "reason_", ",_", "self_", "._", "reason", "\\u", "details_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Packa", "ge", "Rule_", "(_", "Has", "Trait", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "repr_", "(_", "self_", ")_", "==_", "repr_", "(_", "other_", ")_", "and_", "self_", "._", "reason_", "==_", "other_", "._", "reason_", "and_", "self_", "._", "reason", "\\u", "details_", "==_", "other_", "._", "reason", "\\u", "details_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
Southpaw-TACTIC/TACTIC/src/context/client/tactic-api-python-4.0.api04/Tools/Scripts/texi2html.py
[ { "content": " def parserest(self, fp, initial_lineno):\n lineno = initial_lineno\n self.done = 0\n self.skip = 0\n self.stack = []\n accu = []\n while not self.done:\n line = fp.readline()\n self.nodelineno = self.nodelineno + 1\n if not line:\n if accu:\n if not self.skip: self.process(accu)\n accu = []\n if initial_lineno > 0:\n print '*** EOF before @bye'\n break\n lineno = lineno + 1\n mo = cmprog.match(line)\n if mo:\n a, b = mo.span(1)\n cmd = line[a:b]\n if cmd in ('noindent', 'refill'):\n accu.append(line)\n else:\n if accu:\n if not self.skip:\n self.process(accu)\n accu = []\n self.command(line, mo)\n elif blprog.match(line) and \\\n 'format' not in self.stack and \\\n 'example' not in self.stack:\n if accu:\n if not self.skip:\n self.process(accu)\n if self.nofill:\n self.write('\\n')\n else:\n self.write('<P>\\n')\n accu = []\n else:\n # Append the line including trailing \\n!\n accu.append(line)\n #\n if self.skip:\n print '*** Still skipping at the end'\n if self.stack:\n print '*** Stack not empty at the end'\n print '***', self.stack\n if self.includedepth == 0:\n while self.nodestack:\n self.nodestack[-1].finalize()\n self.nodestack[-1].flush()\n del self.nodestack[-1]", "metadata": "root.TexinfoParser.parserest", "header": "['class', 'TexinfoParser', ':', '___EOS___']", "index": 263 }, { "content": " def makeref(self):\n text = self.collectsavings()\n args = [s.strip() for s in text.split(',')]\n while len(args) < 5: args.append('')\n nodename = label = args[0]\n if args[2]: label = args[2]\n file = args[3]\n title = args[4]\n href = makefile(nodename)\n if file:\n href = '../' + file + '/' + href\n self.write('<A HREF=\"', href, '\">', label, '</A>')", "metadata": "root.TexinfoParser.makeref", "header": "['class', 'TexinfoParser', ':', '___EOS___']", "index": 706 }, { "content": " def makeimage(self):\n text = self.collectsavings()\n args = [s.strip() for s in text.split(',')]\n while len(args) < 5: args.append('')\n filename = args[0]\n width = args[1]\n height = args[2]\n alt = args[3]\n ext = args[4]\n\n # The HTML output will have a reference to the image\n # that is relative to the HTML output directory,\n # which is what 'filename' gives us. However, we need\n # to find it relative to our own current directory,\n # so we construct 'imagename'.\n imagelocation = self.dirname + '/' + filename\n\n if os.path.exists(imagelocation+'.png'):\n filename += '.png'\n elif os.path.exists(imagelocation+'.jpg'):\n filename += '.jpg'\n elif os.path.exists(imagelocation+'.gif'): # MySQL uses GIF files\n filename += '.gif'\n else:\n print \"*** Cannot find image \" + imagelocation\n #TODO: what is 'ext'?\n self.write('<IMG SRC=\"', filename, '\"', \\\n width and (' WIDTH=\"' + width + '\"') or \"\", \\\n height and (' HEIGHT=\"' + height + '\"') or \"\", \\\n alt and (' ALT=\"' + alt + '\"') or \"\", \\\n '/>' )\n self.htmlhelp.addimage(imagelocation)", "metadata": "root.TexinfoParser.makeimage", "header": "['class', 'TexinfoParser', ':', '___EOS___']", "index": 742 } ]
[ { "span": "accu ", "start_line": 275, "start_column": 20, "end_line": 275, "end_column": 24 }, { "span": "title ", "start_line": 713, "start_column": 8, "end_line": 713, "end_column": 13 }, { "span": "ext ", "start_line": 750, "start_column": 8, "end_line": 750, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Tex", "info", "Parser_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parser", "est_", "(_", "self_", ",_", "fp_", ",_", "initial", "\\u", "lineno_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lineno_", "=_", "initial", "\\u", "lineno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "done_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "skip_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stack_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accu", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "self_", "._", "done_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "fp_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nodel", "inen", "o_", "=_", "self_", "._", "nodel", "inen", "o_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "accu", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "self_", "._", "skip_", ":_", "self_", "._", "process_", "(_", "accu", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accu", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "initial", "\\u", "lineno_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'**", "*", " ", "EO", "F", " ", "bef", "ore", " ", "@", "bye", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lineno_", "=_", "lineno_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mo_", "=_", "cmp", "rog", "_", "._", "match_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", ",_", "b_", "=_", "mo_", "._", "span_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "line_", "[_", "a_", ":_", "b_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cmd_", "in_", "(_", "'", "noin", "dent", "'_", ",_", "'", "refi", "ll", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "accu", "_", "._", "append_", "(_", "line_", ")_", "\\u\\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_", "accu", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "not_", "self_", "._", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "process_", "(_", "accu", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "accu", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "command_", "(_", "line_", ",_", "mo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "bl", "prog_", "._", "match_", "(_", "line_", ")_", "and_", "'", "format", "'_", "not_", "in_", "self_", "._", "stack_", "and_", "'", "example", "'_", "not_", "in_", "self_", "._", "stack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "accu", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "self_", "._", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "process_", "(_", "accu", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "nof", "ill", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "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 ", " ", " _", "self_", "._", "write_", "(_", "'<", "P", ">\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "accu", "_", "=_", "[_", "]_", "\\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_", "#", " ", "Append", " ", "the", " ", "line", " ", "inclu", "ding", " ", "trail", "ing", " ", "\\\\", "n", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "accu", "_", "._", "append_", "(_", "line_", ")_", "\\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_", "._", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'**", "*", " ", "Stil", "l", " ", "skip", "ping", " ", "at", " ", "the", " ", "end", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "stack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'**", "*", " ", "Stack", " ", "not", " ", "empty", " ", "at", " ", "the", " ", "end", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'**", "*'_", ",_", "self_", "._", "stack_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "include", "depth_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "self_", "._", "nodes", "tack_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nodes", "tack_", "[_", "-_", "1_", "]_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nodes", "tack_", "[_", "-_", "1_", "]_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "nodes", "tack_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tex", "info", "Parser_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "maker", "ef_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "self_", "._", "collect", "saving", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "s_", "._", "strip_", "(_", ")_", "for_", "s_", "in_", "text_", "._", "split_", "(_", "','_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "args_", ")_", "<_", "5_", ":_", "args_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodename_", "=_", "label_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "[_", "2_", "]_", ":_", "label_", "=_", "args_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "=_", "args_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "args_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "href_", "=_", "makefile_", "(_", "nodename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "href_", "=_", "'../", "'_", "+_", "file_", "+_", "'/'_", "+_", "href_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "write_", "(_", "'<", "A", " ", "HRE", "F", "=\"'_", ",_", "href_", ",_", "'\">", "'_", ",_", "label_", ",_", "'<", "/", "A", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tex", "info", "Parser_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "image_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "self_", "._", "collect", "saving", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "[_", "s_", "._", "strip_", "(_", ")_", "for_", "s_", "in_", "text_", "._", "split_", "(_", "','_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "args_", ")_", "<_", "5_", ":_", "args_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "args_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "args_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alt_", "=_", "args_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ext_", "=_", "args_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "HTM", "L", " ", "output", " ", "will", " ", "have", " ", "a", " ", "reference", " ", "to", " ", "the", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "is", " ", "relative", " ", "to", " ", "the", " ", "HTM", "L", " ", "output", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "is", " ", "what", " ", "'", "filename", "'", " ", "give", "s", " ", "us", ".", " ", "Ho", "we", "ver", ",", " ", "we", " ", "need", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "find", " ", "it", " ", "relative", " ", "to", " ", "our", " ", "own", " ", "current", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "we", " ", "construct", " ", "'", "imagen", "ame", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "image", "location_", "=_", "self_", "._", "dirname_", "+_", "'/'_", "+_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "image", "location_", "+_", "'.", "png", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "+=_", "'.", "png", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "exists_", "(_", "image", "location_", "+_", "'.", "jp", "g", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "+=_", "'.", "jp", "g", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "os_", "._", "path_", "._", "exists_", "(_", "image", "location_", "+_", "'.", "gif", "'_", ")_", ":_", "#", " ", "My", "SQL", " ", "use", "s", " ", "GIF", " ", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "+=_", "'.", "gif", "'_", "\\u\\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_", "\"**", "*", " ", "Cann", "ot", " ", "find", " ", "image", " ", "\"_", "+_", "image", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", ":", " ", "what", " ", "is", " ", "'", "ext", "'?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "write_", "(_", "'<", "IMG", " ", "SR", "C", "=\"'_", ",_", "filename_", ",_", "'\"'_", ",_", "width_", "and_", "(_", "'", " ", "WID", "TH", "=\"'_", "+_", "width_", "+_", "'\"'_", ")_", "or_", "\"\"_", ",_", "height_", "and_", "(_", "'", " ", "HE", "IGHT", "=\"'_", "+_", "height_", "+_", "'\"'_", ")_", "or_", "\"\"_", ",_", "alt_", "and_", "(_", "'", " ", "ALT", "=\"'_", "+_", "alt_", "+_", "'\"'_", ")_", "or_", "\"\"_", ",_", "'/>", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "html", "help_", "._", "add", "image_", "(_", "image", "location_", ")_", "\\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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unnecessary pass
BrightcoveOS/Diamond/src/diamond/handler/mysql.py
[ { "content": " def _send(self, data):\n \"\"\"\n Insert the data\n \"\"\"\n data = data.strip().split(' ')\n try:\n cursor = self.conn.cursor()\n cursor.execute(\"INSERT INTO %s (%s, %s, %s) VALUES(%%s, %%s, %%s)\"\n % (self.table, self.col_metric,\n self.col_time, self.col_value),\n (data[0], data[2], data[1]))\n cursor.close()\n self.conn.commit()\n # Insert data\n pass\n #self.socket.sendall(data)\n # Done\n except BaseException, e:\n # Log Error\n self.log.error(\"MySQLHandler: Failed sending data. %s.\", e)\n # Attempt to restablish connection\n self._connect()", "metadata": "root.MySQLHandler._send", "header": "['class', 'MySQLHandler', '(', 'Handler', ')', ':', '___EOS___']", "index": 72 } ]
[ { "span": "pass", "start_line": 86, "start_column": 12, "end_line": 86, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "My", "SQL", "Handler_", "(_", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "send_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Insert", " ", "the", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "data_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor_", "=_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"", "INSERT", " ", "INT", "O", " ", "%", "s", " ", "(%", "s", ",", " ", "%", "s", ",", " ", "%", "s", ")", " ", "VALU", "ES", "(%", "%", "s", ",", " ", "%%", "s", ",", " ", "%%", "s", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "self_", "._", "table_", ",_", "self_", "._", "col", "\\u", "metric_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "col", "\\u", "time_", ",_", "self_", "._", "col", "\\u", "value_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "data_", "[_", "0_", "]_", ",_", "data_", "[_", "2_", "]_", ",_", "data_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "conn_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Insert", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "socket", ".", "send", "all", "(", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Done_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Log", " ", "Error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "error_", "(_", "\"", "My", "SQL", "Handle", "r", ":", " ", "Fail", "ed", " ", "sendin", "g", " ", "data", ".", " ", "%", "s", ".\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Atte", "mpt", " ", "to", " ", "resta", "blis", "h", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "connect_", "(_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
timonus/OpenerManifest/minify.py
[ { "content": "import sys\nimport subprocess\nimport re\nimport os\nimport shutil\nimport json\nfrom collections import OrderedDict # http://stackoverflow.com/a/10982037\n\nif len(sys.argv) < 2:\n print \"No path specified\"\n sys.exit()\n \npath = sys.argv[1]\n\ndata = json.loads(open(path).read(), object_pairs_hook=OrderedDict) # http://stackoverflow.com/a/6921760\n\n# Strip unneeded keys from apps\nfor appIndex,app in enumerate(data['apps']):\n\tappKeys = app.keys()\n\tfor keyIndex,key in enumerate(appKeys):\n\t\tif not key in [\"identifier\", \"displayName\", \"storeIdentifier\", \"scheme\", \"new\", \"platform\", \"iconURL\", \"country\"]:\n\t\t\t# print \"Removing \" + key + \" from \" + app[\"identifier\"]\n\t\t\tapp.pop(key, None)\n\t\t\t\n# Strip unneeded keys from actions\nfor actionIndex,action in enumerate(data['actions']):\n\tactionKeys = action.keys()\n\tfor keyIndex,key in enumerate(actionKeys):\n\t\tif not key in [\"title\", \"regex\", \"includeHeaders\", \"formats\"]:\n\t\t\t# print \"Removing \" + key + \" from action\"\n\t\t\taction.pop(key, None)\n\t\t\n\t# Strip unneeded keys from formats\n\tfor format in action['formats']:\n\t\tformatKeys = format.keys()\n\t\tfor keyIndex,key in enumerate(formatKeys):\n\t\t\tif not key in [\"appIdentifier\", \"format\", \"script\"]:\n\t\t\t\t# print \"Removing \" + key + \" from format\"\n\t\t\t\tformat.pop(key, None)\n\n# Strip unneeded keys from browsers\nif 'browsers' in data:\n\tfor browserIndex,browser in enumerate(data['browsers']):\n\t\tbrowserKeys = browser.keys()\n\t\tfor keyIndex,key in enumerate(browserKeys):\n\t\t\tif not key in [\"identifier\", \"displayName\", \"storeIdentifier\", \"scheme\", \"new\", \"platform\", \"iconURL\", \"regex\", \"format\", \"script\"]:\n\t\t\t\t# print \"Removing \" + key + \" from browser\"\n\t\t\t\tbrowser.pop(key, None)\n\t\t\t\t\ndata = json.dumps(data, separators=(',',':'))\nopen(path.replace('.json', '-minified.json'), 'w').write(data)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import subprocess", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 17 }, { "span": "import re", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 9 }, { "span": "import os", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 9 }, { "span": "import shutil", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Order", "ed", "Dict_", "#", " ", "http", "://", "stack", "overflow", ".", "com", "/", "a", "/", "109", "820", "37_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "No", " ", "path", " ", "specified", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "json_", "._", "loads_", "(_", "open_", "(_", "path_", ")_", "._", "read_", "(_", ")_", ",_", "object\\u", "pair", "s", "\\u", "hook_", "=_", "Order", "ed", "Dict_", ")_", "#", " ", "http", "://", "stack", "overflow", ".", "com", "/", "a", "/", "692", "176", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Strip", " ", "unne", "eded", " ", "keys", " ", "from", " ", "apps_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "app", "Index_", ",_", "app_", "in_", "enumerate_", "(_", "data_", "[_", "'", "apps", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "app", "Keys_", "=_", "app_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key", "Index_", ",_", "key_", "in_", "enumerate_", "(_", "app", "Keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "not_", "key_", "in_", "[_", "\"", "identifi", "er", "\"_", ",_", "\"", "display", "Name", "\"_", ",_", "\"", "store", "Identifie", "r", "\"_", ",_", "\"", "sche", "me", "\"_", ",_", "\"", "new", "\"_", ",_", "\"", "platform", "\"_", ",_", "\"", "icon", "URL", "\"_", ",_", "\"", "countr", "y", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "Remo", "ving", " ", "\"", " ", "+", " ", "key", " ", "+", " ", "\"", " ", "from", " ", "\"", " ", "+", " ", "app", "[\"", "identifi", "er", "\"]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "app_", "._", "pop_", "(_", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Strip", " ", "unne", "eded", " ", "keys", " ", "from", " ", "actions_", "\\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_", "action", "Index_", ",_", "action_", "in_", "enumerate_", "(_", "data_", "[_", "'", "action", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "action", "Keys_", "=_", "action_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key", "Index_", ",_", "key_", "in_", "enumerate_", "(_", "action", "Keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "not_", "key_", "in_", "[_", "\"", "title", "\"_", ",_", "\"", "regex", "\"_", ",_", "\"", "include", "Head", "ers", "\"_", ",_", "\"", "formats", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "Remo", "ving", " ", "\"", " ", "+", " ", "key", " ", "+", " ", "\"", " ", "from", " ", "action", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "action_", "._", "pop_", "(_", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Strip", " ", "unne", "eded", " ", "keys", " ", "from", " ", "formats_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "format_", "in_", "action_", "[_", "'", "formats", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "format", "Keys_", "=_", "format_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key", "Index_", ",_", "key_", "in_", "enumerate_", "(_", "format", "Keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "not_", "key_", "in_", "[_", "\"", "app", "Identifie", "r", "\"_", ",_", "\"", "format", "\"_", ",_", "\"", "script", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "Remo", "ving", " ", "\"", " ", "+", " ", "key", " ", "+", " ", "\"", " ", "from", " ", "format", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "format_", "._", "pop_", "(_", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Strip", " ", "unne", "eded", " ", "keys", " ", "from", " ", "browsers", "_", "\\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_", "'", "browsers", "'_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "for_", "browse", "r", "Index_", ",_", "browser_", "in_", "enumerate_", "(_", "data_", "[_", "'", "browsers", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "browse", "r", "Keys_", "=_", "browser_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key", "Index_", ",_", "key_", "in_", "enumerate_", "(_", "browse", "r", "Keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "not_", "key_", "in_", "[_", "\"", "identifi", "er", "\"_", ",_", "\"", "display", "Name", "\"_", ",_", "\"", "store", "Identifie", "r", "\"_", ",_", "\"", "sche", "me", "\"_", ",_", "\"", "new", "\"_", ",_", "\"", "platform", "\"_", ",_", "\"", "icon", "URL", "\"_", ",_", "\"", "regex", "\"_", ",_", "\"", "format", "\"_", ",_", "\"", "script", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "Remo", "ving", " ", "\"", " ", "+", " ", "key", " ", "+", " ", "\"", " ", "from", " ", "browse", "r", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "browser_", "._", "pop_", "(_", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "json_", "._", "dumps_", "(_", "data_", ",_", "separators_", "=_", "(_", "','_", ",_", "':'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "path_", "._", "replace_", "(_", "'.", "json", "'_", ",_", "'-", "minif", "ied", ".", "json", "'_", ")_", ",_", "'", "w", "'_", ")_", "._", "write_", "(_", "data_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
swapagarwal/JARVIS-on-Messenger/modules/src/dictionary.py
[ { "content": "def process(input, entities):\n output = {}\n try:\n word = entities['word'][0]['value']\n r = requests.get('https://glosbe.com/gapi/translate?from=eng&dest=eng&format=json&phrase=' + word + '&pretty=true')\n data = r.json()\n output['input'] = input\n output['output'] = TextTemplate('Definition of ' + word + ':\\n' + data['tuc'][0]['meanings'][0]['text']).get_message()\n output['success'] = True\n except:\n output['success'] = False\n return output", "metadata": "root.process", "header": "['module', '___EOS___']", "index": 3 } ]
[ { "span": "except:", "start_line": 12, "start_column": 4, "end_line": 12, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process_", "(_", "input_", ",_", "entities_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "word_", "=_", "entities_", "[_", "'", "word", "'_", "]_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "requests_", "._", "get_", "(_", "'", "https", "://", "glo", "sb", "e", ".", "com", "/", "gap", "i", "/", "translat", "e", "?", "from", "=", "eng", "&", "dest", "=", "eng", "&", "format", "=", "json", "&", "phrase", "='_", "+_", "word_", "+_", "'&", "pretty", "=", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "r_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "input", "'_", "]_", "=_", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "output", "'_", "]_", "=_", "Text", "Template_", "(_", "'", "Definit", "ion", " ", "of", " ", "'_", "+_", "word_", "+_", "':", "\\\\", "n", "'_", "+_", "data_", "[_", "'", "tu", "c", "'_", "]_", "[_", "0_", "]_", "[_", "'", "meaning", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "text", "'_", "]_", ")_", "._", "get", "\\u", "message_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "success", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "[_", "'", "success", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "output_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
ganeti/ganeti/test/py/ganeti.confd.client_unittest.py
[ { "content": " def debug(string):\n self.debug_count += 1", "metadata": "root.MockLogger.debug", "header": "['class', 'MockLogger', '(', 'ResettableMock', ')', ':', '___EOS___']", "index": 59 }, { "content": " def warning(string):\n self.warn_count += 1", "metadata": "root.MockLogger.warning", "header": "['class', 'MockLogger', '(', 'ResettableMock', ')', ':', '___EOS___']", "index": 62 }, { "content": " def error(string):\n self.error_count += 1", "metadata": "root.MockLogger.error", "header": "['class', 'MockLogger', '(', 'ResettableMock', ')', ':', '___EOS___']", "index": 65 } ]
[ { "span": "def debug(string):", "start_line": 59, "start_column": 2, "end_line": 59, "end_column": 20 }, { "span": "def warning(string):", "start_line": 62, "start_column": 2, "end_line": 62, "end_column": 22 }, { "span": "def error(string):", "start_line": 65, "start_column": 2, "end_line": 65, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Moc", "k", "Logger_", "(_", "Reset", "table", "Mock_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "debug_", "(_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "debug", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Logger_", "(_", "Reset", "table", "Mock_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "warning_", "(_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "warn", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Moc", "k", "Logger_", "(_", "Reset", "table", "Mock_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "error_", "(_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error", "\\u", "count_", "+=_", "1_", "\\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, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
cholcombe973/autodock/verify.py
[ { "content": " def check_running_application(self, app):\n # TODO\n # Use the docker top command to see if cron is running instead of using ssh\n try:\n ssh = paramiko.SSHClient()\n ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())\n # Move this user/pass into a config file\n self.logger.info('SSHing into host {hostname}:{port}'.format(\n hostname=app.host_server, port=app.ssh_port))\n ssh.connect(hostname=app.host_server, port=app.ssh_port, \n username='root', password='newroot')\n # Is cron running?\n # If not run start.sh\n stdin, stdout, stderr = ssh.exec_command(\"pgrep cron\")\n output = stdout.readlines()\n self.logger.debug(output)\n\n if len(output) == 0:\n # cron isn't running\n self.logger.info(\"Cron is not running. Starting it back up\")\n stdin, stdout, stderr = ssh.exec_command(\"/root/start.sh\")\n else:\n self.logger.info(\"Cron is running.\")\n ssh.close()\n except SSHException:\n self.logger.error(\"Failed to log into server.\")\n # TODO should we delete this or ignore it?\n #self.delete_container(app.host_server, app.container_id)", "metadata": "root.VerifyFormations.check_running_application", "header": "['class', 'VerifyFormations', '(', 'object', ')', ':', '___EOS___']", "index": 147 } ]
[ { "span": "stdin,", "start_line": 167, "start_column": 8, "end_line": 167, "end_column": 13 }, { "span": "stdout,", "start_line": 167, "start_column": 15, "end_line": 167, "end_column": 21 }, { "span": "stderr ", "start_line": 167, "start_column": 23, "end_line": 167, "end_column": 29 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Verify", "Format", "ions_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "runn", "ing", "\\u", "application_", "(_", "self_", ",_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "docker", " ", "top", " ", "command", " ", "to", " ", "see", " ", "if", " ", "cron", " ", "is", " ", "runn", "ing", " ", "inst", "ead", " ", "of", " ", "usi", "ng", " ", "ssh_", "\\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 ", " _", "ssh_", "=_", "paramiko_", "._", "SSH", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssh_", "._", "set\\u", "missi", "ng", "\\u", "host", "\\u", "key", "\\u", "policy_", "(_", "paramiko_", "._", "Auto", "Add", "Policy_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Move", " ", "this", " ", "user", "/", "pass", " ", "int", "o", " ", "a", " ", "config", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "logger_", "._", "info_", "(_", "'", "SSH", "ing", " ", "int", "o", " ", "host", " ", "{", "host", "name", "}:", "{", "port", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "app_", "._", "host", "\\u", "server_", ",_", "port_", "=_", "app_", "._", "ssh", "\\u", "port_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssh_", "._", "connect_", "(_", "hostname_", "=_", "app_", "._", "host", "\\u", "server_", ",_", "port_", "=_", "app_", "._", "ssh", "\\u", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "'", "root", "'_", ",_", "password_", "=_", "'", "newr", "oot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Is", " ", "cron", " ", "runn", "ing", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "run", " ", "start", ".", "sh_", "\\u\\u\\uNL\\u\\u\\u_", "stdin_", ",_", "stdout_", ",_", "stderr_", "=_", "ssh_", "._", "exec", "\\u", "command_", "(_", "\"", "pgr", "ep", " ", "cron", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "stdout_", "._", "readlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "output_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cron", " ", "isn", "'", "t", " ", "running_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "info_", "(_", "\"", "Cro", "n", " ", "is", " ", "not", " ", "runn", "ing", ".", " ", " ", "Start", "ing", " ", "it", " ", "back", " ", "up", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stdin_", ",_", "stdout_", ",_", "stderr_", "=_", "ssh_", "._", "exec", "\\u", "command_", "(_", "\"/", "root", "/", "start", ".", "sh", "\"_", ")_", "\\u\\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_", "._", "logger_", "._", "info_", "(_", "\"", "Cro", "n", " ", "is", " ", "runn", "ing", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ssh_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "SSH", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "\"", "Fail", "ed", " ", "to", " ", "log", " ", "int", "o", " ", "server", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "shou", "ld", " ", "we", " ", "delete", " ", "this", " ", "or", " ", "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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, 0, 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
corydolphin/flask-cors/flask_cors/core.py
[ { "content": "def try_match(request_origin, pattern):\n \"\"\"Safely attempts to match a pattern or string to a request origin.\"\"\"\n try:\n if isinstance(pattern, RegexObject):\n return re.match(pattern, request_origin)\n else:\n return re.match(pattern, request_origin, flags=re.IGNORECASE)\n except:\n return request_origin == pattern", "metadata": "root.try_match", "header": "['module', '___EOS___']", "index": 242 } ]
[ { "span": "except:", "start_line": 249, "start_column": 4, "end_line": 249, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "try", "\\u", "match_", "(_", "request", "\\u", "origin_", ",_", "pattern_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Safe", "ly", " ", "atte", "mpt", "s", " ", "to", " ", "match", " ", "a", " ", "pattern", " ", "or", " ", "string", " ", "to", " ", "a", " ", "request", " ", "orig", "in", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "pattern_", ",_", "Rege", "x", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "re_", "._", "match_", "(_", "pattern_", ",_", "request", "\\u", "origin_", ")_", "\\u\\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_", "re_", "._", "match_", "(_", "pattern_", ",_", "request", "\\u", "origin_", ",_", "flags_", "=_", "re_", "._", "IGNORECASE_", ")_", "\\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 ", " _", "return_", "request", "\\u", "origin_", "==_", "pattern_", "\\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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Import of deprecated module
cloudera/hue/desktop/core/ext-py/pysaml2-2.4.0/src/saml2/s_utils.py
[ { "content": "#!/usr/bin/env python\nimport logging\nimport random\nimport string\n\nimport time\nimport base64\nimport sys\nimport hmac\nimport string\n\n# from python 2.5\nimport imp\nimport traceback\n\nif sys.version_info >= (2, 5):\n import hashlib\nelse: # before python 2.5\n import sha\n\nfrom saml2 import saml\nfrom saml2 import samlp\nfrom saml2 import VERSION\nfrom saml2.time_util import instant\n\ntry:\n from hashlib import md5\nexcept ImportError:\n from md5 import md5\nimport zlib\n\nlogger = logging.getLogger(__name__)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nEXCEPTION2STATUS = {\n VersionMismatch: samlp.STATUS_VERSION_MISMATCH,\n UnknownPrincipal: samlp.STATUS_UNKNOWN_PRINCIPAL,\n UnsupportedBinding: samlp.STATUS_UNSUPPORTED_BINDING,\n RequestVersionTooLow: samlp.STATUS_REQUEST_VERSION_TOO_LOW,\n RequestVersionTooHigh: samlp.STATUS_REQUEST_VERSION_TOO_HIGH,\n OtherError: samlp.STATUS_UNKNOWN_PRINCIPAL,\n MissingValue: samlp.STATUS_REQUEST_UNSUPPORTED,\n # Undefined\n Exception: samlp.STATUS_AUTHN_FAILED,\n}\n\nGENERIC_DOMAINS = [\"aero\", \"asia\", \"biz\", \"cat\", \"com\", \"coop\", \"edu\",\n \"gov\", \"info\", \"int\", \"jobs\", \"mil\", \"mobi\", \"museum\",\n \"name\", \"net\", \"org\", \"pro\", \"tel\", \"travel\"]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#----------------------------------------------------------------------------\n\n\n\n\n\n\n\n\n\n\n\n# --- attribute profiles -----\n\n# xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n# xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nFTICKS_FORMAT = \"F-TICKS/SWAMID/2.0%s#\"\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "sha", "start_line": 18, "start_column": 11, "end_line": 18, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hmac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "python", " ", "2.5_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "imp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "2_", ",_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "bef", "ore", " ", "python", " ", "2.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "saml", "2_", "import_", "saml", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "saml", "2_", "import_", "saml", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "saml", "2_", "import_", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "saml", "2_", "._", "time", "\\u", "util_", "import_", "instant", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "hashlib_", "import_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "md5_", "import_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "EXCEPTION", "2", "STATUS_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Version", "Mismatch", "_", ":_", "saml", "p_", "._", "STATUS", "\\u", "VERSI", "ON", "\\u", "MIS", "MATCH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Un", "know", "n", "Princip", "al_", ":_", "saml", "p_", "._", "STATUS", "\\u", "UNK", "NOW", "N", "\\u", "PRI", "NCI", "PAL", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Unsu", "ppo", "rted", "Binding_", ":_", "saml", "p_", "._", "STATUS", "\\u", "UNSU", "PPO", "RTED", "\\u", "BINDING", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Version", "Too", "Low_", ":_", "saml", "p_", "._", "STATUS", "\\u", "REQUEST", "\\u", "VERSI", "ON", "\\u", "TOO", "\\u", "LOW_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Request", "Version", "Too", "High_", ":_", "saml", "p_", "._", "STATUS", "\\u", "REQUEST", "\\u", "VERSI", "ON", "\\u", "TOO", "\\u", "HIGH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ot", "her", "Error_", ":_", "saml", "p_", "._", "STATUS", "\\u", "UNK", "NOW", "N", "\\u", "PRI", "NCI", "PAL", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Missing", "Value_", ":_", "saml", "p_", "._", "STATUS", "\\u", "REQUEST", "\\u", "UNSU", "PPO", "RTED", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unde", "fined", "_", "\\u\\u\\uNL\\u\\u\\u_", "Exception_", ":_", "saml", "p_", "._", "STATUS", "\\u", "AUTH", "N", "\\u", "FAILED_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "GENERIC", "\\u", "DOM", "AINS", "_", "=_", "[_", "\"", "aero", "\"_", ",_", "\"", "asia", "\"_", ",_", "\"", "biz", "\"_", ",_", "\"", "cat", "\"_", ",_", "\"", "com", "\"_", ",_", "\"", "coop", "\"_", ",_", "\"", "edu", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gov", "\"_", ",_", "\"", "info", "\"_", ",_", "\"", "int", "\"_", ",_", "\"", "jobs", "\"_", ",_", "\"", "mil", "\"_", ",_", "\"", "mobi", "\"_", ",_", "\"", "mus", "eum", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ",_", "\"", "net", "\"_", ",_", "\"", "org", "\"_", ",_", "\"", "pro", "\"_", ",_", "\"", "tel", "\"_", ",_", "\"", "travel", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "---", " ", "attribute", " ", "profile", "s", " ", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xml", "ns", ":", "xs", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xml", "ns", ":", "xsi", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "-", "instance", "\"_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "FT", "IC", "KS", "\\u", "FORMAT_", "=_", "\"", "F", "-", "TICK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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
nlloyd/SubliminalCollaborator/libs/twisted/web/client.py
[ { "content": " def handleStatus_301(self):\n l = self.headers.get('location')\n if not l:\n self.handleStatusDefault()\n return\n url = l[0]\n if self.followRedirect:\n scheme, host, port, path = \\\n _parse(url, defaultPort=self.transport.getPeer().port)\n\n self.factory._redirectCount += 1\n if self.factory._redirectCount >= self.factory.redirectLimit:\n err = error.InfiniteRedirection(\n self.status,\n 'Infinite redirection detected',\n location=url)\n self.factory.noPage(failure.Failure(err))\n self.quietLoss = True\n self.transport.loseConnection()\n return\n\n self._completelyDone = False\n self.factory.setURL(url)\n\n if self.factory.scheme == 'https':\n from twisted.internet import ssl\n contextFactory = ssl.ClientContextFactory()\n reactor.connectSSL(self.factory.host, self.factory.port,\n self.factory, contextFactory)\n else:\n reactor.connectTCP(self.factory.host, self.factory.port,\n self.factory)\n else:\n self.handleStatusDefault()\n self.factory.noPage(\n failure.Failure(\n error.PageRedirect(\n self.status, self.message, location = url)))\n self.quietLoss = True\n self.transport.loseConnection()", "metadata": "root.HTTPPageGetter.handleStatus_301", "header": "['class', 'HTTPPageGetter', '(', 'http', '.', 'HTTPClient', ')', ':', '___EOS___']", "index": 127 }, { "content": " def __init__(self, uri):\n self.uri = uri\n self.headers = Headers()\n self.type, rest = splittype(self.uri)\n self.host, rest = splithost(rest)", "metadata": "root._FakeUrllib2Request.__init__", "header": "['class', '_FakeUrllib2Request', '(', 'object', ')', ':', '___EOS___']", "index": 1263 } ]
[ { "span": "scheme,", "start_line": 134, "start_column": 12, "end_line": 134, "end_column": 18 }, { "span": "host,", "start_line": 134, "start_column": 20, "end_line": 134, "end_column": 24 }, { "span": "port,", "start_line": 134, "start_column": 26, "end_line": 134, "end_column": 30 }, { "span": "path ", "start_line": 134, "start_column": 32, "end_line": 134, "end_column": 36 }, { "span": "rest ", "start_line": 1267, "start_column": 19, "end_line": 1267, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "HTTP", "Page", "Getter", "_", "(_", "http_", "._", "HTTP", "Client_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "Status", "\\u", "301_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "self_", "._", "headers_", "._", "get_", "(_", "'", "location", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "handle", "Status", "Default_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "l_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "follow", "Redirect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheme_", ",_", "host_", ",_", "port_", ",_", "path_", "=_", "\\u", "parse_", "(_", "url_", ",_", "default", "Port_", "=_", "self_", "._", "transport_", "._", "get", "Peer", "_", "(_", ")_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", "._", "\\u", "redirec", "t", "Count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "factory_", "._", "\\u", "redirec", "t", "Count_", ">=_", "self_", "._", "factory_", "._", "redirec", "t", "Limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "error_", "._", "Infinit", "e", "Redirect", "ion_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "status_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Infinit", "e", " ", "redirection", " ", "detect", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "location_", "=_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factory_", "._", "no", "Page_", "(_", "failure_", "._", "Failure_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quie", "t", "Loss_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\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", "complete", "ly", "Done_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factory_", "._", "set", "URL_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "factory_", "._", "scheme_", "==_", "'", "https", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "twisted_", "._", "internet_", "import_", "ssl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "Factory_", "=_", "ssl_", "._", "Client", "Context", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reactor_", "._", "connect", "SSL_", "(_", "self_", "._", "factory_", "._", "host_", ",_", "self_", "._", "factory_", "._", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", ",_", "context", "Factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reactor_", "._", "connect", "TCP_", "(_", "self_", "._", "factory_", "._", "host_", ",_", "self_", "._", "factory_", "._", "port_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "factory_", ")_", "\\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 ", " _", "self_", "._", "handle", "Status", "Default_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factory_", "._", "no", "Page_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "failure_", "._", "Failure_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "error_", "._", "Page", "Redirect_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "status_", ",_", "self_", "._", "message_", ",_", "location_", "=_", "url_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "quie", "t", "Loss_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transport_", "._", "lose", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Fake", "Ur", "lli", "b2", "Request_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "uri_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "uri_", "=_", "uri_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "headers_", "=_", "Headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "type_", ",_", "rest_", "=_", "split", "type_", "(_", "self_", "._", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "host_", ",_", "rest_", "=_", "split", "host_", "(_", "rest_", ")_", "\\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, 0, 2, 0, 2, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
fabric/fabric/tests/support/decorated_fabfile_with_classbased_task.py
[ { "content": "from fabric import tasks\nfrom fabric.decorators import task\n\n\nfoo = ClassBasedTask()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ClassBasedTask(tasks.Task):\n", "metadata": "root.ClassBasedTask", "header": "['module', '___EOS___']", "index": 3 }, { "content": " def __init__(self):\n self.name = \"foo\"\n self.use_decorated = True", "metadata": "root.ClassBasedTask.__init__", "header": "['class', 'ClassBasedTask', '(', 'tasks', '.', 'Task', ')', ':', '___EOS___']", "index": 4 }, { "content": " def run(self, *args, **kwargs):\n pass", "metadata": "root.ClassBasedTask.run", "header": "['class', 'ClassBasedTask', '(', 'tasks', '.', 'Task', ')', ':', '___EOS___']", "index": 8 } ]
[ { "span": "from fabric.decorators import task", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "fabric_", "import_", "tasks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "decorators_", "import_", "task_", "\\u\\u\\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_", "foo_", "=_", "Class", "Base", "d", "Task_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Class", "Base", "d", "Task_", "(_", "tasks_", "._", "Task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Class", "Base", "d", "Task_", "(_", "tasks_", "._", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "\"", "foo", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "use", "\\u", "decorated_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Class", "Base", "d", "Task_", "(_", "tasks_", "._", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\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, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 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
anchor/make-magic/tests/test.py
[ { "content": "\tdef testTask(self):\n\t\ttask = bits.Task(tuple(), None, bits.TaskComplete(['fnord']))\n\t\ttask = bits.Task(('fish','heads'), None, bits.TaskComplete(['fnord']))", "metadata": "root.BitTests.testTask", "header": "['class', 'BitTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 11 } ]
[ { "span": "task ", "start_line": 12, "start_column": 2, "end_line": 12, "end_column": 6 } ]
[ { "span": "task ", "start_line": 13, "start_column": 2, "end_line": 13, "end_column": 6 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Bit", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "test", "Task_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "task_", "=_", "bits_", "._", "Task_", "(_", "tuple_", "(_", ")_", ",_", "None_", ",_", "bits_", "._", "Task", "Complete_", "(_", "[_", "'", "fno", "rd", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "=_", "bits_", "._", "Task_", "(_", "(_", "'", "fish", "'_", ",_", "'", "head", "s", "'_", ")_", ",_", "None_", ",_", "bits_", "._", "Task", "Complete_", "(_", "[_", "'", "fno", "rd", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ProgVal/Limnoria/plugins/Web/config.py
[ { "content": "###\n# Copyright (c) 2005, Jeremiah Fincher\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#\n# * Redistributions of source code must retain the above copyright notice,\n# this list of conditions, and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright notice,\n# this list of conditions, and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n# * Neither the name of the author of this software nor the name of\n# contributors to this software may be used to endorse or promote products\n# derived from this software without specific prior written consent.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n###\n\nimport supybot.conf as conf\nimport supybot.registry as registry\nfrom supybot.i18n import PluginInternationalization, internationalizeDocstring\n_ = PluginInternationalization('Web')\n\n\n\nWeb = conf.registerPlugin('Web')\nconf.registerChannelValue(Web, 'titleSnarfer',\n registry.Boolean(False, _(\"\"\"Determines whether the bot will output the\n HTML title of URLs it sees in the channel.\"\"\")))\nconf.registerChannelValue(Web, 'snarferReportIOExceptions',\n registry.Boolean(False, _(\"\"\"Determines whether the bot will notfiy the user\n about network exceptions like hostnotfound, timeout ....\"\"\")))\nconf.registerChannelValue(Web, 'snarferShowTargetDomain',\n registry.Boolean(False, _(\"\"\"Determines whether the domain name displayed\n by the snarfer will be the original one (posted on IRC) or the target one\n (got after following redirects, if any).\"\"\")))\nconf.registerChannelValue(Web, 'nonSnarfingRegexp',\n registry.Regexp(None, _(\"\"\"Determines what URLs matching the given regexp\n will not be snarfed. Give the empty string if you have no URLs that you'd\n like to exclude from being snarfed.\"\"\")))\nconf.registerChannelValue(Web, 'checkIgnored',\n registry.Boolean(True, _(\"\"\"Determines whether the title snarfer checks\n if the author of a message is ignored.\"\"\")))\n\nconf.registerGlobalValue(Web, 'urlWhitelist',\n registry.SpaceSeparatedListOfStrings([], \"\"\"If set, bot will only fetch data\n from urls in the whitelist, i.e. starting with http://domain/optionalpath/. This will\n apply to all commands that retrieve data from user-supplied URLs,\n including fetch, headers, title, doctype.\"\"\"))\n\nconf.registerGroup(Web, 'fetch')\nconf.registerGlobalValue(Web.fetch, 'maximum',\n registry.NonNegativeInteger(0, _(\"\"\"Determines the maximum number of\n bytes the bot will download via the 'fetch' command in this plugin.\"\"\")))\n\nconf.registerGlobalValue(Web.fetch, 'timeout',\n registry.NonNegativeInteger(5, \"\"\"Determines the maximum number of\n seconds the bot will wait for the site to respond, when using the 'fetch'\n command in this plugin. If 0, will use socket.defaulttimeout\"\"\"))\n\n# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def configure(advanced):\n # This will be called by supybot to configure this module. advanced is\n # a bool that specifies whether the user identified themself as an advanced\n # user or not. You should effect your configuration by manipulating the\n # registry as appropriate.\n from supybot.questions import expect, anything, something, yn\n Web = conf.registerPlugin('Web', True)\n if yn(\"\"\"This plugin also offers a snarfer that will try to fetch the\n title of URLs that it sees in the channel. Would like you this\n snarfer to be enabled?\"\"\", default=False):\n Web.titleSnarfer.setValue(True)", "metadata": "root.configure", "header": "['module', '___EOS___']", "index": 34 } ]
[ { "span": "from supybot.i18n import PluginInternationalization, internationalizeDocstring", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 78 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2005", ",", " ", "Jer", "emi", "ah", " ", "Fin", "cher", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", ",", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "list", " ", "of", " ", "condition", "s", ",", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "author", " ", "of", " ", "this", " ", "software", " ", "nor", " ", "the", " ", "name", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "consent", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "conf_", "as_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sup", "ybo", "t_", "._", "registry_", "as_", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sup", "ybo", "t_", "._", "i18n_", "import_", "Plug", "in", "Intern", "ation", "ali", "zation_", ",_", "international", "ize", "Docs", "tring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", "=_", "Plug", "in", "Intern", "ation", "ali", "zation_", "(_", "'", "Web", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Web", "_", "=_", "conf_", "._", "register", "Plugin_", "(_", "'", "Web", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Chan", "nel", "Value_", "(_", "Web", "_", ",_", "'", "title", "Sna", "rf", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Boolean_", "(_", "False_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "whe", "ther", " ", "the", " ", "bot", " ", "will", " ", "output", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "HTM", "L", " ", "title", " ", "of", " ", "URL", "s", " ", "it", " ", "see", "s", " ", "in", " ", "the", " ", "channel", ".\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Chan", "nel", "Value_", "(_", "Web", "_", ",_", "'", "sna", "rf", "er", "Report", "IO", "Except", "ion", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Boolean_", "(_", "False_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "whe", "ther", " ", "the", " ", "bot", " ", "will", " ", "not", "fi", "y", " ", "the", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "abo", "ut", " ", "network", " ", "exception", "s", " ", "like", " ", "host", "notfound", ",", " ", "timeo", "ut", " ", "....", "\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Chan", "nel", "Value_", "(_", "Web", "_", ",_", "'", "sna", "rf", "er", "Show", "Target", "Doma", "in", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Boolean_", "(_", "False_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "whe", "ther", " ", "the", " ", "domain", " ", "name", " ", "displaye", "d", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "the", " ", "sna", "rf", "er", " ", "will", " ", "be", " ", "the", " ", "original", " ", "one", " ", "(", "poste", "d", " ", "on", " ", "IR", "C", ")", " ", "or", " ", "the", " ", "target", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "(", "got", " ", "after", " ", "follow", "ing", " ", "redirec", "ts", ",", " ", "if", " ", "any", ").\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Chan", "nel", "Value_", "(_", "Web", "_", ",_", "'", "non", "Sna", "rfi", "ng", "Rege", "xp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Regexp_", "(_", "None_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "what", " ", "URL", "s", " ", "matchi", "ng", " ", "the", " ", "give", "n", " ", "regexp", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "not", " ", "be", " ", "sna", "rf", "ed", ".", " ", " ", "Give", " ", "the", " ", "empty", " ", "string", " ", "if", " ", "you", " ", "have", " ", "no", " ", "URL", "s", " ", "tha", "t", " ", "you", "'", "d", "\\", "10", ";", " ", " ", " ", " ", "like", " ", "to", " ", "exclu", "de", " ", "from", " ", "bei", "ng", " ", "sna", "rf", "ed", ".\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Chan", "nel", "Value_", "(_", "Web", "_", ",_", "'", "check", "Ignor", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Boolean_", "(_", "True_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "whe", "ther", " ", "the", " ", "title", " ", "sna", "rf", "er", " ", "checks", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "the", " ", "author", " ", "of", " ", "a", " ", "message", " ", "is", " ", "ignore", "d", ".\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conf_", "._", "register", "Global", "Value_", "(_", "Web", "_", ",_", "'", "url", "White", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Spac", "e", "Separate", "d", "List", "Of", "Strings_", "(_", "[_", "]_", ",_", "\"\"\"", "If", " ", "set", ",", " ", "bot", " ", "will", " ", "only", " ", "fetch", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "urls", " ", "in", " ", "the", " ", "whitelist", ",", " ", "i", ".", "e", ".", " ", "startin", "g", " ", "with", " ", "http", "://", "domain", "/", "option", "alp", "ath", "/.", " ", "Thi", "s", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "appl", "y", " ", "to", " ", "all", " ", "command", "s", " ", "tha", "t", " ", "retrieve", " ", "data", " ", "from", " ", "user", "-", "supplie", "d", " ", "URL", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "inclu", "ding", " ", "fetch", ",", " ", "header", "s", ",", " ", "title", ",", " ", "doct", "ype", ".\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conf_", "._", "register", "Group_", "(_", "Web", "_", ",_", "'", "fetch", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "._", "register", "Global", "Value_", "(_", "Web", "_", "._", "fetch_", ",_", "'", "maxim", "um", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Non", "Nega", "tiv", "e", "Integer_", "(_", "0_", ",_", "\\u_", "(_", "\"\"\"", "Det", "erm", "ine", "s", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "bytes", " ", "the", " ", "bot", " ", "will", " ", "download", " ", "via", " ", "the", " ", "'", "fetch", "'", " ", "command", " ", "in", " ", "this", " ", "plugin", ".\"\"\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "conf_", "._", "register", "Global", "Value_", "(_", "Web", "_", "._", "fetch_", ",_", "'", "timeo", "ut", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "registry_", "._", "Non", "Nega", "tiv", "e", "Integer_", "(_", "5_", ",_", "\"\"\"", "Det", "erm", "ine", "s", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "second", "s", " ", "the", " ", "bot", " ", "will", " ", "wait", " ", "for", " ", "the", " ", "site", " ", "to", " ", "respond", ",", " ", "whe", "n", " ", "usi", "ng", " ", "the", " ", "'", "fetch", "'", "\\", "10", ";", " ", " ", " ", " ", "command", " ", "in", " ", "this", " ", "plugin", ".", " ", "If", " ", "0", ",", " ", "will", " ", "use", " ", "socket", ".", "default", "timeo", "ut", "\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "set", " ", "shift", "widt", "h", "=", "4", " ", "soft", "tabs", "top", "=", "4", " ", "expand", "tab", " ", "text", "widt", "h", "=", "7", "9", ":_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "configure_", "(_", "advanced", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "be", " ", "call", "ed", " ", "by", " ", "sup", "ybo", "t", " ", "to", " ", "configur", "e", " ", "this", " ", "module", ".", " ", " ", "advanced", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "bool", " ", "tha", "t", " ", "speci", "fie", "s", " ", "whe", "ther", " ", "the", " ", "user", " ", "identifi", "ed", " ", "them", "self", " ", "as", " ", "an", " ", "advanced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", " ", "or", " ", "not", ".", " ", " ", "You", " ", "shou", "ld", " ", "effect", " ", "your", " ", "configura", "tion", " ", "by", " ", "manipulati", "ng", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "registr", "y", " ", "as", " ", "appropr", "iate", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sup", "ybo", "t_", "._", "questions_", "import_", "expect_", ",_", "anyt", "hing_", ",_", "something_", ",_", "yn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Web", "_", "=_", "conf_", "._", "register", "Plugin_", "(_", "'", "Web", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "yn_", "(_", "\"\"\"", "Thi", "s", " ", "plugin", " ", "als", "o", " ", "offers", " ", "a", " ", "sna", "rf", "er", " ", "tha", "t", " ", "will", " ", "try", " ", "to", " ", "fetch", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", "title", " ", "of", " ", "URL", "s", " ", "tha", "t", " ", "it", " ", "see", "s", " ", "in", " ", "the", " ", "channel", ".", " ", " ", "Wo", "ul", "d", " ", "like", " ", "you", " ", "this", "\\", "10", ";", " ", " ", " ", " ", " ", "sna", "rf", "er", " ", "to", " ", "be", " ", "enable", "d", "?\"\"\"_", ",_", "default_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Web", "_", "._", "title", "Sna", "rf", "er_", "._", "set", "Value_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
ejeschke/ginga/ginga/misc/Task.py
[ { "content": " def __init__(self, queue, waitflag=True, timeout=0.1, ev_quit=None):\n\n super(QueueTaskset, self).__init__()\n\n self.queue = queue\n self.waitflag = waitflag\n self.lock = threading.RLock()\n self.timeout = timeout\n self.task = None\n self.ev_cancel = threading.Event()\n self.ev_pause = threading.Event()\n if ev_quit == None:\n ev_quit = threading.Event()\n self.ev_quit = ev_quit", "metadata": "root.QueueTaskset.__init__", "header": "['class', 'QueueTaskset', '(', 'Task', ')', ':', '___EOS___']", "index": 743 }, { "content": " def execute(self):\n self.count = 0\n self.totaltime = 0\n self.logger.debug(\"Queue Taskset starting\")\n while not self.ev_quit.isSet():\n try:\n self.check_state()\n\n task = self.queue.get(block=True, timeout=self.timeout)\n if task == None:\n # termination sentinel\n break\n\n self.task = task\n\n task.register_callback(self.child_done, args=[task])\n\n with self.lock:\n self.count += 1\n\n self.ev_cancel.clear()\n try:\n task.initialize(self)\n\n self.logger.debug(\"Starting task '%s'\" % str(task))\n task.start()\n\n if self.waitflag:\n res = task.wait()\n\n self.logger.debug(\"Task %s terminated with result %s\" % (\n (str(task), str(res))))\n except Exception as e:\n self.logger.error(\"Task '%s' terminated with exception: %s\" % \\\n (str(task), str(e)))\n try:\n (type, value, tb) = sys.exc_info()\n self.logger.debug(\"Traceback:\\n%s\" % \\\n \"\".join(traceback.format_tb(tb)))\n\n # NOTE: to avoid creating a cycle that might cause\n # problems for GC--see Python library doc for sys\n # module\n tb = None\n\n except Exception as e:\n self.logger.debug(\"Traceback information unavailable.\")\n\n # If task raised exception then it didn't call done,\n task.done(e, noraise=True)\n\n except Queue.Empty:\n # No task available. Continue trying to get one.\n continue\n\n\n # TODO: should we wait for self.count > 0?\n self.logger.debug(\"Queue Taskset terminating\")\n\n return self.result", "metadata": "root.QueueTaskset.execute", "header": "['class', 'QueueTaskset', '(', 'Task', ')', ':', '___EOS___']", "index": 797 }, { "content": " def taskloop(self):\n self.setstatus('starting')\n self.logger.debug('Starting worker thread loop.')\n\n # If we were handed a thread pool upon startup, then register\n # ourselves with it.\n if self.tpool:\n self.tpool.register_up()\n\n try:\n self.setstatus('idle')\n while not self.ev_quit.isSet():\n try:\n\n # Wait on our queue for a task; will timeout in\n # self.timeout secs\n (priority, task) = self.queue.get(block=True,\n timeout=self.timeout)\n if task == None:\n # termination sentinel\n self.queue.put((priority, task))\n break\n\n self.execute(task)\n\n except _WorkerReset:\n self.logger.info(\"Worker reset!\")\n\n except Queue.Empty as e:\n # Reach here when we time out waiting for a task\n pass\n\n finally:\n self.logger.debug('Stopping worker thread loop.')\n\n if self.tpool:\n self.tpool.register_dn()\n\n self.setstatus('stopped')", "metadata": "root.WorkerThread.taskloop", "header": "['class', 'WorkerThread', '(', 'object', ')', ':', '___EOS___']", "index": 975 } ]
[ { "span": "ev_quit == None:", "start_line": 754, "start_column": 11, "end_line": 754, "end_column": 26 }, { "span": "task == None:", "start_line": 806, "start_column": 19, "end_line": 806, "end_column": 31 }, { "span": "task == None:", "start_line": 993, "start_column": 23, "end_line": 993, "end_column": 35 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Queue", "Task", "set_", "(_", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "queue_", ",_", "wait", "flag_", "=_", "True_", ",_", "timeout_", "=_", "0.1_", ",_", "ev", "\\u", "quit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Queue", "Task", "set_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "queue_", "=_", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wait", "flag_", "=_", "wait", "flag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock_", "=_", "threading_", "._", "RL", "ock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timeout_", "=_", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "task_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ev", "\\u", "cancel_", "=_", "threading_", "._", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ev", "\\u", "pause_", "=_", "threading_", "._", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ev", "\\u", "quit_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ev", "\\u", "quit_", "=_", "threading_", "._", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ev", "\\u", "quit_", "=_", "ev", "\\u", "quit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Queue", "Task", "set_", "(_", "Task_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "total", "time_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "Queue", " ", "Task", "set", " ", "startin", "g", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "self_", "._", "ev", "\\u", "quit_", "._", "is", "Set_", "(_", ")_", ":_", "\\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_", "._", "check", "\\u", "state_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "=_", "self_", "._", "queue_", "._", "get_", "(_", "block_", "=_", "True_", ",_", "timeout_", "=_", "self_", "._", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "task_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "termination", " ", "sentinel_", "\\u\\u\\uNL\\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_", "self_", "._", "task_", "=_", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "._", "register", "\\u", "callback_", "(_", "self_", "._", "child", "\\u", "done_", ",_", "args_", "=_", "[_", "task_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "ev", "\\u", "cancel_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "task_", "._", "initialize_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "Start", "ing", " ", "task", " ", "'%", "s", "'\"_", "%_", "str_", "(_", "task_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "wait", "flag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "res_", "=_", "task_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "Task", " ", "%", "s", " ", "terminate", "d", " ", "with", " ", "result", " ", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "str_", "(_", "task_", ")_", ",_", "str_", "(_", "res_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "logger_", "._", "error_", "(_", "\"", "Task", " ", "'%", "s", "'", " ", "terminate", "d", " ", "with", " ", "exception", ":", " ", "%", "s", "\"_", "%_", "(_", "str_", "(_", "task_", ")_", ",_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "(_", "type_", ",_", "value_", ",_", "tb_", ")_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "Trace", "back", ":\\\\", "n", "%", "s", "\"_", "%_", "\"\"_", "._", "join_", "(_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "to", " ", "avoid", " ", "creati", "ng", " ", "a", " ", "cycle", " ", "tha", "t", " ", "mig", "ht", " ", "cause_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "problem", "s", " ", "for", " ", "GC", "--", "see", " ", "Pyth", "on", " ", "librar", "y", " ", "doc", " ", "for", " ", "sys_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "tb_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "Trace", "back", " ", "informati", "on", " ", "unava", "ilab", "le", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "task", " ", "raise", "d", " ", "exception", " ", "then", " ", "it", " ", "did", "n", "'", "t", " ", "call", " ", "don", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "task_", "._", "done_", "(_", "e_", ",_", "nor", "ais", "e_", "=_", "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_", "except_", "Queue_", "._", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "task", " ", "avail", "able", ".", " ", " ", "Continu", "e", " ", "try", "ing", " ", "to", " ", "get", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "shou", "ld", " ", "we", " ", "wait", " ", "for", " ", "self", ".", "count", " ", ">", " ", "0", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "Queue", " ", "Task", "set", " ", "termina", "ting", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Worke", "r", "Thread_", "(_", "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_", "taskl", "oop", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sets", "tatus_", "(_", "'", "startin", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Start", "ing", " ", "worker", " ", "thread", " ", "loop", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "wer", "e", " ", "hande", "d", " ", "a", " ", "thread", " ", "pool", " ", "upo", "n", " ", "start", "up", ",", " ", "then", " ", "register_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ours", "elv", "es", " ", "with", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tpo", "ol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tpo", "ol_", "._", "register", "\\u", "up_", "(_", ")_", "\\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_", "._", "sets", "tatus_", "(_", "'", "idle", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "self_", "._", "ev", "\\u", "quit_", "._", "is", "Set_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wait", " ", "on", " ", "our", " ", "queue", " ", "for", " ", "a", " ", "task", ";", " ", "will", " ", "timeo", "ut", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "timeo", "ut", " ", "secs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "(_", "priority_", ",_", "task_", ")_", "=_", "self_", "._", "queue_", "._", "get_", "(_", "block_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timeout_", "=_", "self_", "._", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "task_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "termination", " ", "sentinel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "queue_", "._", "put_", "(_", "(_", "priority_", ",_", "task_", ")_", ")_", "\\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_", "self_", "._", "execute_", "(_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "\\u", "Worke", "r", "Reset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "logger_", "._", "info_", "(_", "\"", "Worke", "r", " ", "reset", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Empty_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reach", " ", "here", " ", "whe", "n", " ", "we", " ", "time", " ", "out", " ", "wait", "ing", " ", "for", " ", "a", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "debug_", "(_", "'", "Stopp", "ing", " ", "worker", " ", "thread", " ", "loop", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tpo", "ol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tpo", "ol_", "._", "register", "\\u", "dn_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sets", "tatus_", "(_", "'", "stopp", "ed", "'_", ")_", "\\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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, 2, 2, 2, 2, 2, 2 ]
Use of the return value of a procedure
brutasse/graphite-api/graphite_api/_vendor/whisper.py
[ { "content": "def update_many(path,points):\n \"\"\"update_many(path,points)\n\npath is a string\npoints is a list of (timestamp,value) points\n\"\"\"\n if not points: return\n points = [ (int(t),float(v)) for (t,v) in points]\n points.sort(key=lambda p: p[0],reverse=True) #order points by timestamp, newest first\n fh = None\n try:\n fh = open(path,'r+b')\n return file_update_many(fh, points)\n finally:\n if fh:\n fh.close()", "metadata": "root.update_many", "header": "['module', '___EOS___']", "index": 602 }, { "content": "def file_update_many(fh, points):\n if LOCK:\n fcntl.flock( fh.fileno(), fcntl.LOCK_EX )\n\n header = __readHeader(fh)\n now = int( time.time() )\n archives = iter( header['archives'] )\n currentArchive = next(archives)\n currentPoints = []\n\n for point in points:\n age = now - point[0]\n\n while currentArchive['retention'] < age: #we can't fit any more points in this archive\n if currentPoints: #commit all the points we've found that it can fit\n currentPoints.reverse() #put points in chronological order\n __archive_update_many(fh,header,currentArchive,currentPoints)\n currentPoints = []\n try:\n currentArchive = next(archives)\n except StopIteration:\n currentArchive = None\n break\n\n if not currentArchive:\n break #drop remaining points that don't fit in the database\n\n currentPoints.append(point)\n\n if currentArchive and currentPoints: #don't forget to commit after we've checked all the archives\n currentPoints.reverse()\n __archive_update_many(fh,header,currentArchive,currentPoints)\n\n if AUTOFLUSH:\n fh.flush()\n os.fsync(fh.fileno())", "metadata": "root.file_update_many", "header": "['module', '___EOS___']", "index": 620 } ]
[ { "span": "file_update_many(fh, points)", "start_line": 614, "start_column": 11, "end_line": 614, "end_column": 39 } ]
[ { "span": "def file_update_many(fh, points):", "start_line": 620, "start_column": 0, "end_line": 620, "end_column": 33 } ]
1
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "many_", "(_", "path_", ",_", "points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "update", "\\u", "many", "(", "path", ",", "points", ")", "\\", "10", ";", "\\", "10", ";", "path", " ", "is", " ", "a", " ", "string", "\\", "10", ";", "points", " ", "is", " ", "a", " ", "list", " ", "of", " ", "(", "timestamp", ",", "value", ")", " ", "points", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "points_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "=_", "[_", "(_", "int_", "(_", "t_", ")_", ",_", "float_", "(_", "v_", ")_", ")_", "for_", "(_", "t_", ",_", "v_", ")_", "in_", "points_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "points_", "._", "sort_", "(_", "key_", "=_", "lambda_", "p_", ":_", "p_", "[_", "0_", "]_", ",_", "reverse_", "=_", "True_", ")_", "#", "order", " ", "points", " ", "by", " ", "timestamp", ",", " ", "newest", " ", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "=_", "open_", "(_", "path_", ",_", "'", "r", "+", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "file", "\\u", "update", "\\u", "many_", "(_", "fh_", ",_", "points_", ")_", "\\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 ", " _", "if_", "fh_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "file", "\\u", "update", "\\u", "many_", "(_", "fh_", ",_", "points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "LOCK_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fcntl_", "._", "flock", "_", "(_", "fh_", "._", "fileno_", "(_", ")_", ",_", "fcntl_", "._", "LOCK", "\\u", "EX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header_", "=_", "\\u\\u", "read", "Header_", "(_", "fh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "archives", "_", "=_", "iter_", "(_", "header_", "[_", "'", "archives", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "Archive_", "=_", "next_", "(_", "archives", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "Points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "point_", "in_", "points_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "age_", "=_", "now_", "-_", "point_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "current", "Archive_", "[_", "'", "retention", "'_", "]_", "<_", "age_", ":_", "#", "we", " ", "can", "'", "t", " ", "fit", " ", "any", " ", "more", " ", "points", " ", "in", " ", "this", " ", "archive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "current", "Points_", ":_", "#", "commit", " ", "all", " ", "the", " ", "points", " ", "we", "'", "ve", " ", "found", " ", "tha", "t", " ", "it", " ", "can", " ", "fit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "Points_", "._", "reverse_", "(_", ")_", "#", "put", " ", "points", " ", "in", " ", "chrono", "logical", " ", "order_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "archive", "\\u", "update", "\\u", "many_", "(_", "fh_", ",_", "header_", ",_", "current", "Archive_", ",_", "current", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "Points_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "Archive_", "=_", "next_", "(_", "archives", "_", ")_", "\\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 ", " _", "current", "Archive_", "=_", "None_", "\\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_", "not_", "current", "Archive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "#", "drop", " ", "rema", "inin", "g", " ", "points", " ", "tha", "t", " ", "don", "'", "t", " ", "fit", " ", "in", " ", "the", " ", "database_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "Points_", "._", "append_", "(_", "point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "current", "Archive_", "and_", "current", "Points_", ":_", "#", "don", "'", "t", " ", "forget", " ", "to", " ", "commit", " ", "after", " ", "we", "'", "ve", " ", "checke", "d", " ", "all", " ", "the", " ", "archives", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "Points_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "archive", "\\u", "update", "\\u", "many_", "(_", "fh_", ",_", "header_", ",_", "current", "Archive_", ",_", "current", "Points_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "AUTO", "FLU", "SH_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "fs", "ync_", "(_", "fh_", "._", "fileno_", "(_", ")_", ")_", "\\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,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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 ]
Unused import
rapp-project/rapp-platform/rapp_cognitive_exercise/src/test_selector.py
[ { "content": "#!/usr/bin/env python\n# -*- encode: utf-8 -*-\n\n#Copyright 2015 RAPP\n\n#Licensed under the Apache License, Version 2.0 (the \"License\");\n#you may not use this file except in compliance with the License.\n#You may obtain a copy of the License at\n\n #http://www.apache.org/licenses/LICENSE-2.0\n\n#Unless required by applicable law or agreed to in writing, software\n#distributed under the License is distributed on an \"AS IS\" BASIS,\n#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n#See the License for the specific language governing permissions and\n#limitations under the License.\n\n# Author: Athanassios Kintsakis\n# contact: [email protected]\n\n\nimport rospkg\nimport rospy\nimport sys\nimport xml.etree.ElementTree as ET\nimport calendar\nimport time\nimport random\nfrom datetime import datetime\nfrom os.path import expanduser\nfrom collections import OrderedDict\nfrom random import randint\nfrom codecs import open\n\n\nfrom rapp_platform_ros_communications.srv import (\n ontologySubSuperClassesOfSrv,\n ontologySubSuperClassesOfSrvRequest,\n ontologySubSuperClassesOfSrvResponse,\n testSelectorSrv,\n testSelectorSrvResponse,\n createOntologyAliasSrv,\n createOntologyAliasSrvRequest,\n createOntologyAliasSrvResponse,\n userPerformanceCognitveTestsSrv,\n userPerformanceCognitveTestsSrvRequest,\n userPerformanceCognitveTestsSrvResponse,\n cognitiveTestsOfTypeSrv,\n cognitiveTestsOfTypeSrvRequest,\n cognitiveTestsOfTypeSrvResponse,\n fetchDataSrv,\n fetchDataSrvRequest,\n fetchDataSrvResponse\n )\n\nfrom rapp_platform_ros_communications.msg import (\n StringArrayMsg\n )\n\n## @class TestSelector\n# @brief Provides the necessary functions for selecting a cognitive exercise test\n#\n# It implements the cognitive exercise chooser service\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestSelector:\n ##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\n lookBackTimeStamp=15552000000 #15552000000 for last 3 months \n\n ## @brief The callback function of the cognitive exercise chooser service, all other functions of the class are called from within this function\n ## @brief The cognitive exercise chooser service callback\n # @param req [rapp_platform_ros_communications::testSelectorSrvRequest::Request&] The ROS service request\n # @param res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The ROS service response\n # @exception Exception IndexError\n # @exception Exception AIOError\n\n ## @brief Queries the MySQL database through the MySQL wrapper and returns the user's language\n # @param username [string] The username of the user as is in the MySQL database\n # @param res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n #\n # @return res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n # @return userLanguage [string] The user's language setting\n\n ## @brief Queries the ontology and returns the cognitive test types available\n # @param res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n #\n # @return res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n # @return testTypesList [list] The list of the available tests as they were read from the ontology\n \n ## @brief Determines the test type, if it was not provided in the service call as an argument. It selects the test category that was least recently used from the specific user\n # @param res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n # @param testTypesList [list] The list of the available tests as they were read from the ontology\n # @param userOntologyAlias [string] The user's ontology alias\n #\n # @return res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n # @return testType [string] The test type (category)\n \n ## @brief Organizes the test performance entries of the user by timestamp and determines the appropriate difficulty for the to be returned test\n # @param testType [string] The test type (category)\n # @param userOntologyAlias [string] The user's ontology alias\n # @param currentTimestamp [int] The timestamp at the time of the service call\n # @param lookBackTimeStamp [int] The look back timestamp. Default value is 3 months back from current time\n # @param res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n # @param modifier1 [int] The first difficulty modifier\n # @param modifier2 [int] The second difficulty modifier\n #\n # @return res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n # @return chosenDif [string] The chosen difficulty setting\n # @return noUserPerformanceRecordsExist [bool] True if no user performance records exit for the user for the given test type\n # @return userPerfOrganizedByTimestamp [OrderedDict] The user's performance records in a dictionary, ordered by timestamp \n \n ## @brief Gets the cognitive tests of the given type and difficulty available in the ontology \n # @param testType [string] The test type (category)\n # @param userLanguage [string] The user's language\n # @param chosenDif [string] The difficulty setting\n # @param res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n #\n # @return res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n # @return bool [bool] True if a non recoverable error occured, and the service must immediately return with an error report\n # @return testsOfTypeOrdered [dict] The cognitive tests of the given type and difficulty setting\n \n ## @brief Gets the least recently used test of the given test type and difficulty and obtains the path to the test xml file\n # @param testsOfTypeOrdered [dict] The cognitive tests of the given type and difficulty setting\n # @param noUserPerformanceRecordsExist [bool] True if no user performance records exit for the user for the given test type\n # @param userPerfOrganizedByTimestamp [OrderedDict] The user's performance records in a dictionary, ordered by timestamp \n # \n # @return finalTestFilePath [string] The file path of the xml file that contains the test\n # @return finalTestname [string] The name of the test \n\n ## @brief Retrieves the questions, answers etc of the test from the xml file\n # @param finalTestFilePath [string] The file path of the xml file that contains the test \n # @param res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n # @param userLanguage [string] The language of the user\n #\n # @return res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n\n ## @brief Organizes the user's performance entries by timestamp\n # @param d [dict] The dictionary containing the user's performance entries\n #\n # @return d [OrderedDict] The dictionary containing the user's performance entries organized by timestamp\n\n ## @brief Calculates the user's score from the performance entries\n # @param d [dict] The dictionary containing the cognitive test performance entries\n #\n # @return score [int] The user's score\n \n ## @brief Filters a dictionary containing cognitive tests by keeping only those of the given difficulty \n # @param testsOfType [dict] The dictionary containing the cognitive tests\n # @param res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n #\n # @return res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n # @return returnWithError [bool] True if a non recoverable error occured, and the service must immediately return with an error report\n # @return ontologyAlias [string] The user's ontology alias\n\n ## @brief Gets the users ontology alias and if it doesnt exist it creates it \n # @param username [string] The user's username\n # @param res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n #\n # @return res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n # @return returnWithError [bool] True if a non recoverable error occured, and the service must immediately return with an error report\n # @return ontologyAlias [string] The user's ontology alias\n\n ## @brief Load the difficulty modifiers from the ros yaml file \n # @param res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n #\n # @return res [rapp_platform_ros_communications::testSelectorSrvResponse::Response&] The output arguments of the service as defined in the testSelectorSrv\n # @return returnWithError [bool] True if a non recoverable error occured, and the service must immediately return with an error report\n # @return modifier1 [int] The first difficulty modifier\n # @return modifier2 [int] The second difficulty modifier", "metadata": "root.TestSelector", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def chooserFunction(self,req):\n\n try:\n res = testSelectorSrvResponse()\n currentTimestamp = int(time.time()) \n \n returnWithError,modifier1,modifier2=self.loadParamDifficultyModifiers(res)\n if(returnWithError):\n return res\n \n returnWithError,userOntologyAlias=self.getUserOntologyAlias(req.username,res)\n if(returnWithError):\n return res\n\n returnWithError,userLanguage=self.getUserLanguage(req.username,res)\n if(returnWithError):\n return res\n\n returnWithError,testTypesList=self.getTestTypesFromOntology(res)\n if(returnWithError):\n return res\n \n if(req.testType==\"\"):\n testType=self.determineTestTypeIfNotProvided(res,testTypesList,userOntologyAlias)\n else:\n if (req.testType not in testTypesList):\n res.trace.append(\"testType provided does not exist\")\n res.error=\"testType provided does not exist\"\n res.success=False\n return res\n else:\n testType=req.testType\n \n chosenDif,noUserPerformanceRecordsExist,userPerfOrganizedByTimestamp=self.organizeUserPerformanceByTimestampAndDetermineTestDifficulty(testType,userOntologyAlias,currentTimestamp,self.lookBackTimeStamp,res,modifier1,modifier2)\n \n returnWithError,testsOfTypeOrdered=self.getCognitiveTestsOfType(testType,userLanguage,chosenDif,res) \n if(returnWithError):\n return res \n\n finalTestFilePath,finalTestname=self.getLRUtestOfTypeAndXmlPath(testsOfTypeOrdered,noUserPerformanceRecordsExist,userPerfOrganizedByTimestamp)\n \n #Retrieve the name of the selected test\n tmpList=finalTestname.split('#')\n res.test=tmpList[1]\n\n #Parse the test xml file and retrieve the desired information\n rospack = rospkg.RosPack()\n localPackagePath=rospack.get_path('rapp_cognitive_exercise')\n finalTestFilePath=localPackagePath+finalTestFilePath\n res.trace.append(finalTestFilePath)\n self.retrieveDataFromTestXml(finalTestFilePath,res,userLanguage)\n res.language=userLanguage\n res.success=True\n\n except IndexError:\n res.trace.append(\"Null pointer exception.. some argument was empty\")\n res.error=\"Null pointer exception.. some argument was empty\"\n res.success=False\n except IOError:\n res.success=False\n res.trace.append(\"IO Error, cant open file or read data\")\n res.error=\"IO Error, cant open file or read data\"\n return res", "metadata": "root.TestSelector.chooserFunction", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 73 }, { "content": " def getUserLanguage(self,username,res):\n serv_topic = rospy.get_param('rapp_mysql_wrapper_user_fetch_data_topic')\t\n knowrob_service = rospy.ServiceProxy(serv_topic, fetchDataSrv)\n fetchDataSrvReq = fetchDataSrvRequest()\n fetchDataSrvReq.req_cols=[\"language\"]\n fetchDataSrvReq.where_data=[StringArrayMsg(s=[\"username\",username])]\n fetchDataSrvResponse = knowrob_service(fetchDataSrvReq)\n if(fetchDataSrvResponse.success.data!=True): \n res.trace.extend(fetchDataSrvResponse.trace)\n res.error=fetchDataSrvResponse.trace[0]\n res.success=False\n return True,\"\"\n return False,fetchDataSrvResponse.res_data[0].s[0]", "metadata": "root.TestSelector.getUserLanguage", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 143 }, { "content": " def getTestTypesFromOntology(self,res):\n serv_topic = rospy.get_param('rapp_knowrob_wrapper_subclasses_of_topic')\n knowrob_service = rospy.ServiceProxy(serv_topic, ontologySubSuperClassesOfSrv)\n testTypesReq = ontologySubSuperClassesOfSrvRequest()\n testTypesReq.ontology_class=\"CognitiveTests\"\n testTypesResponse = knowrob_service(testTypesReq)\n if(testTypesResponse.success!=True):\n res.trace.extend(testTypesResponse.trace)\n res.trace.append(\"cannot load test categories from ontology\")\n res.error=testTypesResponse.error+\"cannot load test categories from ontology\"\n res.success=False\n return True,\"\"\n testTypesList=[]\n for s in testTypesResponse.results:\n tmpList=s.split('#')\n testTypesList.append(tmpList[1])\n return False,testTypesList", "metadata": "root.TestSelector.getTestTypesFromOntology", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 162 }, { "content": " def determineTestTypeIfNotProvided(self,res,testTypesList,userOntologyAlias):\n serv_topic = rospy.get_param('rapp_knowrob_wrapper_user_performance_cognitve_tests') \n res.trace.append(\"no test type provided, will use least recently used\")\n noRecordsList=[]\n d1=OrderedDict()\n for s in testTypesList:\n userPerformanceReq=userPerformanceCognitveTestsSrvRequest()\n userPerformanceReq.test_type=s\n userPerformanceReq.ontology_alias=userOntologyAlias\n knowrob_service = rospy.ServiceProxy(serv_topic, userPerformanceCognitveTestsSrv)\n userPerformanceResponse = knowrob_service(userPerformanceReq)\n if(userPerformanceResponse.success!=True):\n noRecordsList.append(s)\n else:\n tmpUserPerfOrganizedByTimestamp=self.organizeUserPerformance(userPerformanceResponse)\n t1=tmpUserPerfOrganizedByTimestamp.items()[0][0]\n d1[t1]=[s]\n\n if(len(noRecordsList)>0):\n testType=random.choice(noRecordsList)\n res.trace.append(\"made random choice from the test types which were never used by the user, choice was: \"+ testType)\n else:\n d1=OrderedDict(sorted(d1.items(), key=lambda t: t[0]))\n testType=d1.values()[0][0]\n res.trace.append(\"all test types had performance records.. least recently used one was :\"+ testType)\n return testType ", "metadata": "root.TestSelector.determineTestTypeIfNotProvided", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 187 }, { "content": " def organizeUserPerformanceByTimestampAndDetermineTestDifficulty(self,testType,userOntologyAlias,currentTimestamp,lookBackTimeStamp,res,modifier1,modifier2):\n noUserPerformanceRecordsExist=False;\n chosenDif=\"1\"\n userPerformanceReq=userPerformanceCognitveTestsSrvRequest()\n userPerformanceReq.test_type=testType\n userPerformanceReq.ontology_alias=userOntologyAlias\n serv_topic = rospy.get_param('rapp_knowrob_wrapper_user_performance_cognitve_tests')\n knowrob_service = rospy.ServiceProxy(serv_topic, userPerformanceCognitveTestsSrv)\n userPerformanceResponse = knowrob_service(userPerformanceReq)\n \n userPerfOrganizedByTimestamp=[]\n if(userPerformanceResponse.success!=True):\n res.trace.extend(userPerformanceResponse.trace)\n res.trace.append(\"KnowRob wrapper returned no performance records for this user.. will start with a a difficulty setting of 1\")\n noUserPerformanceRecordsExist=True\n else:\n userPerfOrganizedByTimestamp=self.organizeUserPerformance(userPerformanceResponse)\n for k, v in userPerfOrganizedByTimestamp.items():\n if(currentTimestamp-k>lookBackTimeStamp):\n del userPerfOrganizedByTimestamp[k]\n else:\n break\n\n userScore=self.calculateUserScore(userPerfOrganizedByTimestamp)\n res.trace.append(\"user score :\"+str(userScore))\n if(userScore==0):\n chosenDif=\"1\"\n elif(userScore<modifier1):\n chosenDif=\"1\"\n elif(userScore<modifier2):\n chosenDif=\"2\"\n else: #(userScore>0.75*3*100)\n chosenDif=\"3\"\n res.trace.append(\"Chosen Diff :\"+chosenDif)\n return chosenDif,noUserPerformanceRecordsExist,userPerfOrganizedByTimestamp", "metadata": "root.TestSelector.organizeUserPerformanceByTimestampAndDetermineTestDifficulty", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 227 }, { "content": " def getCognitiveTestsOfType(self,testType,userLanguage,chosenDif,res):\n serv_topic = rospy.get_param('rapp_knowrob_wrapper_cognitive_tests_of_type')\n cognitiveTestsOfTypeSrvReq=cognitiveTestsOfTypeSrvRequest()\n cognitiveTestsOfTypeSrvReq.test_type=testType\n cognitiveTestsOfTypeSrvReq.test_language=userLanguage\n knowrob_service = rospy.ServiceProxy(serv_topic, cognitiveTestsOfTypeSrv)\n cognitiveTestsOfTypeResponse = knowrob_service(cognitiveTestsOfTypeSrvReq)\n\n if(cognitiveTestsOfTypeResponse.success!=True):\n res.trace.extend(cognitiveTestsOfTypeResponse.trace)\n res.error=cognitiveTestsOfTypeResponse.error\n res.success=False\n return True,\"\"\n\n success,testsOfTypeOrdered=self.filterTestsbyDifficulty(cognitiveTestsOfTypeResponse,chosenDif,res)\n\n if(not success):\n res.trace.append(\"Error, no tests of type contained in the ontology... cannot proceed\")\n res.error=\"Error, no tests of type contained in the ontology... cannot proceed\"\n res.success=False\n return True,\"\"\n return False,testsOfTypeOrdered", "metadata": "root.TestSelector.getCognitiveTestsOfType", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 272 }, { "content": " def getLRUtestOfTypeAndXmlPath(self,testsOfTypeOrdered,noUserPerformanceRecordsExist,userPerfOrganizedByTimestamp):\n #Choose \n finalTestname=\"\"\n finalTestFilePath=\"\"\n if(noUserPerformanceRecordsExist):\n finalTestname=random.choice(testsOfTypeOrdered.keys())\n finalTest=testsOfTypeOrdered[finalTestname]\n finalTestFilePath=finalTest[0][0]\n else:\n testsOfTypeOrderedCopy=testsOfTypeOrdered.copy()\n for k, v in userPerfOrganizedByTimestamp.items():\n if(v[0][0] in testsOfTypeOrderedCopy):\n del testsOfTypeOrderedCopy[v[0][0]]\n\n if(len(testsOfTypeOrderedCopy)>0):\n finalTestname=random.choice(testsOfTypeOrderedCopy.keys())\n finalTest=testsOfTypeOrderedCopy[finalTestname]\n finalTestFilePath=finalTest[0][0]\n else:\n finalTestname=userPerfOrganizedByTimestamp.values()[len(userPerfOrganizedByTimestamp)-1]\n finalTestname=finalTestname[0][0]\n finalTest=testsOfTypeOrdered[finalTestname]\n finalTestFilePath=finalTest[0][0]\n return finalTestFilePath,finalTestname", "metadata": "root.TestSelector.getLRUtestOfTypeAndXmlPath", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 302 }, { "content": " def retrieveDataFromTestXml(self,finalTestFilePath,res,userLanguage):\n tree = ET.parse(finalTestFilePath)\n root = tree.getroot()\n res.testType=root.find(\"testType\").text.encode('UTF-8')\n res.testSubType=root.find(\"testSubType\").text.encode('UTF-8')\n language=root.find('Languages')\n\n for question in language.find(userLanguage):\n res.questions.append(question.find(\"body\").text.encode('UTF-8'))\n res.correctAnswers.append(question.find(\"correctAnswer\").text.encode('UTF-8'))\n line=StringArrayMsg()\n for answers in question.findall('answer'):\n line.s.append(answers.find(\"body\").text.encode('UTF-8'))\n res.answers.append(line)", "metadata": "root.TestSelector.retrieveDataFromTestXml", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 333 }, { "content": " def organizeUserPerformance(self,userPerf):\n d=OrderedDict()\n for i in range(len(userPerf.tests)):\n tlist=[userPerf.tests[i],userPerf.scores[i],userPerf.difficulty[i]]\n d[int(userPerf.timestamps[i])]=[tlist]\n d=OrderedDict(sorted(d.items(), key=lambda t: t[0], reverse=True))\n return d", "metadata": "root.TestSelector.organizeUserPerformance", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 352 }, { "content": " def calculateUserScore(self,d):\n score=0\n if (len(d)>0):\n for k, v in d.items():\n score=score+int(v[0][1])*int(v[0][2])\n score=score/len(d)\n return score\n else:\n return 0", "metadata": "root.TestSelector.calculateUserScore", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 364 }, { "content": " def filterTestsbyDifficulty(self,testsOfType,chosenDif,res):\n success=False\n d=dict()\n intDif=int(chosenDif)\n if(intDif==0):\n return success,d\n else:\n for i in range(len(testsOfType.tests)):\n if(testsOfType.difficulty[i]==chosenDif):\n tlist=[testsOfType.file_paths[i],testsOfType.difficulty[i],testsOfType.subtype[i]]\n d[testsOfType.tests[i]]=[tlist]\n\n if(not len(d)>0):\n res.trace.append(\"downscaling difficulty by 1 as no test exists for diff = \" +chosenDif);\n chosenDif=str(int(chosenDif)-1)\n success,d=self.filterTestsbyDifficulty(testsOfType,chosenDif,res)\n else:\n success=True\n return success,d", "metadata": "root.TestSelector.filterTestsbyDifficulty", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 381 }, { "content": " def getUserOntologyAlias(self,username,res):\n serv_topic = rospy.get_param('rapp_knowrob_wrapper_create_ontology_alias') \n knowrob_service = rospy.ServiceProxy(serv_topic, createOntologyAliasSrv)\n createOntologyAliasReq = createOntologyAliasSrvRequest()\n createOntologyAliasReq.username=username\n createOntologyAliasResponse = knowrob_service(createOntologyAliasReq)\n if(createOntologyAliasResponse.success!=True):\n res.trace.extend(createOntologyAliasResponse.trace)\n res.error=createOntologyAliasResponse.error\n res.success=False\n returnWithError=True;\n return True,\"\"\n return False,createOntologyAliasResponse.ontology_alias", "metadata": "root.TestSelector.getUserOntologyAlias", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 408 }, { "content": " def loadParamDifficultyModifiers(self,res):\n modifier1 = rospy.get_param('rapp_cognitive_test_selector_difficulty_modifier_1_from_1_to_2')\n if(not modifier1):\n rospy.logerror(\"rapp_cognitive_test_selector_difficulty_modifier_1_from_1_to_2 param not found\")\n res.trace.extend(\"rapp_cognitive_test_selector_difficulty_modifier_1_from_1_to_2 param not found\")\n res.error=\"rapp_cognitive_test_selector_difficulty_modifier_1_from_1_to_2 param not found\"\n res.success=False\n returnWithError=True;\n return True,\"\",\"\"\n modifier2 = rospy.get_param('rapp_cognitive_test_selector_difficulty_modifier_2_from_2_to_3') \n if(not modifier2):\n rospy.logerror(\"rapp_cognitive_test_selector_difficulty_modifier_2_from_2_to_3 param not found\")\n res.trace.extend(\"rapp_cognitive_test_selector_difficulty_modifier_2_from_2_to_3 param not found\")\n res.error=\"rapp_cognitive_test_selector_difficulty_modifier_2_from_2_to_3 param not found\"\n res.success=False\n returnWithError=True;\n return True,\"\",\"\"\n modifier1=int(modifier1)\n modifier2=int(modifier2)\n return False,modifier1,modifier2", "metadata": "root.TestSelector.loadParamDifficultyModifiers", "header": "['class', 'TestSelector', ':', '___NEWLINE___', \"##This variable refers to the length of time backwards that the user's cognitive test performance records will be queried, default value is 15552000000 -3 months\", '___NL___', '___EOS___']", "index": 429 } ]
[ { "span": "import sys", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 10 }, { "span": "import calendar", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 15 }, { "span": "from os.path import expanduser", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 30 }, { "span": "from random import randint", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 26 }, { "span": "from codecs import open", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 23 }, { "span": "from rapp_platform_ros_communications.srv import (\n ontologySubSuperClassesOfSrv,\n ontologySubSuperClassesOfSrvRequest,\n ontologySubSuperClassesOfSrvResponse,\n testSelectorSrv,\n testSelectorSrvResponse,\n createOntologyAliasSrv,\n createOntologyAliasSrvRequest,\n createOntologyAliasSrvResponse,\n userPerformanceCognitveTestsSrv,\n userPerformanceCognitveTestsSrvRequest,\n userPerformanceCognitveTestsSrvResponse,\n cognitiveTestsOfTypeSrv,\n cognitiveTestsOfTypeSrvRequest,\n cognitiveTestsOfTypeSrvResponse,\n fetchDataSrv,\n fetchDataSrvRequest,\n fetchDataSrvResponse\n )", "start_line": 35, "start_column": 0, "end_line": 53, "end_column": 3 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "encode", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Copy", "right", " ", "201", "5", " ", "RA", "PP", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", ":", " ", "Ath", "ana", "ssi", "os", " ", "Kin", "tsa", "kis", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contact", ":", " ", "aki", "nts", "aki", "s", "@", "isse", "l", ".", "ee", ".", "auth", ".", "gr_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "ros", "pkg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "rospy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xml_", "._", "etree_", "._", "Element", "Tree_", "as_", "ET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "calendar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "expanduser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "random_", "import_", "randint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "codecs_", "import_", "open_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s_", "._", "srv_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ontology", "Sub", "Super", "Class", "es", "Of", "Sr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ontology", "Sub", "Super", "Class", "es", "Of", "Sr", "v", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ontology", "Sub", "Super", "Class", "es", "Of", "Sr", "v", "Response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Select", "or", "Sr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test", "Select", "or", "Sr", "v", "Response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "Ont", "olog", "y", "Ali", "as", "Sr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "Ont", "olog", "y", "Ali", "as", "Sr", "v", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "Ont", "olog", "y", "Ali", "as", "Sr", "v", "Response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "Perform", "anc", "e", "Cog", "nit", "ve", "Test", "s", "Sr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "Perform", "anc", "e", "Cog", "nit", "ve", "Test", "s", "Sr", "v", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "Perform", "anc", "e", "Cog", "nit", "ve", "Test", "s", "Sr", "v", "Response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Sr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Sr", "v", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Sr", "v", "Response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fetch", "Data", "Sr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fetch", "Data", "Sr", "v", "Request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fetch", "Data", "Sr", "v", "Response_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s_", "._", "msg_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "String", "Array", "Msg_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "class", " ", "Test", "Selector_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "brief", " ", "Prov", "ides", " ", "the", " ", "necessar", "y", " ", "function", "s", " ", "for", " ", "selecti", "ng", " ", "a", " ", "cogni", "tiv", "e", " ", "exercise", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "implement", "s", " ", "the", " ", "cogni", "tiv", "e", " ", "exercise", " ", "choose", "r", " ", "service_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "look", "Back", "Time", "Stamp_", "=_", "155", "520", "00000_", "#", "155", "520", "00000", " ", "for", " ", "last", " ", "3", " ", "month", "s", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "The", " ", "callback", " ", "function", " ", "of", " ", "the", " ", "cogni", "tiv", "e", " ", "exercise", " ", "choose", "r", " ", "service", ",", " ", "all", " ", "other", " ", "function", "s", " ", "of", " ", "the", " ", "class", " ", "are", " ", "call", "ed", " ", "from", " ", "within", " ", "this", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "The", " ", "cogni", "tiv", "e", " ", "exercise", " ", "choose", "r", " ", "service", " ", "callback_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "req", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Request", "::", "Request", "&]", " ", "The", " ", "ROS", " ", "service", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "ROS", " ", "service", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "exception", " ", "Except", "ion", " ", "Index", "Error_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "exception", " ", "Except", "ion", " ", "AI", "OE", "rror_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Querie", "s", " ", "the", " ", "My", "SQL", " ", "databa", "se", " ", "through", " ", "the", " ", "My", "SQL", " ", "wrapp", "er", " ", "and", " ", "return", "s", " ", "the", " ", "user", "'", "s", " ", "language_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "user", "name", " ", "[", "string", "]", " ", "The", " ", "user", "name", " ", "of", " ", "the", " ", "user", " ", "as", " ", "is", " ", "in", " ", "the", " ", "My", "SQL", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "user", "Lang", "ua", "ge", " ", "[", "string", "]", " ", "The", " ", "user", "'", "s", " ", "language", " ", "setting_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Querie", "s", " ", "the", " ", "ontology", " ", "and", " ", "return", "s", " ", "the", " ", "cogni", "tiv", "e", " ", "test", " ", "types", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "test", "Type", "s", "List", " ", "[", "list", "]", " ", "The", " ", "list", " ", "of", " ", "the", " ", "avail", "able", " ", "tests", " ", "as", " ", "the", "y", " ", "wer", "e", " ", "read", " ", "from", " ", "the", " ", "ontology", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Det", "erm", "ine", "s", " ", "the", " ", "test", " ", "type", ",", " ", "if", " ", "it", " ", "was", " ", "not", " ", "provided", " ", "in", " ", "the", " ", "service", " ", "call", " ", "as", " ", "an", " ", "argu", "ment", ".", " ", "It", " ", "select", "s", " ", "the", " ", "test", " ", "category", " ", "tha", "t", " ", "was", " ", "leas", "t", " ", "recent", "ly", " ", "used", " ", "from", " ", "the", " ", "specific", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "test", "Type", "s", "List", " ", "[", "list", "]", " ", "The", " ", "list", " ", "of", " ", "the", " ", "avail", "able", " ", "tests", " ", "as", " ", "the", "y", " ", "wer", "e", " ", "read", " ", "from", " ", "the", " ", "ontology", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "user", "Ont", "olog", "y", "Ali", "as", " ", "[", "string", "]", " ", "The", " ", "user", "'", "s", " ", "ontology", " ", "alias_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "test", "Type", " ", "[", "string", "]", " ", "The", " ", "test", " ", "type", " ", "(", "category", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Organiz", "es", " ", "the", " ", "test", " ", "perform", "anc", "e", " ", "entri", "es", " ", "of", " ", "the", " ", "user", " ", "by", " ", "timestamp", " ", "and", " ", "dete", "rmin", "es", " ", "the", " ", "appropr", "iate", " ", "difficult", "y", " ", "for", " ", "the", " ", "to", " ", "be", " ", "return", "ed", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "test", "Type", " ", "[", "string", "]", " ", "The", " ", "test", " ", "type", " ", "(", "category", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "user", "Ont", "olog", "y", "Ali", "as", " ", "[", "string", "]", " ", "The", " ", "user", "'", "s", " ", "ontology", " ", "alias_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "current", "Timest", "amp", " ", "[", "int", "]", " ", "The", " ", "timestamp", " ", "at", " ", "the", " ", "time", " ", "of", " ", "the", " ", "service", " ", "call_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "look", "Back", "Time", "Sta", "mp", " ", "[", "int", "]", " ", "The", " ", "look", " ", "back", " ", "timestamp", ".", " ", "Default", " ", "value", " ", "is", " ", "3", " ", "month", "s", " ", "back", " ", "from", " ", "current", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "modifier", "1", " ", "[", "int", "]", " ", "The", " ", "first", " ", "difficult", "y", " ", "modifier_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "modifier", "2", " ", "[", "int", "]", " ", "The", " ", "second", " ", "difficult", "y", " ", "modifier_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "chosen", "Di", "f", " ", "[", "string", "]", " ", "The", " ", "chosen", " ", "difficult", "y", " ", "setting_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "no", "User", "Perform", "anc", "e", "Record", "s", "Exist", " ", "[", "bool", "]", " ", "Tru", "e", " ", "if", " ", "no", " ", "user", " ", "perform", "anc", "e", " ", "record", "s", " ", "exit", " ", "for", " ", "the", " ", "user", " ", "for", " ", "the", " ", "give", "n", " ", "test", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "user", "Perf", "Organiz", "ed", "By", "Timest", "amp", " ", "[", "Order", "ed", "Dict", "]", " ", "The", " ", "user", "'", "s", " ", "perform", "anc", "e", " ", "record", "s", " ", "in", " ", "a", " ", "dictionar", "y", ",", " ", "order", "ed", " ", "by", " ", "timestamp", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Get", "s", " ", "the", " ", "cogni", "tiv", "e", " ", "tests", " ", "of", " ", "the", " ", "give", "n", " ", "type", " ", "and", " ", "difficult", "y", " ", "avail", "able", " ", "in", " ", "the", " ", "ontology", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "test", "Type", " ", "[", "string", "]", " ", "The", " ", "test", " ", "type", " ", "(", "category", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "user", "Lang", "ua", "ge", " ", "[", "string", "]", " ", "The", " ", "user", "'", "s", " ", "language_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "chosen", "Di", "f", " ", "[", "string", "]", " ", "The", " ", "difficult", "y", " ", "setting_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "bool", " ", "[", "bool", "]", " ", "Tru", "e", " ", "if", " ", "a", " ", "non", " ", "recover", "able", " ", "error", " ", "occure", "d", ",", " ", "and", " ", "the", " ", "service", " ", "must", " ", "immediate", "ly", " ", "return", " ", "with", " ", "an", " ", "error", " ", "report_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "tests", "Of", "Type", "Order", "ed", " ", "[", "dict", "]", " ", "The", " ", "cogni", "tiv", "e", " ", "tests", " ", "of", " ", "the", " ", "give", "n", " ", "type", " ", "and", " ", "difficult", "y", " ", "setting_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Get", "s", " ", "the", " ", "leas", "t", " ", "recent", "ly", " ", "used", " ", "test", " ", "of", " ", "the", " ", "give", "n", " ", "test", " ", "type", " ", "and", " ", "difficult", "y", " ", "and", " ", "obtain", "s", " ", "the", " ", "path", " ", "to", " ", "the", " ", "test", " ", "xml", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "tests", "Of", "Type", "Order", "ed", " ", "[", "dict", "]", " ", "The", " ", "cogni", "tiv", "e", " ", "tests", " ", "of", " ", "the", " ", "give", "n", " ", "type", " ", "and", " ", "difficult", "y", " ", "setting_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "no", "User", "Perform", "anc", "e", "Record", "s", "Exist", " ", "[", "bool", "]", " ", "Tru", "e", " ", "if", " ", "no", " ", "user", " ", "perform", "anc", "e", " ", "record", "s", " ", "exit", " ", "for", " ", "the", " ", "user", " ", "for", " ", "the", " ", "give", "n", " ", "test", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "user", "Perf", "Organiz", "ed", "By", "Timest", "amp", " ", "[", "Order", "ed", "Dict", "]", " ", "The", " ", "user", "'", "s", " ", "perform", "anc", "e", " ", "record", "s", " ", "in", " ", "a", " ", "dictionar", "y", ",", " ", "order", "ed", " ", "by", " ", "timestamp", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "final", "Test", "File", "Path", " ", "[", "string", "]", " ", "The", " ", "file", " ", "path", " ", "of", " ", "the", " ", "xml", " ", "file", " ", "tha", "t", " ", "contain", "s", " ", "the", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "final", "Test", "name", " ", "[", "string", "]", " ", "The", " ", "name", " ", "of", " ", "the", " ", "test", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Retrieve", "s", " ", "the", " ", "question", "s", ",", " ", "answer", "s", " ", "etc", " ", "of", " ", "the", " ", "test", " ", "from", " ", "the", " ", "xml", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "final", "Test", "File", "Path", " ", "[", "string", "]", " ", "The", " ", "file", " ", "path", " ", "of", " ", "the", " ", "xml", " ", "file", " ", "tha", "t", " ", "contain", "s", " ", "the", " ", "test", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "user", "Lang", "ua", "ge", " ", "[", "string", "]", " ", "The", " ", "language", " ", "of", " ", "the", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Organiz", "es", " ", "the", " ", "user", "'", "s", " ", "perform", "anc", "e", " ", "entri", "es", " ", "by", " ", "timestamp_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "d", " ", "[", "dict", "]", " ", "The", " ", "dictionar", "y", " ", "contain", "ing", " ", "the", " ", "user", "'", "s", " ", "perform", "anc", "e", " ", "entries_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "d", " ", "[", "Order", "ed", "Dict", "]", " ", "The", " ", "dictionar", "y", " ", "contain", "ing", " ", "the", " ", "user", "'", "s", " ", "perform", "anc", "e", " ", "entri", "es", " ", "organize", "d", " ", "by", " ", "timestamp_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Calculat", "es", " ", "the", " ", "user", "'", "s", " ", "score", " ", "from", " ", "the", " ", "perform", "anc", "e", " ", "entries_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "d", " ", "[", "dict", "]", " ", "The", " ", "dictionar", "y", " ", "contain", "ing", " ", "the", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "entries_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "score", " ", "[", "int", "]", " ", "The", " ", "user", "'", "s", " ", "score_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Filter", "s", " ", "a", " ", "dictionar", "y", " ", "contain", "ing", " ", "cogni", "tiv", "e", " ", "tests", " ", "by", " ", "keep", "ing", " ", "only", " ", "tho", "se", " ", "of", " ", "the", " ", "give", "n", " ", "difficult", "y", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "tests", "Of", "Type", " ", "[", "dict", "]", " ", "The", " ", "dictionar", "y", " ", "contain", "ing", " ", "the", " ", "cogni", "tiv", "e", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "return", "With", "Error", " ", "[", "bool", "]", " ", "Tru", "e", " ", "if", " ", "a", " ", "non", " ", "recover", "able", " ", "error", " ", "occure", "d", ",", " ", "and", " ", "the", " ", "service", " ", "must", " ", "immediate", "ly", " ", "return", " ", "with", " ", "an", " ", "error", " ", "report_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "ontology", "Ali", "as", " ", "[", "string", "]", " ", "The", " ", "user", "'", "s", " ", "ontology", " ", "alias_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Get", "s", " ", "the", " ", "users", " ", "ontology", " ", "alias", " ", "and", " ", "if", " ", "it", " ", "doesnt", " ", "exist", " ", "it", " ", "create", "s", " ", "it", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "user", "name", " ", "[", "string", "]", " ", "The", " ", "user", "'", "s", " ", "username_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "return", "With", "Error", " ", "[", "bool", "]", " ", "Tru", "e", " ", "if", " ", "a", " ", "non", " ", "recover", "able", " ", "error", " ", "occure", "d", ",", " ", "and", " ", "the", " ", "service", " ", "must", " ", "immediate", "ly", " ", "return", " ", "with", " ", "an", " ", "error", " ", "report_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "ontology", "Ali", "as", " ", "[", "string", "]", " ", "The", " ", "user", "'", "s", " ", "ontology", " ", "alias_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "@", "brief", " ", "Load", " ", "the", " ", "difficult", "y", " ", "modifiers", " ", "from", " ", "the", " ", "ros", " ", "yaml", " ", "file", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "param", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "res", " ", "[", "rapp", "\\u", "platform", "\\u", "ros", "\\u", "communication", "s", "::", "test", "Select", "or", "Sr", "v", "Respons", "e", "::", "Respons", "e", "&]", " ", "The", " ", "output", " ", "argu", "ment", "s", " ", "of", " ", "the", " ", "service", " ", "as", " ", "defin", "ed", " ", "in", " ", "the", " ", "test", "Select", "or", "Sr", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "return", "With", "Error", " ", "[", "bool", "]", " ", "Tru", "e", " ", "if", " ", "a", " ", "non", " ", "recover", "able", " ", "error", " ", "occure", "d", ",", " ", "and", " ", "the", " ", "service", " ", "must", " ", "immediate", "ly", " ", "return", " ", "with", " ", "an", " ", "error", " ", "report_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "modifier", "1", " ", "[", "int", "]", " ", "The", " ", "first", " ", "difficult", "y", " ", "modifier_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "return", " ", "modifier", "2", " ", "[", "int", "]", " ", "The", " ", "second", " ", "difficult", "y", " ", "modifier_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "choose", "r", "Function_", "(_", "self_", ",_", "req_", ")_", ":_", "\\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 ", " _", "res_", "=_", "test", "Select", "or", "Sr", "v", "Response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "Timestamp_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return", "With", "Error_", ",_", "modifier", "1_", ",_", "modifier", "2_", "=_", "self_", "._", "load", "Param", "Diff", "icult", "y", "Modifie", "rs_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "return", "With", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return", "With", "Error_", ",_", "user", "Ont", "olog", "y", "Alias_", "=_", "self_", "._", "get", "User", "Ont", "olog", "y", "Alias_", "(_", "req_", "._", "username_", ",_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "return", "With", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return", "With", "Error_", ",_", "user", "Language_", "=_", "self_", "._", "get", "User", "Language_", "(_", "req_", "._", "username_", ",_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "return", "With", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return", "With", "Error_", ",_", "test", "Type", "s", "List_", "=_", "self_", "._", "get", "Test", "Type", "s", "Fro", "m", "Ont", "olog", "y_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "return", "With", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "req_", "._", "test", "Type_", "==_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Type_", "=_", "self_", "._", "dete", "rmin", "e", "Test", "Type", "If", "Not", "Provided", "_", "(_", "res_", ",_", "test", "Type", "s", "List_", ",_", "user", "Ont", "olog", "y", "Alias_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "req_", "._", "test", "Type_", "not_", "in_", "test", "Type", "s", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "trace_", "._", "append_", "(_", "\"", "test", "Type", " ", "provided", " ", "doe", "s", " ", "not", " ", "exist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "error_", "=_", "\"", "test", "Type", " ", "provided", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Type_", "=_", "req_", "._", "test", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "chosen", "Di", "f_", ",_", "no", "User", "Perform", "anc", "e", "Record", "s", "Exist_", ",_", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", "=_", "self_", "._", "organize", "User", "Perform", "anc", "e", "By", "Timest", "amp", "And", "Det", "erm", "ine", "Test", "Diff", "icult", "y_", "(_", "test", "Type_", ",_", "user", "Ont", "olog", "y", "Alias_", ",_", "current", "Timestamp_", ",_", "self_", "._", "look", "Back", "Time", "Stamp_", ",_", "res_", ",_", "modifier", "1_", ",_", "modifier", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return", "With", "Error_", ",_", "tests", "Of", "Type", "Order", "ed_", "=_", "self_", "._", "get", "Cog", "niti", "ve", "Test", "s", "Of", "Type_", "(_", "test", "Type_", ",_", "user", "Language_", ",_", "chosen", "Di", "f_", ",_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "return", "With", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "final", "Test", "File", "Path_", ",_", "final", "Test", "name_", "=_", "self_", "._", "get", "LR", "Ut", "est", "Of", "Type", "And", "Xm", "l", "Path_", "(_", "tests", "Of", "Type", "Order", "ed_", ",_", "no", "User", "Perform", "anc", "e", "Record", "s", "Exist_", ",_", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Retrieve", " ", "the", " ", "name", " ", "of", " ", "the", " ", "selecte", "d", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "List_", "=_", "final", "Test", "name_", "._", "split_", "(_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "test_", "=_", "tmp", "List_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Pars", "e", " ", "the", " ", "test", " ", "xml", " ", "file", " ", "and", " ", "retrieve", " ", "the", " ", "desi", "red", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "ros", "pack_", "=_", "ros", "pkg_", "._", "Ros", "Pack_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "Packa", "ge", "Path_", "=_", "ros", "pack_", "._", "get", "\\u", "path_", "(_", "'", "rapp", "\\u", "cogni", "tiv", "e\\u", "exercise", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "Test", "File", "Path_", "=_", "local", "Packa", "ge", "Path_", "+_", "final", "Test", "File", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "trace_", "._", "append_", "(_", "final", "Test", "File", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "retrieve", "Data", "Fro", "m", "Test", "Xml_", "(_", "final", "Test", "File", "Path_", ",_", "res_", ",_", "user", "Language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "language_", "=_", "user", "Language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "trace_", "._", "append_", "(_", "\"", "Null", " ", "point", "er", " ", "exception", "..", " ", "some", " ", "argu", "ment", " ", "was", " ", "empty", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "error_", "=_", "\"", "Null", " ", "point", "er", " ", "exception", "..", " ", "some", " ", "argu", "ment", " ", "was", " ", "empty", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "trace_", "._", "append_", "(_", "\"", "IO", " ", "Error", ",", " ", "cant", " ", "open", " ", "file", " ", "or", " ", "read", " ", "data", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "error_", "=_", "\"", "IO", " ", "Error", ",", " ", "cant", " ", "open", " ", "file", " ", "or", " ", "read", " ", "data", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "get", "User", "Language_", "(_", "self_", ",_", "username_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serv", "\\u", "topic_", "=_", "rospy_", "._", "get", "\\u", "param_", "(_", "'", "rapp", "\\u", "mysql", "\\u", "wrapp", "er", "\\u", "user", "\\u", "fetch", "\\u", "data\\u", "topic", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "know", "rob", "\\u", "service_", "=_", "rospy_", "._", "Service", "Proxy_", "(_", "serv", "\\u", "topic_", ",_", "fetch", "Data", "Sr", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetch", "Data", "Sr", "v", "Req_", "=_", "fetch", "Data", "Sr", "v", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetch", "Data", "Sr", "v", "Req_", "._", "req", "\\u", "cols_", "=_", "[_", "\"", "language", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetch", "Data", "Sr", "v", "Req_", "._", "where", "\\u", "data_", "=_", "[_", "String", "Array", "Msg_", "(_", "s_", "=_", "[_", "\"", "user", "name", "\"_", ",_", "username_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetch", "Data", "Sr", "v", "Response_", "=_", "know", "rob", "\\u", "service_", "(_", "fetch", "Data", "Sr", "v", "Req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "fetch", "Data", "Sr", "v", "Response_", "._", "success_", "._", "data_", "!=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "trace_", "._", "extend_", "(_", "fetch", "Data", "Sr", "v", "Response_", "._", "trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "error_", "=_", "fetch", "Data", "Sr", "v", "Response_", "._", "trace_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", ",_", "fetch", "Data", "Sr", "v", "Response_", "._", "res", "\\u", "data_", "[_", "0_", "]_", "._", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "get", "Test", "Type", "s", "Fro", "m", "Ont", "olog", "y_", "(_", "self_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serv", "\\u", "topic_", "=_", "rospy_", "._", "get", "\\u", "param_", "(_", "'", "rapp", "\\u", "know", "rob", "\\u", "wrapp", "er", "\\u", "subclasses", "\\u", "of", "\\u", "topic", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "know", "rob", "\\u", "service_", "=_", "rospy_", "._", "Service", "Proxy_", "(_", "serv", "\\u", "topic_", ",_", "ontology", "Sub", "Super", "Class", "es", "Of", "Sr", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Type", "s", "Req_", "=_", "ontology", "Sub", "Super", "Class", "es", "Of", "Sr", "v", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Type", "s", "Req_", "._", "ontology", "\\u", "class_", "=_", "\"", "Cog", "niti", "ve", "Test", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Type", "s", "Response_", "=_", "know", "rob", "\\u", "service_", "(_", "test", "Type", "s", "Req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "test", "Type", "s", "Response_", "._", "success_", "!=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "trace_", "._", "extend_", "(_", "test", "Type", "s", "Response_", "._", "trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "trace_", "._", "append_", "(_", "\"", "cann", "ot", " ", "load", " ", "test", " ", "categor", "ies", " ", "from", " ", "ontology", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "error_", "=_", "test", "Type", "s", "Response_", "._", "error_", "+_", "\"", "cann", "ot", " ", "load", " ", "test", " ", "categor", "ies", " ", "from", " ", "ontology", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test", "Type", "s", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "test", "Type", "s", "Response_", "._", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp", "List_", "=_", "s_", "._", "split_", "(_", "'#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Type", "s", "List_", "._", "append_", "(_", "tmp", "List_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", ",_", "test", "Type", "s", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "dete", "rmin", "e", "Test", "Type", "If", "Not", "Provided", "_", "(_", "self_", ",_", "res_", ",_", "test", "Type", "s", "List_", ",_", "user", "Ont", "olog", "y", "Alias_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serv", "\\u", "topic_", "=_", "rospy_", "._", "get", "\\u", "param_", "(_", "'", "rapp", "\\u", "know", "rob", "\\u", "wrapp", "er", "\\u", "user", "\\u", "perform", "anc", "e\\u", "cogni", "tve", "\\u", "tests", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "trace_", "._", "append_", "(_", "\"", "no", " ", "test", " ", "type", " ", "provided", ",", " ", "will", " ", "use", " ", "leas", "t", " ", "recent", "ly", " ", "used", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "Record", "s", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d1_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "test", "Type", "s", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "Perform", "anc", "e", "Req_", "=_", "user", "Perform", "anc", "e", "Cog", "nit", "ve", "Test", "s", "Sr", "v", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Perform", "anc", "e", "Req_", "._", "test\\u", "type_", "=_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Perform", "anc", "e", "Req_", "._", "ontology", "\\u", "alias_", "=_", "user", "Ont", "olog", "y", "Alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "know", "rob", "\\u", "service_", "=_", "rospy_", "._", "Service", "Proxy_", "(_", "serv", "\\u", "topic_", ",_", "user", "Perform", "anc", "e", "Cog", "nit", "ve", "Test", "s", "Sr", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Perform", "anc", "e", "Response_", "=_", "know", "rob", "\\u", "service_", "(_", "user", "Perform", "anc", "e", "Req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "user", "Perform", "anc", "e", "Response_", "._", "success_", "!=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "no", "Record", "s", "List_", "._", "append_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp", "User", "Perf", "Organiz", "ed", "By", "Timestamp_", "=_", "self_", "._", "organize", "User", "Perform", "ance_", "(_", "user", "Perform", "anc", "e", "Response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1_", "=_", "tmp", "User", "Perf", "Organiz", "ed", "By", "Timestamp_", "._", "items_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d1_", "[_", "t1_", "]_", "=_", "[_", "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_", "if_", "(_", "len_", "(_", "no", "Record", "s", "List_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test", "Type_", "=_", "random_", "._", "choice_", "(_", "no", "Record", "s", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "trace_", "._", "append_", "(_", "\"", "made", " ", "random", " ", "choice", " ", "from", " ", "the", " ", "test", " ", "types", " ", "whi", "ch", " ", "wer", "e", " ", "neve", "r", " ", "used", " ", "by", " ", "the", " ", "user", ",", " ", "choice", " ", "was", ":", " ", "\"_", "+_", "test", "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 ", " _", "d1_", "=_", "Order", "ed", "Dict_", "(_", "sorted_", "(_", "d1_", "._", "items_", "(_", ")_", ",_", "key_", "=_", "lambda_", "t_", ":_", "t_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test", "Type_", "=_", "d1_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "trace_", "._", "append_", "(_", "\"", "all", " ", "test", " ", "types", " ", "had", " ", "perform", "anc", "e", " ", "record", "s", "..", " ", "leas", "t", " ", "recent", "ly", " ", "used", " ", "one", " ", "was", " ", ":\"_", "+_", "test", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "test", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "organize", "User", "Perform", "anc", "e", "By", "Timest", "amp", "And", "Det", "erm", "ine", "Test", "Diff", "icult", "y_", "(_", "self_", ",_", "test", "Type_", ",_", "user", "Ont", "olog", "y", "Alias_", ",_", "current", "Timestamp_", ",_", "look", "Back", "Time", "Stamp_", ",_", "res_", ",_", "modifier", "1_", ",_", "modifier", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "no", "User", "Perform", "anc", "e", "Record", "s", "Exist_", "=_", "False_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chosen", "Di", "f_", "=_", "\"", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Perform", "anc", "e", "Req_", "=_", "user", "Perform", "anc", "e", "Cog", "nit", "ve", "Test", "s", "Sr", "v", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Perform", "anc", "e", "Req_", "._", "test\\u", "type_", "=_", "test", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Perform", "anc", "e", "Req_", "._", "ontology", "\\u", "alias_", "=_", "user", "Ont", "olog", "y", "Alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serv", "\\u", "topic_", "=_", "rospy_", "._", "get", "\\u", "param_", "(_", "'", "rapp", "\\u", "know", "rob", "\\u", "wrapp", "er", "\\u", "user", "\\u", "perform", "anc", "e\\u", "cogni", "tve", "\\u", "tests", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "know", "rob", "\\u", "service_", "=_", "rospy_", "._", "Service", "Proxy_", "(_", "serv", "\\u", "topic_", ",_", "user", "Perform", "anc", "e", "Cog", "nit", "ve", "Test", "s", "Sr", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "Perform", "anc", "e", "Response_", "=_", "know", "rob", "\\u", "service_", "(_", "user", "Perform", "anc", "e", "Req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "user", "Perform", "anc", "e", "Response_", "._", "success_", "!=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "trace_", "._", "extend_", "(_", "user", "Perform", "anc", "e", "Response_", "._", "trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "trace_", "._", "append_", "(_", "\"", "Kno", "w", "Rob", " ", "wrapp", "er", " ", "return", "ed", " ", "no", " ", "perform", "anc", "e", " ", "record", "s", " ", "for", " ", "this", " ", "user", "..", " ", "will", " ", "start", " ", "with", " ", "a", " ", "a", " ", "difficult", "y", " ", "setti", "ng", " ", "of", " ", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "User", "Perform", "anc", "e", "Record", "s", "Exist_", "=_", "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 ", " _", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", "=_", "self_", "._", "organize", "User", "Perform", "ance_", "(_", "user", "Perform", "anc", "e", "Response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "current", "Timestamp_", "-_", "k_", ">_", "look", "Back", "Time", "Stamp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "Score_", "=_", "self_", "._", "calcul", "ate", "User", "Score_", "(_", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "trace_", "._", "append_", "(_", "\"", "user", " ", "score", " ", ":\"_", "+_", "str_", "(_", "user", "Score_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "user", "Score_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chosen", "Di", "f_", "=_", "\"", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "user", "Score_", "<_", "modifier", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chosen", "Di", "f_", "=_", "\"", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "user", "Score_", "<_", "modifier", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chosen", "Di", "f_", "=_", "\"", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#(", "user", "Score", ">", "0.75", "*", "3", "*", "100", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chosen", "Di", "f_", "=_", "\"", "3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "._", "trace_", "._", "append_", "(_", "\"", "Cho", "sen", " ", "Diff", " ", ":\"_", "+_", "chosen", "Di", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "chosen", "Di", "f_", ",_", "no", "User", "Perform", "anc", "e", "Record", "s", "Exist_", ",_", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "get", "Cog", "niti", "ve", "Test", "s", "Of", "Type_", "(_", "self_", ",_", "test", "Type_", ",_", "user", "Language_", ",_", "chosen", "Di", "f_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serv", "\\u", "topic_", "=_", "rospy_", "._", "get", "\\u", "param_", "(_", "'", "rapp", "\\u", "know", "rob", "\\u", "wrapp", "er", "\\u", "cogni", "tiv", "e\\u", "tests", "\\u", "of", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Sr", "v", "Req_", "=_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Sr", "v", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Sr", "v", "Req_", "._", "test\\u", "type_", "=_", "test", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Sr", "v", "Req_", "._", "test\\u", "language_", "=_", "user", "Language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "know", "rob", "\\u", "service_", "=_", "rospy_", "._", "Service", "Proxy_", "(_", "serv", "\\u", "topic_", ",_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Sr", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Response_", "=_", "know", "rob", "\\u", "service_", "(_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Sr", "v", "Req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Response_", "._", "success_", "!=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "trace_", "._", "extend_", "(_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Response_", "._", "trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "error_", "=_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Response_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "success_", ",_", "tests", "Of", "Type", "Order", "ed_", "=_", "self_", "._", "filter", "Test", "sb", "y", "Diff", "icult", "y_", "(_", "cogni", "tiv", "e", "Test", "s", "Of", "Type", "Response_", ",_", "chosen", "Di", "f_", ",_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "success_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "trace_", "._", "append_", "(_", "\"", "Error", ",", " ", "no", " ", "tests", " ", "of", " ", "type", " ", "contain", "ed", " ", "in", " ", "the", " ", "ontology", "...", " ", "cann", "ot", " ", "proceed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "error_", "=_", "\"", "Error", ",", " ", "no", " ", "tests", " ", "of", " ", "type", " ", "contain", "ed", " ", "in", " ", "the", " ", "ontology", "...", " ", "cann", "ot", " ", "proceed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", ",_", "tests", "Of", "Type", "Order", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "get", "LR", "Ut", "est", "Of", "Type", "And", "Xm", "l", "Path_", "(_", "self_", ",_", "tests", "Of", "Type", "Order", "ed_", ",_", "no", "User", "Perform", "anc", "e", "Record", "s", "Exist_", ",_", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Choose", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "final", "Test", "name_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "Test", "File", "Path_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "no", "User", "Perform", "anc", "e", "Record", "s", "Exist_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "final", "Test", "name_", "=_", "random_", "._", "choice_", "(_", "tests", "Of", "Type", "Order", "ed_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "Test_", "=_", "tests", "Of", "Type", "Order", "ed_", "[_", "final", "Test", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "Test", "File", "Path_", "=_", "final", "Test_", "[_", "0_", "]_", "[_", "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 ", " _", "tests", "Of", "Type", "Order", "ed", "Copy_", "=_", "tests", "Of", "Type", "Order", "ed_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "v_", "[_", "0_", "]_", "[_", "0_", "]_", "in_", "tests", "Of", "Type", "Order", "ed", "Copy_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "tests", "Of", "Type", "Order", "ed", "Copy_", "[_", "v_", "[_", "0_", "]_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "len_", "(_", "tests", "Of", "Type", "Order", "ed", "Copy_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "final", "Test", "name_", "=_", "random_", "._", "choice_", "(_", "tests", "Of", "Type", "Order", "ed", "Copy_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "Test_", "=_", "tests", "Of", "Type", "Order", "ed", "Copy_", "[_", "final", "Test", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "Test", "File", "Path_", "=_", "final", "Test_", "[_", "0_", "]_", "[_", "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 ", " _", "final", "Test", "name_", "=_", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", "._", "values_", "(_", ")_", "[_", "len_", "(_", "user", "Perf", "Organiz", "ed", "By", "Timestamp_", ")_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "Test", "name_", "=_", "final", "Test", "name_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "Test_", "=_", "tests", "Of", "Type", "Order", "ed_", "[_", "final", "Test", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "Test", "File", "Path_", "=_", "final", "Test_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "final", "Test", "File", "Path_", ",_", "final", "Test", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "retrieve", "Data", "Fro", "m", "Test", "Xml_", "(_", "self_", ",_", "final", "Test", "File", "Path_", ",_", "res_", ",_", "user", "Language_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tree_", "=_", "ET_", "._", "parse_", "(_", "final", "Test", "File", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "tree_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "test", "Type_", "=_", "root_", "._", "find_", "(_", "\"", "test", "Type", "\"_", ")_", "._", "text_", "._", "encode_", "(_", "'", "UT", "F", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "test", "Sub", "Type_", "=_", "root_", "._", "find_", "(_", "\"", "test", "Sub", "Type", "\"_", ")_", "._", "text_", "._", "encode_", "(_", "'", "UT", "F", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "language_", "=_", "root_", "._", "find_", "(_", "'", "Languages", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "question_", "in_", "language_", "._", "find_", "(_", "user", "Language_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "questions_", "._", "append_", "(_", "question_", "._", "find_", "(_", "\"", "body", "\"_", ")_", "._", "text_", "._", "encode_", "(_", "'", "UT", "F", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "correct", "Answer", "s_", "._", "append_", "(_", "question_", "._", "find_", "(_", "\"", "correct", "Answer", "\"_", ")_", "._", "text_", "._", "encode_", "(_", "'", "UT", "F", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "String", "Array", "Msg_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "answers_", "in_", "question_", "._", "findall_", "(_", "'", "answer", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "._", "s_", "._", "append_", "(_", "answers_", "._", "find_", "(_", "\"", "body", "\"_", ")_", "._", "text_", "._", "encode_", "(_", "'", "UT", "F", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "._", "answers_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "organize", "User", "Perform", "ance_", "(_", "self_", ",_", "user", "Perf", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "user", "Perf", "_", "._", "tests_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tlist_", "=_", "[_", "user", "Perf", "_", "._", "tests_", "[_", "i_", "]_", ",_", "user", "Perf", "_", "._", "scores_", "[_", "i_", "]_", ",_", "user", "Perf", "_", "._", "difficulty_", "[_", "i_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "int_", "(_", "user", "Perf", "_", "._", "timestamps_", "[_", "i_", "]_", ")_", "]_", "=_", "[_", "tlist_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "Order", "ed", "Dict_", "(_", "sorted_", "(_", "d_", "._", "items_", "(_", ")_", ",_", "key_", "=_", "lambda_", "t_", ":_", "t_", "[_", "0_", "]_", ",_", "reverse_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "calcul", "ate", "User", "Score_", "(_", "self_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "score_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "d_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", ",_", "v_", "in_", "d_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "score_", "=_", "score_", "+_", "int_", "(_", "v_", "[_", "0_", "]_", "[_", "1_", "]_", ")_", "*_", "int_", "(_", "v_", "[_", "0_", "]_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "score_", "=_", "score_", "/_", "len_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "score_", "\\u\\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_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "filter", "Test", "sb", "y", "Diff", "icult", "y_", "(_", "self_", ",_", "tests", "Of", "Type_", ",_", "chosen", "Di", "f_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "int", "Di", "f_", "=_", "int_", "(_", "chosen", "Di", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "int", "Di", "f_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "success_", ",_", "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 ", " _", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "tests", "Of", "Type_", "._", "tests_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "tests", "Of", "Type_", "._", "difficulty_", "[_", "i_", "]_", "==_", "chosen", "Di", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tlist_", "=_", "[_", "tests", "Of", "Type_", "._", "file", "\\u", "paths_", "[_", "i_", "]_", ",_", "tests", "Of", "Type_", "._", "difficulty_", "[_", "i_", "]_", ",_", "tests", "Of", "Type_", "._", "subtype_", "[_", "i_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "[_", "tests", "Of", "Type_", "._", "tests_", "[_", "i_", "]_", "]_", "=_", "[_", "tlist_", "]_", "\\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_", "len_", "(_", "d_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "trace_", "._", "append_", "(_", "\"", "downs", "cali", "ng", " ", "difficult", "y", " ", "by", " ", "1", " ", "as", " ", "no", " ", "test", " ", "exist", "s", " ", "for", " ", "diff", " ", "=", " ", "\"_", "+_", "chosen", "Di", "f_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chosen", "Di", "f_", "=_", "str_", "(_", "int_", "(_", "chosen", "Di", "f_", ")_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", ",_", "d_", "=_", "self_", "._", "filter", "Test", "sb", "y", "Diff", "icult", "y_", "(_", "tests", "Of", "Type_", ",_", "chosen", "Di", "f_", ",_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "success_", ",_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "get", "User", "Ont", "olog", "y", "Alias_", "(_", "self_", ",_", "username_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serv", "\\u", "topic_", "=_", "rospy_", "._", "get", "\\u", "param_", "(_", "'", "rapp", "\\u", "know", "rob", "\\u", "wrapp", "er", "\\u", "create", "\\u", "ontology", "\\u", "alias", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "know", "rob", "\\u", "service_", "=_", "rospy_", "._", "Service", "Proxy_", "(_", "serv", "\\u", "topic_", ",_", "create", "Ont", "olog", "y", "Ali", "as", "Sr", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Ont", "olog", "y", "Ali", "as", "Req_", "=_", "create", "Ont", "olog", "y", "Ali", "as", "Sr", "v", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Ont", "olog", "y", "Ali", "as", "Req_", "._", "username_", "=_", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "Ont", "olog", "y", "Ali", "as", "Response_", "=_", "know", "rob", "\\u", "service_", "(_", "create", "Ont", "olog", "y", "Ali", "as", "Req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "create", "Ont", "olog", "y", "Ali", "as", "Response_", "._", "success_", "!=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "trace_", "._", "extend_", "(_", "create", "Ont", "olog", "y", "Ali", "as", "Response_", "._", "trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "error_", "=_", "create", "Ont", "olog", "y", "Ali", "as", "Response_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "With", "Error_", "=_", "True_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", ",_", "create", "Ont", "olog", "y", "Ali", "as", "Response_", "._", "ontology", "\\u", "alias_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Selector_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "Thi", "s", " ", "variab", "le", " ", "refer", "s", " ", "to", " ", "the", " ", "length", " ", "of", " ", "time", " ", "back", "ward", "s", " ", "tha", "t", " ", "the", " ", "user", "'", "s", " ", "cogni", "tiv", "e", " ", "test", " ", "perform", "anc", "e", " ", "record", "s", " ", "will", " ", "be", " ", "queried", ",", " ", "default", " ", "value", " ", "is", " ", "155", "520", "00000", " ", "-", "3", " ", "months_", "\\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_", "load", "Param", "Diff", "icult", "y", "Modifie", "rs_", "(_", "self_", ",_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifier", "1_", "=_", "rospy_", "._", "get", "\\u", "param_", "(_", "'", "rapp", "\\u", "cogni", "tiv", "e\\u", "test\\u", "select", "or", "\\u", "difficult", "y", "\\u", "modifier", "\\u", "1", "\\u", "from", "\\u", "1", "\\u", "to", "\\u", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "modifier", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rospy_", "._", "loge", "rror_", "(_", "\"", "rapp", "\\u", "cogni", "tiv", "e\\u", "test\\u", "select", "or", "\\u", "difficult", "y", "\\u", "modifier", "\\u", "1", "\\u", "from", "\\u", "1", "\\u", "to", "\\u", "2", " ", "param", " ", "not", " ", "found", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "trace_", "._", "extend_", "(_", "\"", "rapp", "\\u", "cogni", "tiv", "e\\u", "test\\u", "select", "or", "\\u", "difficult", "y", "\\u", "modifier", "\\u", "1", "\\u", "from", "\\u", "1", "\\u", "to", "\\u", "2", " ", "param", " ", "not", " ", "found", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "error_", "=_", "\"", "rapp", "\\u", "cogni", "tiv", "e\\u", "test\\u", "select", "or", "\\u", "difficult", "y", "\\u", "modifier", "\\u", "1", "\\u", "from", "\\u", "1", "\\u", "to", "\\u", "2", " ", "param", " ", "not", " ", "found", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "With", "Error_", "=_", "True_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", ",_", "\"\"_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modifier", "2_", "=_", "rospy_", "._", "get", "\\u", "param_", "(_", "'", "rapp", "\\u", "cogni", "tiv", "e\\u", "test\\u", "select", "or", "\\u", "difficult", "y", "\\u", "modifier", "\\u", "2", "\\u", "from", "\\u", "2", "\\u", "to", "\\u", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "not_", "modifier", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rospy_", "._", "loge", "rror_", "(_", "\"", "rapp", "\\u", "cogni", "tiv", "e\\u", "test\\u", "select", "or", "\\u", "difficult", "y", "\\u", "modifier", "\\u", "2", "\\u", "from", "\\u", "2", "\\u", "to", "\\u", "3", " ", "param", " ", "not", " ", "found", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "trace_", "._", "extend_", "(_", "\"", "rapp", "\\u", "cogni", "tiv", "e\\u", "test\\u", "select", "or", "\\u", "difficult", "y", "\\u", "modifier", "\\u", "2", "\\u", "from", "\\u", "2", "\\u", "to", "\\u", "3", " ", "param", " ", "not", " ", "found", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "error_", "=_", "\"", "rapp", "\\u", "cogni", "tiv", "e\\u", "test\\u", "select", "or", "\\u", "difficult", "y", "\\u", "modifier", "\\u", "2", "\\u", "from", "\\u", "2", "\\u", "to", "\\u", "3", " ", "param", " ", "not", " ", "found", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "With", "Error_", "=_", "True_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", ",_", "\"\"_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modifier", "1_", "=_", "int_", "(_", "modifier", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modifier", "2_", "=_", "int_", "(_", "modifier", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", ",_", "modifier", "1_", ",_", "modifier", "2_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
AppScale/appscale/AppServer/lib/django-1.3/django/template/base.py
[ { "content": " def tag(self, name=None, compile_function=None):\n if name == None and compile_function == None:\n # @register.tag()\n return self.tag_function\n elif name != None and compile_function == None:\n if(callable(name)):\n # @register.tag\n return self.tag_function(name)\n else:\n # @register.tag('somename') or @register.tag(name='somename')\n def dec(func):\n return self.tag(name, func)\n return dec\n elif name != None and compile_function != None:\n # register.tag('somename', somefunc)\n self.tags[name] = compile_function\n return compile_function\n else:\n raise InvalidTemplateLibrary(\"Unsupported arguments to Library.tag: (%r, %r)\", (name, compile_function))", "metadata": "root.Library.tag", "header": "['class', 'Library', '(', 'object', ')', ':', '___EOS___']", "index": 817 }, { "content": " def filter(self, name=None, filter_func=None):\n if name == None and filter_func == None:\n # @register.filter()\n return self.filter_function\n elif filter_func == None:\n if(callable(name)):\n # @register.filter\n return self.filter_function(name)\n else:\n # @register.filter('somename') or @register.filter(name='somename')\n def dec(func):\n return self.filter(name, func)\n return dec\n elif name != None and filter_func != None:\n # register.filter('somename', somefunc)\n self.filters[name] = filter_func\n return filter_func\n else:\n raise InvalidTemplateLibrary(\"Unsupported arguments to Library.filter: (%r, %r)\", (name, filter_func))", "metadata": "root.Library.filter", "header": "['class', 'Library', '(', 'object', ')', ':', '___EOS___']", "index": 841 } ]
[ { "span": "name == None ", "start_line": 818, "start_column": 11, "end_line": 818, "end_column": 23 }, { "span": "compile_function == None:", "start_line": 818, "start_column": 28, "end_line": 818, "end_column": 52 }, { "span": "compile_function == None:", "start_line": 821, "start_column": 30, "end_line": 821, "end_column": 54 }, { "span": "name == None ", "start_line": 842, "start_column": 11, "end_line": 842, "end_column": 23 }, { "span": "filter_func == None:", "start_line": 842, "start_column": 28, "end_line": 842, "end_column": 47 }, { "span": "filter_func == None:", "start_line": 845, "start_column": 13, "end_line": 845, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Library_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tag_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "compile", "\\u", "function_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "None_", "and_", "compile", "\\u", "function_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@", "register", ".", "tag", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "tag", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "!=_", "None_", "and_", "compile", "\\u", "function_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "callable_", "(_", "name_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@", "register", ".", "tag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "tag", "\\u", "function_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@", "register", ".", "tag", "('", "some", "name", "')", " ", "or", " ", "@", "register", ".", "tag", "(", "name", "='", "some", "name", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "dec_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "tag_", "(_", "name_", ",_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "!=_", "None_", "and_", "compile", "\\u", "function_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "register", ".", "tag", "('", "some", "name", "',", " ", "some", "func", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tags_", "[_", "name_", "]_", "=_", "compile", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "compile", "\\u", "function_", "\\u\\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_", "Inva", "lid", "Templa", "te", "Library_", "(_", "\"", "Unsu", "ppo", "rted", " ", "argu", "ment", "s", " ", "to", " ", "Libr", "ary", ".", "tag", ":", " ", "(%", "r", ",", " ", "%", "r", ")\"_", ",_", "(_", "name_", ",_", "compile", "\\u", "function_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Library_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "filter_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "filter", "\\u", "func_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "None_", "and_", "filter", "\\u", "func_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@", "register", ".", "filter", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "filter", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "filter", "\\u", "func_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "callable_", "(_", "name_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@", "register", ".", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "filter", "\\u", "function_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@", "register", ".", "filter", "('", "some", "name", "')", " ", "or", " ", "@", "register", ".", "filter", "(", "name", "='", "some", "name", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "dec_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "filter_", "(_", "name_", ",_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "dec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "!=_", "None_", "and_", "filter", "\\u", "func_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "register", ".", "filter", "('", "some", "name", "',", " ", "some", "func", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filters_", "[_", "name_", "]_", "=_", "filter", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "filter", "\\u", "func_", "\\u\\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_", "Inva", "lid", "Templa", "te", "Library_", "(_", "\"", "Unsu", "ppo", "rted", " ", "argu", "ment", "s", " ", "to", " ", "Libr", "ary", ".", "filter", ":", " ", "(%", "r", ",", " ", "%", "r", ")\"_", ",_", "(_", "name_", ",_", "filter", "\\u", "func_", ")_", ")_", "\\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, 0, 1, 1, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Unused import
mrknow/filmkodi/plugin.video.specto/resources/lib/libraries/phdialogs.py
[ { "content": "# -*- coding: utf-8 -*-\n\n'''\n Phoenix Add-on\n Copyright (C) 2015 Blazetamer\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n'''\n\nimport urllib2,os,time\nimport xbmc,xbmcgui,xbmcaddon,xbmcplugin\n\nsupportsite = 'tvaddons.ag'\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def openDialog(image,audio):\n audio = audio\n print 'MUSIC IS '+audio\n path = xbmc.translatePath(os.path.join('special://home/addons/plugin.video.phstreams/resources/skins/DefaultSkin','media'))\n popimage=os.path.join(path, 'tempimage.jpg')\n downloadFile(image,popimage)\n musicsound=os.path.join(path, 'tempsound.mp3')\n downloadFile(audio,musicsound)\n if xbmc.getCondVisibility('system.platform.ios'):\n if not xbmc.getCondVisibility('system.platform.atv'):\n popup = dialog('pop1.xml',xbmcaddon.Addon().getAddonInfo('path'),'DefaultSkin',close_time=20,logo_path='%s/resources/skins/DefaultSkin/media/Logo/'%xbmcaddon.Addon().getAddonInfo('path'),)\n if xbmc.getCondVisibility('system.platform.android'):\n popup = dialog('pop1.xml',xbmcaddon.Addon().getAddonInfo('path'),'DefaultSkin',close_time=20,logo_path='%s/resources/skins/DefaultSkin/media/Logo/'%xbmcaddon.Addon().getAddonInfo('path'))\n else:\n popup = dialog('pop.xml',xbmcaddon.Addon().getAddonInfo('path'),'DefaultSkin',close_time=20,logo_path='%s/resources/skins/DefaultSkin/media/Logo/'%xbmcaddon.Addon().getAddonInfo('path'))\n popup.doModal()\n del popup", "metadata": "root.openDialog", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def downloadFile(url,dest,silent = False,cookie = None):\n try:\n import urllib2\n file_name = url.split('/')[-1]\n print \"Downloading: %s\" % (file_name)\n if cookie:\n import cookielib\n cookie_file = os.path.join(os.path.join(xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('profile')),'Cookies'), cookie+'.cookies')\n cj = cookielib.LWPCookieJar()\n if os.path.exists(cookie_file):\n try: cj.load(cookie_file,True)\n except: cj.save(cookie_file,True)\n else: cj.save(cookie_file,True)\n opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))\n else:\n opener = urllib2.build_opener()\n opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')]\n u = opener.open(url)\n f = open(dest, 'wb')\n meta = u.info()\n if meta.getheaders(\"Content-Length\"):\n file_size = int(meta.getheaders(\"Content-Length\")[0])\n else: file_size = 'Unknown'\n file_size_dl = 0\n block_sz = 8192\n while True:\n buffer = u.read(block_sz)\n if not buffer: break\n file_size_dl += len(buffer)\n f.write(buffer)\n print \"Downloaded: %s %s Bytes\" % (file_name, file_size)\n f.close()\n return True\n except Exception:\n print 'Error downloading file ' + url.split('/')[-1]\n #ErrorReport(e)\n if not silent:\n dialog = xbmcgui.Dialog()\n dialog.ok(\"Phoenix Streams\", \"Report any errors at \" + supportsite, \"We will try our best to help you\")\n return False", "metadata": "root.downloadFile", "header": "['module', '___EOS___']", "index": 45 }, { "content": "class dialog( xbmcgui.WindowXMLDialog ):\n\n \n\n\n", "metadata": "root.dialog", "header": "['module', '___EOS___']", "index": 87 }, { "content": " def __init__( self, *args, **kwargs ):\n self.shut = kwargs['close_time'] \n xbmc.executebuiltin( \"Skin.Reset(AnimeWindowXMLDialogClose)\" )\n xbmc.executebuiltin( \"Skin.SetBool(AnimeWindowXMLDialogClose)\" )", "metadata": "root.dialog.__init__", "header": "['class', 'dialog', '(', 'xbmcgui', '.', 'WindowXMLDialog', ')', ':', '___EOS___']", "index": 88 }, { "content": " def onInit( self):\n xbmc.Player().play('%s/resources/skins/DefaultSkin/media/tempsound.mp3'%xbmcaddon.Addon().getAddonInfo('path'))# Music \n #xbmc.Player().play(musicsound)# Music\n while self.shut > 0:\n xbmc.sleep(1000)\n self.shut -= 1\n xbmc.Player().stop()\n self._close_dialog()", "metadata": "root.dialog.onInit", "header": "['class', 'dialog', '(', 'xbmcgui', '.', 'WindowXMLDialog', ')', ':', '___EOS___']", "index": 93 }, { "content": " def onFocus( self, controlID ): pass", "metadata": "root.dialog.onFocus", "header": "['class', 'dialog', '(', 'xbmcgui', '.', 'WindowXMLDialog', ')', ':', '___EOS___']", "index": 102 }, { "content": " def onClick( self, controlID ): \n if controlID == 12 or controlID == 7:\n xbmc.Player().stop()\n self._close_dialog()", "metadata": "root.dialog.onClick", "header": "['class', 'dialog', '(', 'xbmcgui', '.', 'WindowXMLDialog', ')', ':', '___EOS___']", "index": 104 }, { "content": " def onAction( self, action ):\n if action in [ 5, 6, 7, 9, 10, 92, 117 ] or action.getButtonCode() in [ 275, 257, 261 ]:\n xbmc.Player().stop()\n self._close_dialog()", "metadata": "root.dialog.onAction", "header": "['class', 'dialog', '(', 'xbmcgui', '.', 'WindowXMLDialog', ')', ':', '___EOS___']", "index": 109 }, { "content": " def _close_dialog( self ):\n path = xbmc.translatePath(os.path.join('special://home/addons/plugin.video.phstreams/resources/skins/DefaultSkin','media'))\n popimage=os.path.join(path, 'tempimage.jpg')\n musicsound=os.path.join(path, 'tempsound.mp3')\n xbmc.executebuiltin( \"Skin.Reset(AnimeWindowXMLDialogClose)\" )\n time.sleep( .4 )\n self.close()\n os.remove(popimage)\n os.remove(musicsound)", "metadata": "root.dialog._close_dialog", "header": "['class', 'dialog', '(', 'xbmcgui', '.', 'WindowXMLDialog', ')', ':', '___EOS___']", "index": 114 } ]
[ { "span": "import urllib2,os,time", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 22 }, { "span": "import xbmc,xbmcgui,xbmcaddon,xbmcplugin", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "Pho", "eni", "x", " ", "Add", "-", "on", "\\", "10", ";", " ", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "201", "5", " ", "Bla", "zeta", "mer", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "program", " ", "is", " ", "free", " ", "software", ":", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modif", "y", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "as", " ", "publi", "shed", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ",", " ", "eit", "her", " ", "version", " ", "3", " ", "of", " ", "the", " ", "License", ",", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "program", " ", "is", " ", "distributed", " ", "in", " ", "the", " ", "hop", "e", " ", "tha", "t", " ", "it", " ", "will", " ", "be", " ", "usef", "ul", ",", "\\", "10", ";", " ", " ", " ", " ", "but", " ", "WITH", "OUT", " ", "ANY", " ", "WAR", "RAN", "TY", ";", " ", "with", "out", " ", "even", " ", "the", " ", "impli", "ed", " ", "warr", "ant", "y", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "or", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", " ", "See", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", "\\", "10", ";", " ", " ", " ", " ", "along", " ", "with", " ", "this", " ", "program", ".", " ", " ", "If", " ", "not", ",", " ", "see", " ", "<", "http", "://", "www", ".", "gnu", ".", "org", "/", "license", "s", "/>", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "urllib2_", ",_", "os_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "xbmc_", ",_", "xbmcgui_", ",_", "xbmcaddon_", ",_", "xbmcplugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "support", "site_", "=_", "'", "tva", "ddo", "ns", ".", "ag", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "open", "Dialog_", "(_", "image_", ",_", "audio_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "audio_", "=_", "audio_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "MUS", "IC", " ", "IS", " ", " ", "'_", "+_", "audio_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "xbmc_", "._", "translat", "e", "Path_", "(_", "os_", "._", "path_", "._", "join_", "(_", "'", "special", "://", "home", "/", "addon", "s", "/", "plugin", ".", "video", ".", "ph", "stream", "s", "/", "resource", "s", "/", "skin", "s", "/", "Default", "Ski", "n", "'_", ",_", "'", "media", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "popi", "mage_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'", "temp", "image", ".", "jp", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "download", "File_", "(_", "image_", ",_", "popi", "mage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "music", "sound_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'", "temps", "ound", ".", "mp3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "download", "File_", "(_", "audio_", ",_", "music", "sound_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "xbmc_", "._", "get", "Cond", "Visibility_", "(_", "'", "system", ".", "platform", ".", "ios", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "xbmc_", "._", "get", "Cond", "Visibility_", "(_", "'", "system", ".", "platform", ".", "at", "v", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "popup_", "=_", "dialog_", "(_", "'", "pop", "1", ".", "xml", "'_", ",_", "xbmcaddon_", "._", "Addon_", "(_", ")_", "._", "get", "Add", "on", "Info_", "(_", "'", "path", "'_", ")_", ",_", "'", "Default", "Ski", "n", "'_", ",_", "close", "\\u", "time_", "=_", "20_", ",_", "logo", "\\u", "path_", "=_", "'%", "s", "/", "resource", "s", "/", "skin", "s", "/", "Default", "Ski", "n", "/", "media", "/", "Logo", "/'_", "%_", "xbmcaddon_", "._", "Addon_", "(_", ")_", "._", "get", "Add", "on", "Info_", "(_", "'", "path", "'_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xbmc_", "._", "get", "Cond", "Visibility_", "(_", "'", "system", ".", "platform", ".", "android", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "popup_", "=_", "dialog_", "(_", "'", "pop", "1", ".", "xml", "'_", ",_", "xbmcaddon_", "._", "Addon_", "(_", ")_", "._", "get", "Add", "on", "Info_", "(_", "'", "path", "'_", ")_", ",_", "'", "Default", "Ski", "n", "'_", ",_", "close", "\\u", "time_", "=_", "20_", ",_", "logo", "\\u", "path_", "=_", "'%", "s", "/", "resource", "s", "/", "skin", "s", "/", "Default", "Ski", "n", "/", "media", "/", "Logo", "/'_", "%_", "xbmcaddon_", "._", "Addon_", "(_", ")_", "._", "get", "Add", "on", "Info_", "(_", "'", "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 ", " _", "popup_", "=_", "dialog_", "(_", "'", "pop", ".", "xml", "'_", ",_", "xbmcaddon_", "._", "Addon_", "(_", ")_", "._", "get", "Add", "on", "Info_", "(_", "'", "path", "'_", ")_", ",_", "'", "Default", "Ski", "n", "'_", ",_", "close", "\\u", "time_", "=_", "20_", ",_", "logo", "\\u", "path_", "=_", "'%", "s", "/", "resource", "s", "/", "skin", "s", "/", "Default", "Ski", "n", "/", "media", "/", "Logo", "/'_", "%_", "xbmcaddon_", "._", "Addon_", "(_", ")_", "._", "get", "Add", "on", "Info_", "(_", "'", "path", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "popup_", "._", "do", "Modal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "popup_", "\\u\\u\\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_", "download", "File_", "(_", "url_", ",_", "dest_", ",_", "silent_", "=_", "False_", ",_", "cookie_", "=_", "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 ", " _", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "name_", "=_", "url_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Down", "load", "ing", ":", " ", "%", "s", "\"_", "%_", "(_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cookie_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "cookie", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cookie", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "join_", "(_", "xbmc_", "._", "translat", "e", "Path_", "(_", "xbmcaddon_", "._", "Addon_", "(_", ")_", "._", "get", "Add", "on", "Info_", "(_", "'", "profile", "'_", ")_", ")_", ",_", "'", "Cooki", "es", "'_", ")_", ",_", "cookie_", "+_", "'.", "cookie", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cj_", "=_", "cookie", "lib_", "._", "LW", "PC", "ook", "ie", "Jar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "cookie", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "cj_", "._", "load_", "(_", "cookie", "\\u", "file_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "cj_", "._", "save_", "(_", "cookie", "\\u", "file_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "cj_", "._", "save_", "(_", "cookie", "\\u", "file_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opener_", "=_", "urllib2_", "._", "build", "\\u", "opener_", "(_", "urllib2_", "._", "HTTP", "Cooki", "e", "Processor_", "(_", "cj_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opener_", "=_", "urllib2_", "._", "build", "\\u", "opener_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "opener_", "._", "add", "headers_", "=_", "[_", "(_", "'", "User", "-", "Agent", "'_", ",_", "'", "Mo", "zilla", "/", "5.0", " ", "(", "Window", "s", ";", " ", "U", ";", " ", "Window", "s", " ", "NT", " ", "5.1", ";", " ", "en", "-", "GB", ";", " ", "rv", ":", "1.9", ".0", ".3", ")", " ", "Ge", "cko", "/", "20080", "924", "1", "7", " ", "Fire", "fox", "/", "3.0", ".3", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u_", "=_", "opener_", "._", "open_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "dest_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "u_", "._", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "meta_", "._", "geth", "eader", "s_", "(_", "\"", "Conten", "t", "-", "Length", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "size_", "=_", "int_", "(_", "meta_", "._", "geth", "eader", "s_", "(_", "\"", "Conten", "t", "-", "Length", "\"_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "file", "\\u", "size_", "=_", "'", "Un", "know", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "size", "\\u", "dl_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "\\u", "sz_", "=_", "8192_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buffer_", "=_", "u_", "._", "read_", "(_", "block", "\\u", "sz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "buffer_", ":_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "size", "\\u", "dl_", "+=_", "len_", "(_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "Downloade", "d", ":", " ", "%", "s", " ", "%", "s", " ", "Byte", "s", "\"_", "%_", "(_", "file", "\\u", "name_", ",_", "file", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Error", " ", "download", "ing", " ", "file", " ", "'_", "+_", "url_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Error", "Report", "(", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "silent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dialog_", "=_", "xbmcgui_", "._", "Dialog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dialog_", "._", "ok_", "(_", "\"", "Pho", "eni", "x", " ", "Stream", "s", "\"_", ",_", "\"", "Report", " ", "any", " ", "error", "s", " ", " ", "at", " ", "\"_", "+_", "support", "site_", ",_", "\"", "We", " ", "will", " ", "try", " ", "our", " ", "best", " ", "to", " ", "help", " ", "you", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "dialog_", "(_", "xbmcgui_", "._", "Window", "XML", "Dialog_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "dialog_", "(_", "xbmcgui_", "._", "Window", "XML", "Dialog_", ")_", ":_", "\\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_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shut", "_", "=_", "kwargs_", "[_", "'", "close", "\\u", "time", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xbmc_", "._", "executebuiltin_", "(_", "\"", "Ski", "n", ".", "Reset", "(", "Anim", "e", "Window", "XML", "Dialog", "Clos", "e", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xbmc_", "._", "executebuiltin_", "(_", "\"", "Ski", "n", ".", "Set", "Boo", "l", "(", "Anim", "e", "Window", "XML", "Dialog", "Clos", "e", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "dialog_", "(_", "xbmcgui_", "._", "Window", "XML", "Dialog_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xbmc_", "._", "Player_", "(_", ")_", "._", "play_", "(_", "'%", "s", "/", "resource", "s", "/", "skin", "s", "/", "Default", "Ski", "n", "/", "media", "/", "temps", "ound", ".", "mp3", "'_", "%_", "xbmcaddon_", "._", "Addon_", "(_", ")_", "._", "get", "Add", "on", "Info_", "(_", "'", "path", "'_", ")_", ")_", "#", " ", "Music", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "xbmc", ".", "Player", "()", ".", "play", "(", "music", "sound", ")#", " ", "Music", "_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "self_", "._", "shut", "_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xbmc_", "._", "sleep_", "(_", "1000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "shut", "_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xbmc_", "._", "Player_", "(_", ")_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "close", "\\u", "dialog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "dialog_", "(_", "xbmcgui_", "._", "Window", "XML", "Dialog_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Focus_", "(_", "self_", ",_", "control", "ID_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "dialog_", "(_", "xbmcgui_", "._", "Window", "XML", "Dialog_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "on", "Click_", "(_", "self_", ",_", "control", "ID_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "control", "ID_", "==_", "12_", "or_", "control", "ID_", "==_", "7_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xbmc_", "._", "Player_", "(_", ")_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "close", "\\u", "dialog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "dialog_", "(_", "xbmcgui_", "._", "Window", "XML", "Dialog_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Action_", "(_", "self_", ",_", "action_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "action_", "in_", "[_", "5_", ",_", "6_", ",_", "7_", ",_", "9_", ",_", "10_", ",_", "92_", ",_", "117_", "]_", "or_", "action_", "._", "get", "Butt", "on", "Code_", "(_", ")_", "in_", "[_", "275_", ",_", "257_", ",_", "261_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xbmc_", "._", "Player_", "(_", ")_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "close", "\\u", "dialog_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "dialog_", "(_", "xbmcgui_", "._", "Window", "XML", "Dialog_", ")_", ":_", "\\u\\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", "\\u", "dialog_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "xbmc_", "._", "translat", "e", "Path_", "(_", "os_", "._", "path_", "._", "join_", "(_", "'", "special", "://", "home", "/", "addon", "s", "/", "plugin", ".", "video", ".", "ph", "stream", "s", "/", "resource", "s", "/", "skin", "s", "/", "Default", "Ski", "n", "'_", ",_", "'", "media", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "popi", "mage_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'", "temp", "image", ".", "jp", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "music", "sound_", "=_", "os_", "._", "path_", "._", "join_", "(_", "path_", ",_", "'", "temps", "ound", ".", "mp3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xbmc_", "._", "executebuiltin_", "(_", "\"", "Ski", "n", ".", "Reset", "(", "Anim", "e", "Window", "XML", "Dialog", "Clos", "e", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", ".4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "popi", "mage_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "music", "sound_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 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 { "content": " def value__get(self):\n if self.selectedIndex is not None:\n return self.options[self.selectedIndex][0]\n else:\n for option, checked in self.options:\n if checked:\n return option\n else:\n if self.options:\n return self.options[0][0]\n else:\n return None", "metadata": "root.Select.value__get", "header": "['class', 'Select', '(', 'Field', ')', ':', '___EOS___']", "index": 1224 } ]
[ { "span": "for option, checked in self.options:", "start_line": 1228, "start_column": 12, "end_line": 1228, "end_column": 48 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "'", "else", "'_", "clause_", "in_", "loop_", "[SEP]_", "class_", "Select_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "value", "\\u\\u", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "selecte", "d", "Index_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "options_", "[_", "self_", "._", "selecte", "d", "Index_", "]_", "[_", "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 ", " _", "for_", "option_", ",_", "checked_", "in_", "self_", "._", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "checked_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "option_", "\\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_", "self_", "._", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "options_", "[_", "0_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
skoczen/will/will/plugins/friendly/cookies.py
[ { "content": "from will.plugin import WillPlugin\nfrom will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SnickerdoodlesPlugin(WillPlugin):\n", "metadata": "root.SnickerdoodlesPlugin", "header": "['module', '___EOS___']", "index": 4 }, { "content": " @hear(\"cookies\", include_me=False)\n def will_likes_cookies(self, message):\n self.say(rendered_template(\"cookies.html\", {}), message=message, html=True, )", "metadata": "root.SnickerdoodlesPlugin.will_likes_cookies", "header": "['class', 'SnickerdoodlesPlugin', '(', 'WillPlugin', ')', ':', '___EOS___']", "index": 6 } ]
[ { "span": "from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 108 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "will", "_", "._", "plugin_", "import_", "Wil", "l", "Plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "will", "_", "._", "decorators_", "import_", "respond", "\\u", "to_", ",_", "periodic_", ",_", "hear", "_", ",_", "random", "ly_", ",_", "route_", ",_", "render", "ed", "\\u", "template_", ",_", "require", "\\u", "settings_", "\\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_", "Sni", "cker", "doo", "dle", "s", "Plugin_", "(_", "Wil", "l", "Plugin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sni", "cker", "doo", "dle", "s", "Plugin_", "(_", "Wil", "l", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "hear", "_", "(_", "\"", "cookie", "s", "\"_", ",_", "include", "\\u", "me_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "will", "\\u", "likes", "\\u", "cookies_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "say_", "(_", "render", "ed", "\\u", "template_", "(_", "\"", "cookie", "s", ".", "html", "\"_", ",_", "{_", "}_", ")_", ",_", "message_", "=_", "message_", ",_", "html_", "=_", "True_", ",_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dimagi/commcare-hq/corehq/form_processor/parsers/form.py
[ { "content": "import hashlib\n\nimport datetime\n\nfrom corehq.form_processor.interfaces.dbaccessors import FormAccessors\nfrom corehq.form_processor.interfaces.processor import FormProcessorInterface\nfrom corehq.form_processor.models import Attachment\nfrom corehq.form_processor.utils import convert_xform_to_json, adjust_datetimes\nfrom couchforms import XMLSyntaxError\nfrom couchforms.exceptions import DuplicateError\nfrom dimagi.utils.couch import LockManager, ReleaseOnError\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MultiLockManager(list):\n", "metadata": "root.MultiLockManager", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def __enter__(self):\n return [lock_manager.__enter__() for lock_manager in self]", "metadata": "root.MultiLockManager.__enter__", "header": "['class', 'MultiLockManager', '(', 'list', ')', ':', '___EOS___']", "index": 14 }, { "content": " def __exit__(self, exc_type, exc_val, exc_tb):\n for lock_manager in self:\n lock_manager.__exit__(exc_type, exc_val, exc_tb)", "metadata": "root.MultiLockManager.__exit__", "header": "['class', 'MultiLockManager', '(', 'list', ')', ':', '___EOS___']", "index": 17 }, { "content": "class FormProcessingResult(object):\n\n", "metadata": "root.FormProcessingResult", "header": "['module', '___EOS___']", "index": 22 }, { "content": " def __init__(self, submitted_form, existing_duplicate=None):\n self.submitted_form = submitted_form\n self.existing_duplicate = existing_duplicate\n\n if submitted_form.is_duplicate:\n assert existing_duplicate is None\n\n if existing_duplicate:\n assert existing_duplicate.is_deprecated\n\n self.interface = FormProcessorInterface(self.submitted_form.domain)", "metadata": "root.FormProcessingResult.__init__", "header": "['class', 'FormProcessingResult', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": " def _get_form_lock(self, form_id):\n return self.interface.acquire_lock_for_xform(form_id)", "metadata": "root.FormProcessingResult._get_form_lock", "header": "['class', 'FormProcessingResult', '(', 'object', ')', ':', '___EOS___']", "index": 35 }, { "content": " def get_locked_forms(self):\n if self.existing_duplicate:\n # Lock docs with their original ID's (before they got switched during deprecation)\n new_id = self.existing_duplicate.form_id\n old_id = self.existing_duplicate.orig_id\n return MultiLockManager([\n LockManager(self.submitted_form, self._get_form_lock(new_id)),\n LockManager(self.existing_duplicate, self._get_form_lock(old_id)),\n ])\n else:\n return MultiLockManager([\n LockManager(self.submitted_form, self._get_form_lock(self.submitted_form.form_id))\n ])", "metadata": "root.FormProcessingResult.get_locked_forms", "header": "['class', 'FormProcessingResult', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": "class LockedFormProcessingResult(FormProcessingResult):\n", "metadata": "root.LockedFormProcessingResult", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def __init__(self, submitted_form):\n super(LockedFormProcessingResult, self).__init__(submitted_form)\n assert submitted_form.is_normal\n self.lock = self._get_form_lock(submitted_form.form_id)", "metadata": "root.LockedFormProcessingResult.__init__", "header": "['class', 'LockedFormProcessingResult', '(', 'FormProcessingResult', ')', ':', '___EOS___']", "index": 54 }, { "content": " def get_locked_forms(self):\n return MultiLockManager([LockManager(self.submitted_form, self.lock)])", "metadata": "root.LockedFormProcessingResult.get_locked_forms", "header": "['class', 'LockedFormProcessingResult', '(', 'FormProcessingResult', ')', ':', '___EOS___']", "index": 59 }, { "content": "def process_xform_xml(domain, instance, attachments=None):\n \"\"\"\n Create a new xform to ready to be saved to a database in a thread-safe manner\n Returns a LockManager containing the new XFormInstance(SQL) and its lock,\n or raises an exception if anything goes wrong.\n\n attachments is a dictionary of the request.FILES that are not the xform;\n key is parameter name, value is django MemoryFile object stream\n \"\"\"\n attachments = attachments or {}\n\n try:\n return _create_new_xform(domain, instance, attachments=attachments)\n except XMLSyntaxError as e:\n return _get_submission_error(domain, instance, e)\n except DuplicateError as e:\n return _handle_id_conflict(instance, e.xform, domain)", "metadata": "root.process_xform_xml", "header": "['module', '___EOS___']", "index": 63 }, { "content": "def _create_new_xform(domain, instance_xml, attachments=None):\n \"\"\"\n create but do not save an XFormInstance from an xform payload (xml_string)\n optionally set the doc _id to a predefined value (_id)\n return doc _id of the created doc\n\n `process` is transformation to apply to the form right before saving\n This is to avoid having to save multiple times\n\n If xml_string is bad xml\n - raise couchforms.XMLSyntaxError\n :param domain:\n\n \"\"\"\n from corehq.form_processor.interfaces.processor import FormProcessorInterface\n interface = FormProcessorInterface(domain)\n\n assert attachments is not None\n form_data = convert_xform_to_json(instance_xml)\n adjust_datetimes(form_data)\n\n xform = interface.new_xform(form_data)\n xform.domain = domain\n\n # Maps all attachments to uniform format and adds form.xml to list before storing\n attachments = map(\n lambda a: Attachment(name=a[0], raw_content=a[1], content_type=a[1].content_type),\n attachments.items()\n )\n attachments.append(Attachment(name='form.xml', raw_content=instance_xml, content_type='text/xml'))\n interface.store_attachments(xform, attachments)\n\n result = LockedFormProcessingResult(xform)\n with ReleaseOnError(result.lock):\n if interface.is_duplicate(xform.form_id):\n raise DuplicateError(xform)\n\n return result", "metadata": "root._create_new_xform", "header": "['module', '___EOS___']", "index": 82 }, { "content": "def _get_submission_error(domain, instance, error):\n \"\"\"\n Handle's a hard failure from posting a form to couch.\n :returns: xform error instance with raw xml as attachment\n \"\"\"\n try:\n message = unicode(error)\n except UnicodeDecodeError:\n message = unicode(str(error), encoding='utf-8')\n\n xform = FormProcessorInterface(domain).submission_error_form_instance(instance, message)\n return FormProcessingResult(xform)", "metadata": "root._get_submission_error", "header": "['module', '___EOS___']", "index": 122 }, { "content": "def _handle_id_conflict(instance, xform, domain):\n \"\"\"\n For id conflicts, we check if the files contain exactly the same content,\n If they do, we just log this as a dupe. If they don't, we deprecate the\n previous form and overwrite it with the new form's contents.\n \"\"\"\n\n assert domain\n conflict_id = xform.form_id\n\n interface = FormProcessorInterface(domain)\n if interface.is_duplicate(conflict_id, domain):\n # It looks like a duplicate/edit in the same domain so pursue that workflow.\n return _handle_duplicate(xform, instance)\n else:\n # the same form was submitted to two domains, or a form was submitted with\n # an ID that belonged to a different doc type. these are likely developers\n # manually testing or broken API users. just resubmit with a generated ID.\n xform = interface.assign_new_id(xform)\n return FormProcessingResult(xform)", "metadata": "root._handle_id_conflict", "header": "['module', '___EOS___']", "index": 136 }, { "content": "def _handle_duplicate(new_doc, instance):\n \"\"\"\n Handle duplicate xforms and xform editing ('deprecation')\n\n existing doc *must* be validated as an XFormInstance in the right domain\n and *must* include inline attachments\n\n \"\"\"\n interface = FormProcessorInterface(new_doc.domain)\n conflict_id = new_doc.form_id\n existing_doc = FormAccessors(new_doc.domain).get_with_attachments(conflict_id)\n\n existing_md5 = existing_doc.xml_md5()\n new_md5 = new_doc.xml_md5()\n\n if existing_md5 != new_md5:\n # if the form contents are not the same:\n # - \"Deprecate\" the old form by making a new document with the same contents\n # but a different ID and a doc_type of XFormDeprecated\n # - Save the new instance to the previous document to preserve the ID\n existing_doc, new_doc = apply_deprecation(existing_doc, new_doc, interface)\n\n return FormProcessingResult(new_doc, existing_doc)\n else:\n # follow standard dupe handling, which simply saves a copy of the form\n # but a new doc_id, and a doc_type of XFormDuplicate\n duplicate = interface.deduplicate_xform(new_doc)\n return FormProcessingResult(duplicate)", "metadata": "root._handle_duplicate", "header": "['module', '___EOS___']", "index": 158 }, { "content": "def apply_deprecation(existing_xform, new_xform, interface=None):\n # if the form contents are not the same:\n # - \"Deprecate\" the old form by making a new document with the same contents\n # but a different ID and a doc_type of XFormDeprecated\n # - Save the new instance to the previous document to preserve the ID\n\n interface = interface or FormProcessorInterface(existing_xform.domain)\n\n new_xform.form_id = existing_xform.form_id\n existing_xform = interface.assign_new_id(existing_xform)\n existing_xform.orig_id = new_xform.form_id\n\n # and give the new doc server data of the old one and some metadata\n new_xform.received_on = existing_xform.received_on\n new_xform.deprecated_form_id = existing_xform.form_id\n new_xform.edited_on = datetime.datetime.utcnow()\n existing_xform.edited_on = new_xform.edited_on\n\n return interface.apply_deprecation(existing_xform, new_xform)", "metadata": "root.apply_deprecation", "header": "['module', '___EOS___']", "index": 188 } ]
[ { "span": "import hashlib", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "hashlib_", "\\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_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "interfaces_", "._", "dba", "ccess", "ors_", "import_", "Form", "Accessor", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "interfaces_", "._", "processor_", "import_", "Form", "Process", "or", "Interface_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "models_", "import_", "Attachment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "utils_", "import_", "convert", "\\u", "xform", "\\u", "to", "\\u", "json_", ",_", "adjust", "\\u", "datetimes", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "couch", "forms_", "import_", "XML", "Syntax", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "couch", "forms_", "._", "exceptions_", "import_", "Duplicate", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "couch", "_", "import_", "Lock", "Manager_", ",_", "Release", "On", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Multi", "Lock", "Manager_", "(_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Lock", "Manager_", "(_", "list_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "enter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "lock", "\\u", "manager_", "._", "\\u\\u", "enter\\u\\u_", "(_", ")_", "for_", "lock", "\\u", "manager_", "in_", "self_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Lock", "Manager_", "(_", "list_", ")_", ":_", "\\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_", ",_", "exc", "\\u", "type_", ",_", "exc", "\\u", "val_", ",_", "exc", "\\u", "tb_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "lock", "\\u", "manager_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lock", "\\u", "manager_", "._", "\\u\\u", "exit\\u\\u_", "(_", "exc", "\\u", "type_", ",_", "exc", "\\u", "val_", ",_", "exc", "\\u", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Form", "Process", "ing", "Result_", "(_", "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_", "[SEP]_", "class_", "Form", "Process", "ing", "Result_", "(_", "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_", ",_", "submitted", "\\u", "form_", ",_", "exist", "ing", "\\u", "duplicate_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "submitted", "\\u", "form_", "=_", "submitted", "\\u", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exist", "ing", "\\u", "duplicate_", "=_", "exist", "ing", "\\u", "duplicate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "submitted", "\\u", "form_", "._", "is", "\\u", "duplicate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "exist", "ing", "\\u", "duplicate_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exist", "ing", "\\u", "duplicate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "exist", "ing", "\\u", "duplicate_", "._", "is", "\\u", "deprecated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "interface_", "=_", "Form", "Process", "or", "Interface_", "(_", "self_", "._", "submitted", "\\u", "form_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Form", "Process", "ing", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "form", "\\u", "lock_", "(_", "self_", ",_", "form", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "interface_", "._", "acquir", "e\\u", "lock", "\\u", "for", "\\u", "xform_", "(_", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Form", "Process", "ing", "Result_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "lock", "ed", "\\u", "forms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "exist", "ing", "\\u", "duplicate_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Lock", " ", "docs", " ", "with", " ", "thei", "r", " ", "original", " ", "ID", "'", "s", " ", "(", "bef", "ore", " ", "the", "y", " ", "got", " ", "switche", "d", " ", "dur", "ing", " ", "deprecation", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "id_", "=_", "self_", "._", "exist", "ing", "\\u", "duplicate_", "._", "form", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "id_", "=_", "self_", "._", "exist", "ing", "\\u", "duplicate_", "._", "orig", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Multi", "Lock", "Manager_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Lock", "Manager_", "(_", "self_", "._", "submitted", "\\u", "form_", ",_", "self_", "._", "\\u", "get", "\\u", "form", "\\u", "lock_", "(_", "new", "\\u", "id_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lock", "Manager_", "(_", "self_", "._", "exist", "ing", "\\u", "duplicate_", ",_", "self_", "._", "\\u", "get", "\\u", "form", "\\u", "lock_", "(_", "old", "\\u", "id_", ")_", ")_", ",_", "\\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_", "Multi", "Lock", "Manager_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Lock", "Manager_", "(_", "self_", "._", "submitted", "\\u", "form_", ",_", "self_", "._", "\\u", "get", "\\u", "form", "\\u", "lock_", "(_", "self_", "._", "submitted", "\\u", "form_", "._", "form", "\\u", "id_", ")_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Locke", "d", "Form", "Process", "ing", "Result_", "(_", "Form", "Process", "ing", "Result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Locke", "d", "Form", "Process", "ing", "Result_", "(_", "Form", "Process", "ing", "Result_", ")_", ":_", "\\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_", ",_", "submitted", "\\u", "form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Locke", "d", "Form", "Process", "ing", "Result_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "submitted", "\\u", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "submitted", "\\u", "form_", "._", "is", "\\u", "normal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock_", "=_", "self_", "._", "\\u", "get", "\\u", "form", "\\u", "lock_", "(_", "submitted", "\\u", "form_", "._", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locke", "d", "Form", "Process", "ing", "Result_", "(_", "Form", "Process", "ing", "Result_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "lock", "ed", "\\u", "forms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Multi", "Lock", "Manager_", "(_", "[_", "Lock", "Manager_", "(_", "self_", "._", "submitted", "\\u", "form_", ",_", "self_", "._", "lock_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "xform", "\\u", "xml_", "(_", "domain_", ",_", "instance_", ",_", "attachments_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "new", " ", "xform", " ", "to", " ", "read", "y", " ", "to", " ", "be", " ", "saved", " ", "to", " ", "a", " ", "databa", "se", " ", "in", " ", "a", " ", "thread", "-", "safe", " ", "manner", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "Lock", "Manager", " ", "contain", "ing", " ", "the", " ", "new", " ", "XF", "orm", "Insta", "nce", "(", "SQL", ")", " ", "and", " ", "its", " ", "lock", ",", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "raise", "s", " ", "an", " ", "exception", " ", "if", " ", "anyt", "hing", " ", "go", "es", " ", "wrong", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "attach", "ment", "s", " ", "is", " ", "a", " ", "dictionar", "y", " ", "of", " ", "the", " ", "request", ".", "FILE", "S", " ", "tha", "t", " ", "are", " ", "not", " ", "the", " ", "xform", ";", "\\", "10", ";", " ", " ", " ", " ", "key", " ", "is", " ", "parameter", " ", "name", ",", " ", "value", " ", "is", " ", "django", " ", "Memo", "ry", "File", " ", "object", " ", "stream", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attachments_", "=_", "attachments_", "or_", "{_", "}_", "\\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_", "\\u", "create", "\\u", "new", "\\u", "xform_", "(_", "domain_", ",_", "instance_", ",_", "attachments_", "=_", "attachments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "XML", "Syntax", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "get", "\\u", "subm", "ission", "\\u", "error_", "(_", "domain_", ",_", "instance_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Duplicate", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "handle", "\\u", "id", "\\u", "conflict_", "(_", "instance_", ",_", "e_", "._", "xform_", ",_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "create", "\\u", "new", "\\u", "xform_", "(_", "domain_", ",_", "instance", "\\u", "xml_", ",_", "attachments_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "create", " ", "but", " ", "do", " ", "not", " ", "save", " ", "an", " ", "XF", "orm", "Insta", "nce", " ", "from", " ", "an", " ", "xform", " ", "payload", " ", "(", "xml", "\\u", "string", ")", "\\", "10", ";", " ", " ", " ", " ", "option", "ally", " ", "set", " ", "the", " ", "doc", " ", "\\u", "id", " ", "to", " ", "a", " ", "prede", "fined", " ", "value", " ", "(\\u", "id", ")", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "doc", " ", "\\u", "id", " ", "of", " ", "the", " ", "created", " ", "doc", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "process", "`", " ", "is", " ", "transformation", " ", "to", " ", "appl", "y", " ", "to", " ", "the", " ", "form", " ", "right", " ", "bef", "ore", " ", "saving", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "to", " ", "avoid", " ", "hav", "ing", " ", "to", " ", "save", " ", "multiple", " ", "times", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "xml", "\\u", "string", " ", "is", " ", "bad", " ", "xml", "\\", "10", ";", " ", " ", "-", " ", "raise", " ", "couch", "forms", ".", "XML", "Syntax", "Error", "\\", "10", ";", " ", " ", ":", "param", " ", "domain", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "interfaces_", "._", "processor_", "import_", "Form", "Process", "or", "Interface_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interface_", "=_", "Form", "Process", "or", "Interface_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "attachments_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "data_", "=_", "convert", "\\u", "xform", "\\u", "to", "\\u", "json_", "(_", "instance", "\\u", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adjust", "\\u", "datetimes", "_", "(_", "form", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xform_", "=_", "interface_", "._", "new", "\\u", "xform_", "(_", "form", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xform_", "._", "domain_", "=_", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Map", "s", " ", "all", " ", "attach", "ment", "s", " ", "to", " ", "uniform", " ", "format", " ", "and", " ", "adds", " ", "form", ".", "xml", " ", "to", " ", "list", " ", "bef", "ore", " ", "stor", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "attachments_", "=_", "map_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "a_", ":_", "Attachment_", "(_", "name_", "=_", "a_", "[_", "0_", "]_", ",_", "raw", "\\u", "content_", "=_", "a_", "[_", "1_", "]_", ",_", "content", "\\u", "type_", "=_", "a_", "[_", "1_", "]_", "._", "content", "\\u", "type_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attachments_", "._", "items_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attachments_", "._", "append_", "(_", "Attachment_", "(_", "name_", "=_", "'", "form", ".", "xml", "'_", ",_", "raw", "\\u", "content_", "=_", "instance", "\\u", "xml_", ",_", "content", "\\u", "type_", "=_", "'", "text", "/", "xml", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interface_", "._", "store", "\\u", "attachments_", "(_", "xform_", ",_", "attachments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Locke", "d", "Form", "Process", "ing", "Result_", "(_", "xform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Release", "On", "Error_", "(_", "result_", "._", "lock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "interface_", "._", "is", "\\u", "duplicate_", "(_", "xform_", "._", "form", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Duplicate", "Error_", "(_", "xform_", ")_", "\\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_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "subm", "ission", "\\u", "error_", "(_", "domain_", ",_", "instance_", ",_", "error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Handle", "'", "s", " ", "a", " ", "hard", " ", "fail", "ure", " ", "from", " ", "posting", " ", "a", " ", "form", " ", "to", " ", "couch", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "xform", " ", "error", " ", "instance", " ", "with", " ", "raw", " ", "xml", " ", "as", " ", "attach", "ment", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "unicode_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Decode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "unicode_", "(_", "str_", "(_", "error_", ")_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xform_", "=_", "Form", "Process", "or", "Interface_", "(_", "domain_", ")_", "._", "subm", "ission", "\\u", "error", "\\u", "form", "\\u", "instance_", "(_", "instance_", ",_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Form", "Process", "ing", "Result_", "(_", "xform_", ")_", "\\u\\u\\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", "handle", "\\u", "id", "\\u", "conflict_", "(_", "instance_", ",_", "xform_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "id", " ", "confl", "icts", ",", " ", "we", " ", "check", " ", "if", " ", "the", " ", "files", " ", "contain", " ", "exact", "ly", " ", "the", " ", "same", " ", "content", ",", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", "y", " ", "do", ",", " ", "we", " ", "just", " ", "log", " ", "this", " ", "as", " ", "a", " ", "dupe", ".", " ", "If", " ", "the", "y", " ", "don", "'", "t", ",", " ", "we", " ", "depre", "cate", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "previ", "ous", " ", "form", " ", "and", " ", "overwrit", "e", " ", "it", " ", "with", " ", "the", " ", "new", " ", "form", "'", "s", " ", "content", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "confl", "ict", "\\u", "id_", "=_", "xform_", "._", "form", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "interface_", "=_", "Form", "Process", "or", "Interface_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "interface_", "._", "is", "\\u", "duplicate_", "(_", "confl", "ict", "\\u", "id_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", " ", "look", "s", " ", "like", " ", "a", " ", "duplicat", "e", "/", "edit", " ", "in", " ", "the", " ", "same", " ", "domain", " ", "so", " ", "pur", "su", "e", " ", "tha", "t", " ", "workf", "low", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "handle", "\\u", "duplicate_", "(_", "xform_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "same", " ", "form", " ", "was", " ", "submitted", " ", "to", " ", "two", " ", "domains", ",", " ", "or", " ", "a", " ", "form", " ", "was", " ", "submitted", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "an", " ", "ID", " ", "tha", "t", " ", "belo", "nge", "d", " ", "to", " ", "a", " ", "different", " ", "doc", " ", "type", ".", " ", "these", " ", "are", " ", "like", "ly", " ", "developer", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "manu", "ally", " ", "testi", "ng", " ", "or", " ", "broken", " ", "API", " ", "users", ".", " ", "just", " ", "resu", "bmi", "t", " ", "with", " ", "a", " ", "generat", "ed", " ", "ID", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xform_", "=_", "interface_", "._", "assign", "\\u", "new", "\\u", "id_", "(_", "xform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Form", "Process", "ing", "Result_", "(_", "xform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "duplicate_", "(_", "new", "\\u", "doc_", ",_", "instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Handle", " ", "duplicat", "e", " ", "xform", "s", " ", "and", " ", "xform", " ", "editin", "g", " ", "('", "deprecation", "')", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "exist", "ing", " ", "doc", " ", "*", "must", "*", " ", "be", " ", "validat", "ed", " ", "as", " ", "an", " ", "XF", "orm", "Insta", "nce", " ", "in", " ", "the", " ", "right", " ", "domain", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "*", "must", "*", " ", "include", " ", "inline", " ", "attach", "ment", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "interface_", "=_", "Form", "Process", "or", "Interface_", "(_", "new", "\\u", "doc_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "confl", "ict", "\\u", "id_", "=_", "new", "\\u", "doc_", "._", "form", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "doc_", "=_", "Form", "Accessor", "s_", "(_", "new", "\\u", "doc_", "._", "domain_", ")_", "._", "get", "\\u", "with", "\\u", "attachments_", "(_", "confl", "ict", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exist", "ing", "\\u", "md5_", "=_", "exist", "ing", "\\u", "doc_", "._", "xml", "\\u", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "md5_", "=_", "new", "\\u", "doc_", "._", "xml", "\\u", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "exist", "ing", "\\u", "md5_", "!=_", "new", "\\u", "md5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "form", " ", "content", "s", " ", "are", " ", "not", " ", "the", " ", "same", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-", " ", "\"", "Dep", "reca", "te", "\"", " ", "the", " ", "old", " ", "form", " ", "by", " ", "mak", "ing", " ", "a", " ", "new", " ", "document", " ", "with", " ", "the", " ", "same", " ", "contents_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "but", " ", "a", " ", "different", " ", "ID", " ", "and", " ", "a", " ", "doc", "\\u", "type", " ", "of", " ", "XF", "orm", "Dep", "reca", "ted_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-", " ", "Save", " ", "the", " ", "new", " ", "instance", " ", "to", " ", "the", " ", "previ", "ous", " ", "document", " ", "to", " ", "preserve", " ", "the", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exist", "ing", "\\u", "doc_", ",_", "new", "\\u", "doc_", "=_", "appl", "y", "\\u", "deprecation", "_", "(_", "exist", "ing", "\\u", "doc_", ",_", "new", "\\u", "doc_", ",_", "interface_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Form", "Process", "ing", "Result_", "(_", "new", "\\u", "doc_", ",_", "exist", "ing", "\\u", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "follow", " ", "standard", " ", "dupe", " ", "handling", ",", " ", "whi", "ch", " ", "simp", "ly", " ", "save", "s", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "a", " ", "new", " ", "doc", "\\u", "id", ",", " ", "and", " ", "a", " ", "doc", "\\u", "type", " ", "of", " ", "XF", "orm", "Duplicate", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "duplicate_", "=_", "interface_", "._", "dedup", "licat", "e\\u", "xform_", "(_", "new", "\\u", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Form", "Process", "ing", "Result_", "(_", "duplicate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "\\u", "deprecation", "_", "(_", "exist", "ing", "\\u", "xform_", ",_", "new", "\\u", "xform_", ",_", "interface_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "form", " ", "content", "s", " ", "are", " ", "not", " ", "the", " ", "same", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-", " ", "\"", "Dep", "reca", "te", "\"", " ", "the", " ", "old", " ", "form", " ", "by", " ", "mak", "ing", " ", "a", " ", "new", " ", "document", " ", "with", " ", "the", " ", "same", " ", "contents_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "but", " ", "a", " ", "different", " ", "ID", " ", "and", " ", "a", " ", "doc", "\\u", "type", " ", "of", " ", "XF", "orm", "Dep", "reca", "ted_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "-", " ", "Save", " ", "the", " ", "new", " ", "instance", " ", "to", " ", "the", " ", "previ", "ous", " ", "document", " ", "to", " ", "preserve", " ", "the", " ", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "interface_", "=_", "interface_", "or_", "Form", "Process", "or", "Interface_", "(_", "exist", "ing", "\\u", "xform_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "xform_", "._", "form", "\\u", "id_", "=_", "exist", "ing", "\\u", "xform_", "._", "form", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "xform_", "=_", "interface_", "._", "assign", "\\u", "new", "\\u", "id_", "(_", "exist", "ing", "\\u", "xform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "xform_", "._", "orig", "\\u", "id_", "=_", "new", "\\u", "xform_", "._", "form", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "give", " ", "the", " ", "new", " ", "doc", " ", "server", " ", "data", " ", "of", " ", "the", " ", "old", " ", "one", " ", "and", " ", "some", " ", "metadata_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "xform_", "._", "receive", "d\\u", "on_", "=_", "exist", "ing", "\\u", "xform_", "._", "receive", "d\\u", "on_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "xform_", "._", "depre", "cated", "\\u", "form", "\\u", "id_", "=_", "exist", "ing", "\\u", "xform_", "._", "form", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "xform_", "._", "edited", "\\u", "on_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exist", "ing", "\\u", "xform_", "._", "edited", "\\u", "on_", "=_", "new", "\\u", "xform_", "._", "edited", "\\u", "on_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "interface_", "._", "appl", "y", "\\u", "deprecation", "_", "(_", "exist", "ing", "\\u", "xform_", ",_", "new", "\\u", "xform_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Except block handles 'BaseException'
petrvanblokland/Xierpa3/xierpa3/contributions/filibuster/blurbwriter.py
[ { "content": " def replacecode(self, text):\n m = 1\n pend= 0\n while m<>None:\n m = self.pstatement.search(text, pend)\n if m == None:\n return 0, text\n tag = m.group('tagname')\n if len(tag) == 0:\n raise 'Error in blurb code' # Better make it crash to show the error\n return 0, '__empty tag__'\n try:\n result = eval(tag)\n except:\n result = '__error('+tag+')__'\n if not isinstance(result, basestring):\n result = str(result)\n parts = string.split(text, '<-' + tag + '->')\n text = parts[0] + result + string.join(parts[1:], '<-' + tag + '->')\n return 1, text", "metadata": "root.BlurbWriter.replacecode", "header": "['class', 'BlurbWriter', '(', 'object', ')', ':', '___EOS___']", "index": 258 }, { "content": " def replacetag(self, level, text):\n level = level + 1\n if level > 100:\n raise 'recursion error? too many nested instructions!', self.lasttag\n #pend = 0\n m = 1\n while m<>None:\n start, stop = self.findtag(text)\n if start == None:\n return 0, text\n tag = text[start:stop]\n if len(tag) == 0:\n raise 'Error in blurb code' # Better make it crash to show the error\n return 0, '__empty tag__'\n\n # do the meta-recursive tag-tagging thing here\n metatext = text\n metatag = tag\n while string.find(tag, opentag) <> -1:\n _, metatag = self.replacetag(level, tag) # ok, metalog\n parts = string.split(metatext, tag)\n if len(parts) > 1:\n tag = string.join(parts, metatag)\n else:\n tag = metatag\n return self.replacetag(level, tag)\n \n tagname, cmd, variable, hard = self.parsetag(tag)\n # process in-tag commands, if any\n cachethis = 0 # whether results should be cached\n setarticle = 0 # prepare an article ( 'a' or 'an' )\n uppered = 0 # make first character uppercase\n formatcmds = []\n for i in cmd:\n si = string.strip(i)\n if not si:\n continue\n if si=='article':\n setarticle = 1\n elif si[0] == '!': # it's a format command!\n formatcmds.append(si[1:])\n elif si[0] == '^': # make first character uppercase\n uppered = 1\n\n parts = string.split(text, opentag + tag + closetag)\n if self.has_key(tagname):\n _, selection = self.choice(variable, tagname) # ci, selection\n _, c = self.replacetag(level, selection) # ok, c\n else:\n _, c = self.replacetag(level, '__' + tagname + '__') # ok, c \n self.lasttag = c\n\n # take care of the article command\n art = ''\n if setarticle:\n if c[0] in vowels:\n art = 'an '\n else:\n art = 'a '\n if uppered and c:\n c = string.upper(c[0])+c[1:]\n\n # format the line if necessary\n if len(formatcmds) > 0 and self.formatfunc:\n for fc in formatcmds:\n if DEBUG:\n print 'writerformatting before:', fc, c\n if not self.formatdict.has_key(fc):\n continue\n c = self.formatfunc(c, self.formatdict[fc])\n if DEBUG:\n print 'writerformatting after:', fc, c\n\n # build the new line\n vardef = c\n if variable:\n c = ''\n try:\n text = parts[0] + art + c + string.join(parts[1:], opentag + tag + closetag)\n except:\n print '13213312312321231'\n pass\n # store the result in the cache\n # note: it is storing the stylised version\n if variable or cachethis:\n if variable:\n tg = variable\n else:\n tg = tagname\n if hard:\n self.define(tg, vardef)\n else:\n self.softdefine(tg, vardef)\n return 0, text", "metadata": "root.BlurbWriter.replacetag", "header": "['class', 'BlurbWriter', '(', 'object', ')', ':', '___EOS___']", "index": 318 } ]
[ { "span": "except:", "start_line": 271, "start_column": 12, "end_line": 271, "end_column": 19 }, { "span": "except:", "start_line": 397, "start_column": 12, "end_line": 397, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Blur", "b", "Writer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "code_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pend", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "m_", "<_", ">_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "self_", "._", "pstat", "ement_", "._", "search_", "(_", "text_", ",_", "pend", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", ",_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tag_", "=_", "m_", "._", "group_", "(_", "'", "tagname", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "tag_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "'", "Error", " ", "in", " ", "blur", "b", " ", "code", "'_", "#", " ", "Bet", "ter", " ", "make", " ", "it", " ", "crash", " ", "to", " ", "show", " ", "the", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", ",_", "'\\u", "\\u", "empty", " ", "tag", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "eval_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "'\\u", "\\u", "error", "('_", "+_", "tag_", "+_", "')", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "result_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "str_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parts_", "=_", "string_", "._", "split_", "(_", "text_", ",_", "'<", "-'_", "+_", "tag_", "+_", "'->", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "parts_", "[_", "0_", "]_", "+_", "result_", "+_", "string_", "._", "join_", "(_", "parts_", "[_", "1_", ":_", "]_", ",_", "'<", "-'_", "+_", "tag_", "+_", "'->", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "1_", ",_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blur", "b", "Writer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "tag_", "(_", "self_", ",_", "level_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level_", "=_", "level_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level_", ">_", "100_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "'", "recursion", " ", "error", "?", " ", "too", " ", "many", " ", "nest", "ed", " ", "instruct", "ion", "s", "!'_", ",_", "self_", "._", "last", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "pend", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "m_", "<_", ">_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", ",_", "stop_", "=_", "self_", "._", "find", "tag_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "start_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", ",_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tag_", "=_", "text_", "[_", "start_", ":_", "stop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "tag_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "'", "Error", " ", "in", " ", "blur", "b", " ", "code", "'_", "#", " ", "Bet", "ter", " ", "make", " ", "it", " ", "crash", " ", "to", " ", "show", " ", "the", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", ",_", "'\\u", "\\u", "empty", " ", "tag", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "the", " ", "meta", "-", "recurs", "ive", " ", "tag", "-", "tagging", " ", "thing", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "meta", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta", "tag_", "=_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "string_", "._", "find_", "(_", "tag_", ",_", "opent", "ag_", ")_", "<_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "meta", "tag_", "=_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "tag_", ")_", "#", " ", "ok", ",", " ", "metal", "og_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parts_", "=_", "string_", "._", "split_", "(_", "meta", "text_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tag_", "=_", "string_", "._", "join_", "(_", "parts_", ",_", "meta", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tag_", "=_", "meta", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tagname_", ",_", "cmd_", ",_", "variable_", ",_", "hard", "_", "=_", "self_", "._", "parset", "ag_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "process", " ", "in", "-", "tag", " ", "command", "s", ",", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "this_", "=_", "0_", "#", " ", "whe", "ther", " ", "results", " ", "shou", "ld", " ", "be", " ", "cached_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seta", "rti", "cle_", "=_", "0_", "#", " ", "prepar", "e", " ", "an", " ", "article", " ", "(", " ", "'", "a", "'", " ", "or", " ", "'", "an", "'", " ", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upper", "ed_", "=_", "0_", "#", " ", "make", " ", "first", " ", "character", " ", "uppercase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format", "cmds_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "cmd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "si_", "=_", "string_", "._", "strip_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "si_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "si_", "==_", "'", "article", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "seta", "rti", "cle_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "si_", "[_", "0_", "]_", "==_", "'!'_", ":_", "#", " ", "it", "'", "s", " ", "a", " ", "format", " ", "command", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "format", "cmds_", "._", "append_", "(_", "si_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "si_", "[_", "0_", "]_", "==_", "'", "^", "'_", ":_", "#", " ", "make", " ", "first", " ", "character", " ", "uppercase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "upper", "ed_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parts_", "=_", "string_", "._", "split_", "(_", "text_", ",_", "opent", "ag_", "+_", "tag_", "+_", "close", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "key_", "(_", "tagname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "selection_", "=_", "self_", "._", "choice_", "(_", "variable_", ",_", "tagname_", ")_", "#", " ", "ci", ",", " ", "selection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "c_", "=_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "selection_", ")_", "#", " ", "ok", ",", " ", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "c_", "=_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "'\\u\\u'_", "+_", "tagname_", "+_", "'\\u\\u'_", ")_", "#", " ", "ok", ",", " ", "c", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "last", "tag_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "take", " ", "care", " ", "of", " ", "the", " ", "article", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "art_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "seta", "rti", "cle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "c_", "[_", "0_", "]_", "in_", "vowels", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "art_", "=_", "'", "an", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "art_", "=_", "'", "a", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "upper", "ed_", "and_", "c_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "string_", "._", "upper_", "(_", "c_", "[_", "0_", "]_", ")_", "+_", "c_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "format", " ", "the", " ", "line", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "format", "cmds_", ")_", ">_", "0_", "and_", "self_", "._", "format", "func_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "fc_", "in_", "format", "cmds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "writer", "format", "ting", " ", "bef", "ore", ":'_", ",_", "fc_", ",_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "format", "dict_", "._", "has", "\\u", "key_", "(_", "fc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "self_", "._", "format", "func_", "(_", "c_", ",_", "self_", "._", "format", "dict_", "[_", "fc_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "writer", "format", "ting", " ", "after", ":'_", ",_", "fc_", ",_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "the", " ", "new", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vard", "ef_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "variable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "parts_", "[_", "0_", "]_", "+_", "art_", "+_", "c_", "+_", "string_", "._", "join_", "(_", "parts_", "[_", "1_", ":_", "]_", ",_", "opent", "ag_", "+_", "tag_", "+_", "close", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "132", "133", "1231", "232", "1231", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "the", " ", "result", " ", "in", " ", "the", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", ":", " ", "it", " ", "is", " ", "stor", "ing", " ", "the", " ", "sty", "lis", "ed", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "variable_", "or_", "cache", "this_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "variable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tg_", "=_", "variable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tg_", "=_", "tagname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hard", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "define_", "(_", "tg_", ",_", "vard", "ef_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "soft", "define_", "(_", "tg_", ",_", "vard", "ef_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uD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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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported more than once
pyjs/pyjs/pyjs/__init__.py
[ { "content": "import sys\nimport os\ntry:\n import lib2to3\nexcept ImportError:\n import pgen\n import lib2to3\n\npath = [os.path.abspath('')]\n\n\n# default to None indicates 'relative paths' so that as a self-contained\n# archive, pyjs can run its tests.\ntry:\n import pyjswidgets\n import pyjswaddons\n pyjspth = os.path.abspath(os.path.join(__file__,'../'))\n path += [os.path.dirname(pyjswidgets.__file__),\n os.path.dirname(pyjswaddons.__file__), ]\nexcept ImportError:\n pyjspth = None\n\nif 'PYJSPATH' in os.environ:\n for p in os.environ['PYJSPATH'].split(os.pathsep):\n p = os.path.abspath(p)\n if os.path.isdir(p):\n path.append(p)\n\nMOD_SUFFIX = '.js'\n\nPYTHON = os.path.realpath(sys.executable) if sys.executable else None\nif PYTHON is None or not os.access(PYTHON, os.X_OK):\n PYTHON = 'python'\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import lib2to3", "start_line": 6, "start_column": 4, "end_line": 6, "end_column": 18 } ]
[ { "span": "import lib2to3", "start_line": 3, "start_column": 4, "end_line": 3, "end_column": 18 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "lib", "2t", "o3", "_", "\\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_", "pge", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lib", "2t", "o3", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "[_", "os_", "._", "path_", "._", "abspath_", "(_", "''_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", " ", "to", " ", "Non", "e", " ", "indicat", "es", " ", "'", "relative", " ", "path", "s", "'", " ", "so", " ", "tha", "t", " ", "as", " ", "a", " ", "self", "-", "contain", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "archive", ",", " ", "pyj", "s", " ", "can", " ", "run", " ", "its", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pyj", "swi", "dget", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyj", "swa", "ddo", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyj", "spt", "h_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u", "file\\u\\u_", ",_", "'../", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "+=_", "[_", "os_", "._", "path_", "._", "dirname_", "(_", "pyj", "swi", "dget", "s_", "._", "\\u\\u", "file\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "pyj", "swa", "ddo", "ns_", "._", "\\u\\u", "file\\u\\u_", ")_", ",_", "]_", "\\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 ", " _", "pyj", "spt", "h_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "PY", "JS", "PATH", "'_", "in_", "os_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "p_", "in_", "os_", "._", "environ_", "[_", "'", "PY", "JS", "PATH", "'_", "]_", "._", "split_", "(_", "os_", "._", "pathsep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "._", "append_", "(_", "p_", ")_", "\\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_", "MOD", "\\u", "SUFFIX_", "=_", "'.", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PYTHON", "_", "=_", "os_", "._", "path_", "._", "realpath_", "(_", "sys_", "._", "executable_", ")_", "if_", "sys_", "._", "executable_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "PYTHON", "_", "is_", "None_", "or_", "not_", "os_", "._", "access_", "(_", "PYTHON", "_", ",_", "os_", "._", "X", "\\u", "OK_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PYTHON", "_", "=_", "'", "python", "'_", "\\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, 3, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
realestate-com-au/harpoon/docs/sphinx/ext/show_tasks.py
[ { "content": "from harpoon.task_finder import TaskFinder\nfrom harpoon.collector import Collector\n\nfrom docutils.statemachine import ViewList\nfrom sphinx.util.compat import Directive\nfrom textwrap import dedent\nfrom docutils import nodes\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ShowTasksDirective(Directive):\n \"\"\"Directive for outputting all the default harpoon tasks\"\"\"\n has_content = True\n", "metadata": "root.ShowTasksDirective", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def run(self):\n \"\"\"For each file in noseOfYeti/specs, output nodes to represent each spec file\"\"\"\n tokens = []\n section = nodes.section()\n section['ids'].append(\"available-tasks\")\n\n title = nodes.title()\n title += nodes.Text(\"Default tasks\")\n section += title\n\n task_finder = TaskFinder(Collector())\n for name, task in sorted(task_finder.default_tasks().items(), key=lambda x: len(x[0])):\n\n lines = [name] + [\" {0}\".format(line.strip()) for line in task.description.split('\\n')]\n viewlist = ViewList()\n for line in lines:\n viewlist.append(line, name)\n self.state.nested_parse(viewlist, self.content_offset, section)\n\n return [section]", "metadata": "root.ShowTasksDirective.run", "header": "['class', 'ShowTasksDirective', '(', 'Directive', ')', ':', '___EOS___']", "index": 12 }, { "content": "def setup(app):\n \"\"\"Setup the show_specs directive\"\"\"\n app.add_directive('show_tasks', ShowTasksDirective)", "metadata": "root.setup", "header": "['module', '___EOS___']", "index": 33 } ]
[ { "span": "from textwrap import dedent", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "har", "poo", "n_", "._", "task", "\\u", "finder_", "import_", "Task", "Finder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "har", "poo", "n_", "._", "collector_", "import_", "Collector_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "docutils_", "._", "statem", "achi", "ne_", "import_", "View", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sphinx_", "._", "util_", "._", "compat_", "import_", "Directive", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "textwrap_", "import_", "dedent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "docutils_", "import_", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Show", "Task", "s", "Directive", "_", "(_", "Directive", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Directive", " ", "for", " ", "output", "ting", " ", "all", " ", "the", " ", "default", " ", "har", "poo", "n", " ", "task", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "content_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Show", "Task", "s", "Directive", "_", "(_", "Directive", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "For", " ", "each", " ", "file", " ", "in", " ", "nose", "Of", "Ye", "ti", "/", "spec", "s", ",", " ", "output", " ", "nodes", " ", "to", " ", "represent", " ", "each", " ", "spec", " ", "file", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tokens_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "=_", "nodes_", "._", "section_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "[_", "'", "ids", "'_", "]_", "._", "append_", "(_", "\"", "avail", "able", "-", "task", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "nodes_", "._", "title_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "+=_", "nodes_", "._", "Text_", "(_", "\"", "Default", " ", "task", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "+=_", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "finder_", "=_", "Task", "Finder_", "(_", "Collector_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "task_", "in_", "sorted_", "(_", "task", "\\u", "finder_", "._", "default", "\\u", "tasks_", "(_", ")_", "._", "items_", "(_", ")_", ",_", "key_", "=_", "lambda_", "x_", ":_", "len_", "(_", "x_", "[_", "0_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "=_", "[_", "name_", "]_", "+_", "[_", "\"", " ", " ", "{", "0", "}\"_", "._", "format_", "(_", "line_", "._", "strip_", "(_", ")_", ")_", "for_", "line_", "in_", "task_", "._", "description_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "list_", "=_", "View", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view", "list_", "._", "append_", "(_", "line_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "state_", "._", "nest", "ed", "\\u", "parse_", "(_", "view", "list_", ",_", "self_", "._", "content", "\\u", "offset_", ",_", "section_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "section_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", "up", " ", "the", " ", "show", "\\u", "spec", "s", " ", "directive", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "directive_", "(_", "'", "show", "\\u", "task", "s", "'_", ",_", "Show", "Task", "s", "Directive", "_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
cloudera/hue/desktop/core/ext-py/tablib-0.10.0/tablib/packages/openpyxl3/reader/iter_worksheet.py
[ { "content": "# file openpyxl/reader/iter_worksheet.py\n\n# Copyright (c) 2010 openpyxl\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n# @license: http://www.opensource.org/licenses/mit-license.php\n# @author: Eric Gazoni\n\n\"\"\" Iterators-based worksheet reader \n*Still very raw*\n\"\"\"\n\nfrom io import StringIO\nimport warnings\nimport operator\nfrom functools import partial\nfrom itertools import groupby\nfrom ..worksheet import Worksheet\nfrom ..cell import coordinate_from_string, get_column_letter, Cell\nfrom .excel import get_sheet_ids\nfrom .strings import read_string_table\nfrom .style import read_style_table, NumberFormat\nfrom ..shared.date_time import SharedDate\nfrom .worksheet import read_dimension\nfrom ..shared.ooxml import (MIN_COLUMN, MAX_COLUMN, PACKAGE_WORKSHEETS,\n MAX_ROW, MIN_ROW, ARC_SHARED_STRINGS, ARC_APP, ARC_STYLE)\nfrom xml.etree.cElementTree import iterparse\nfrom zipfile import ZipFile\nfrom .. import cell\nimport re\nimport tempfile\nimport zlib\nimport zipfile\nimport struct\n\nTYPE_NULL = Cell.TYPE_NULL\nMISSING_VALUE = None \n\nRE_COORDINATE = re.compile('^([A-Z]+)([0-9]+)$')\n\nSHARED_DATE = SharedDate()\n\n_COL_CONVERSION_CACHE = dict((get_column_letter(i), i) for i in range(1, 18279))\ndel _COL_CONVERSION_CACHE\n\nRAW_ATTRIBUTES = ['row', 'column', 'coordinate', 'internal_value', 'data_type', 'style_id', 'number_format']\n\ntry:\n from collections import namedtuple\n BaseRawCell = namedtuple('RawCell', RAW_ATTRIBUTES)\nexcept ImportError:\n\n warnings.warn(\"\"\"Unable to import 'namedtuple' module, this may cause memory issues when using optimized reader. Please upgrade your Python installation to 2.6+\"\"\")\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 column_index_from_string(str_col, _col_conversion_cache=_COL_CONVERSION_CACHE):\n # we use a function argument to get indexed name lookup\n return _col_conversion_cache[str_col]", "metadata": "root.column_index_from_string", "header": "['module', '___EOS___']", "index": 60 }, { "content": " class BaseRawCell(object):\n\n", "metadata": "root.BaseRawCell", "header": "['module', '___EOS___']", "index": 74 }, { "content": " def __init__(self, *args):\n assert len(args)==len(RAW_ATTRIBUTES)\n\n for attr, val in zip(RAW_ATTRIBUTES, args):\n setattr(self, attr, val)", "metadata": "root.BaseRawCell.__init__", "header": "['class', 'BaseRawCell', '(', 'object', ')', ':', '___EOS___']", "index": 76 }, { "content": " def _replace(self, **kwargs):\n\n self.__dict__.update(kwargs)\n\n return self", "metadata": "root.BaseRawCell._replace", "header": "['class', 'BaseRawCell', '(', 'object', ')', ':', '___EOS___']", "index": 82 }, { "content": "class RawCell(BaseRawCell):\n \"\"\"Optimized version of the :class:`..cell.Cell`, using named tuples.\n\n Useful attributes are:\n\n * row\n * column\n * coordinate\n * internal_value\n\n You can also access if needed:\n\n * data_type\n * number_format\n\n \"\"\"\n", "metadata": "root.RawCell", "header": "['module', '___EOS___']", "index": 89 }, { "content": " @property\n def is_date(self):\n res = (self.data_type == Cell.TYPE_NUMERIC\n and self.number_format is not None\n and ('d' in self.number_format \n or 'm' in self.number_format\n or 'y' in self.number_format\n or 'h' in self.number_format\n or 's' in self.number_format \n ))\n\n return res", "metadata": "root.RawCell.is_date", "header": "['class', 'RawCell', '(', 'BaseRawCell', ')', ':', '___EOS___']", "index": 106 }, { "content": "def iter_rows(workbook_name, sheet_name, xml_source, range_string = '', row_offset = 0, column_offset = 0):\n\n archive = get_archive_file(workbook_name)\n\n source = xml_source \n\n if range_string:\n min_col, min_row, max_col, max_row = get_range_boundaries(range_string, row_offset, column_offset)\n else:\n min_col, min_row, max_col, max_row = read_dimension(xml_source = source)\n min_col = column_index_from_string(min_col)\n max_col = column_index_from_string(max_col) + 1\n max_row += 6\n\n try:\n string_table = read_string_table(archive.read(ARC_SHARED_STRINGS))\n except KeyError:\n string_table = {}\n\n style_table = read_style_table(archive.read(ARC_STYLE))\n\n source.seek(0)\n p = iterparse(source)\n\n return get_squared_range(p, min_col, min_row, max_col, max_row, string_table, style_table)", "metadata": "root.iter_rows", "header": "['module', '___EOS___']", "index": 119 }, { "content": "def get_rows(p, min_column = MIN_COLUMN, min_row = MIN_ROW, max_column = MAX_COLUMN, max_row = MAX_ROW):\n\n return groupby(get_cells(p, min_row, min_column, max_row, max_column), operator.attrgetter('row'))", "metadata": "root.get_rows", "header": "['module', '___EOS___']", "index": 146 }, { "content": "def get_cells(p, min_row, min_col, max_row, max_col, _re_coordinate=RE_COORDINATE):\n\n for _event, element in p:\n\n if element.tag == '{http://schemas.openxmlformats.org/spreadsheetml/2006/main}c':\n coord = element.get('r')\n column_str, row = _re_coordinate.match(coord).groups()\n\n row = int(row)\n column = column_index_from_string(column_str)\n\n if min_col <= column <= max_col and min_row <= row <= max_row:\n data_type = element.get('t', 'n')\n style_id = element.get('s')\n value = element.findtext('{http://schemas.openxmlformats.org/spreadsheetml/2006/main}v')\n yield RawCell(row, column_str, coord, value, data_type, style_id, None)\n\n if element.tag == '{http://schemas.openxmlformats.org/spreadsheetml/2006/main}v':\n continue\n element.clear()", "metadata": "root.get_cells", "header": "['module', '___EOS___']", "index": 150 }, { "content": "def get_range_boundaries(range_string, row = 0, column = 0):\n\n if ':' in range_string:\n min_range, max_range = range_string.split(':')\n min_col, min_row = coordinate_from_string(min_range)\n max_col, max_row = coordinate_from_string(max_range)\n\n min_col = column_index_from_string(min_col) + column\n max_col = column_index_from_string(max_col) + column\n min_row += row\n max_row += row\n\n else:\n min_col, min_row = coordinate_from_string(range_string)\n min_col = column_index_from_string(min_col)\n max_col = min_col + 1\n max_row = min_row \n\n return (min_col, min_row, max_col, max_row)", "metadata": "root.get_range_boundaries", "header": "['module', '___EOS___']", "index": 173 }, { "content": "def get_archive_file(archive_name):\n\n return ZipFile(archive_name, 'r')", "metadata": "root.get_archive_file", "header": "['module', '___EOS___']", "index": 193 }, { "content": "def get_xml_source(archive_file, sheet_name):\n\n return archive_file.read('%s/%s' % (PACKAGE_WORKSHEETS, sheet_name))", "metadata": "root.get_xml_source", "header": "['module', '___EOS___']", "index": 197 }, { "content": "def get_missing_cells(row, columns):\n\n return dict([(column, RawCell(row, column, '%s%s' % (column, row), MISSING_VALUE, TYPE_NULL, None, None)) for column in columns])", "metadata": "root.get_missing_cells", "header": "['module', '___EOS___']", "index": 201 }, { "content": "def get_squared_range(p, min_col, min_row, max_col, max_row, string_table, style_table):\n\n expected_columns = [get_column_letter(ci) for ci in range(min_col, max_col)]\n\n current_row = min_row\n for row, cells in get_rows(p, min_row = min_row, max_row = max_row, min_column = min_col, max_column = max_col):\n full_row = []\n if current_row < row:\n\n for gap_row in range(current_row, row):\n\n dummy_cells = get_missing_cells(gap_row, expected_columns)\n \n yield tuple([dummy_cells[column] for column in expected_columns])\n\n current_row = row\n\n temp_cells = list(cells)\n\n retrieved_columns = dict([(c.column, c) for c in temp_cells])\n\n missing_columns = list(set(expected_columns) - set(retrieved_columns.keys()))\n\n replacement_columns = get_missing_cells(row, missing_columns)\n\n for column in expected_columns:\n\n if column in retrieved_columns:\n cell = retrieved_columns[column]\n\n if cell.style_id is not None:\n style = style_table[int(cell.style_id)]\n cell = cell._replace(number_format = style.number_format.format_code) #pylint: disable-msg=W0212\n if cell.internal_value is not None:\n if cell.data_type == Cell.TYPE_STRING:\n cell = cell._replace(internal_value = string_table[int(cell.internal_value)]) #pylint: disable-msg=W0212\n elif cell.data_type == Cell.TYPE_BOOL:\n cell = cell._replace(internal_value = cell.internal_value == 'True')\n elif cell.is_date:\n cell = cell._replace(internal_value = SHARED_DATE.from_julian(float(cell.internal_value)))\n elif cell.data_type == Cell.TYPE_NUMERIC:\n cell = cell._replace(internal_value = float(cell.internal_value))\n full_row.append(cell)\n\n else:\n full_row.append(replacement_columns[column])\n\n current_row = row + 1\n\n yield tuple(full_row)", "metadata": "root.get_squared_range", "header": "['module', '___EOS___']", "index": 205 }, { "content": "class IterableWorksheet(Worksheet):\n\n\n\n", "metadata": "root.IterableWorksheet", "header": "['module', '___EOS___']", "index": 258 }, { "content": " def __init__(self, parent_workbook, title, workbook_name, \n sheet_codename, xml_source):\n\n Worksheet.__init__(self, parent_workbook, title)\n self._workbook_name = workbook_name\n self._sheet_codename = sheet_codename\n self._xml_source = xml_source", "metadata": "root.IterableWorksheet.__init__", "header": "['class', 'IterableWorksheet', '(', 'Worksheet', ')', ':', '___EOS___']", "index": 260 }, { "content": " def iter_rows(self, range_string = '', row_offset = 0, column_offset = 0):\n \"\"\" Returns a squared range based on the `range_string` parameter, \n using generators.\n \n :param range_string: range of cells (e.g. 'A1:C4')\n :type range_string: string\n \n :param row: row index of the cell (e.g. 4)\n :type row: int\n\n :param column: column index of the cell (e.g. 3)\n :type column: int\n \n :rtype: generator\n \n \"\"\"\n\n return iter_rows(workbook_name = self._workbook_name,\n sheet_name = self._sheet_codename,\n xml_source = self._xml_source,\n range_string = range_string,\n row_offset = row_offset,\n column_offset = column_offset)", "metadata": "root.IterableWorksheet.iter_rows", "header": "['class', 'IterableWorksheet', '(', 'Worksheet', ')', ':', '___EOS___']", "index": 268 }, { "content": " def cell(self, *args, **kwargs):\n\n raise NotImplementedError(\"use 'iter_rows()' instead\")", "metadata": "root.IterableWorksheet.cell", "header": "['class', 'IterableWorksheet', '(', 'Worksheet', ')', ':', '___EOS___']", "index": 292 }, { "content": " def range(self, *args, **kwargs):\n\n raise NotImplementedError(\"use 'iter_rows()' instead\")", "metadata": "root.IterableWorksheet.range", "header": "['class', 'IterableWorksheet', '(', 'Worksheet', ')', ':', '___EOS___']", "index": 296 }, { "content": "def unpack_worksheet(archive, filename):\n\n temp_file = tempfile.TemporaryFile(mode='r+', prefix='openpyxl.', suffix='.unpack.temp')\n\n zinfo = archive.getinfo(filename)\n\n if zinfo.compress_type == zipfile.ZIP_STORED:\n decoder = None\n elif zinfo.compress_type == zipfile.ZIP_DEFLATED:\n decoder = zlib.decompressobj(-zlib.MAX_WBITS)\n else:\n raise zipfile.BadZipFile(\"Unrecognized compression method\")\n\n archive.fp.seek(_get_file_offset(archive, zinfo))\n bytes_to_read = zinfo.compress_size\n\n while True:\n buff = archive.fp.read(min(bytes_to_read, 102400))\n if not buff:\n break\n bytes_to_read -= len(buff)\n if decoder:\n buff = decoder.decompress(buff)\n temp_file.write(buff)\n\n if decoder:\n temp_file.write(decoder.decompress('Z'))\n\n return temp_file", "metadata": "root.unpack_worksheet", "header": "['module', '___EOS___']", "index": 300 }, { "content": "def _get_file_offset(archive, zinfo):\n\n try:\n return zinfo.file_offset\n except AttributeError:\n # From http://stackoverflow.com/questions/3781261/how-to-simulate-zipfile-open-in-python-2-5\n\n # Seek over the fixed size fields to the \"file name length\" field in\n # the file header (26 bytes). Unpack this and the \"extra field length\"\n # field ourselves as info.extra doesn't seem to be the correct length.\n archive.fp.seek(zinfo.header_offset + 26)\n file_name_len, extra_len = struct.unpack(\"<HH\", archive.fp.read(4))\n return zinfo.header_offset + 30 + file_name_len + extra_len", "metadata": "root._get_file_offset", "header": "['module', '___EOS___']", "index": 330 } ]
[ { "span": "from io import StringIO", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 23 }, { "span": "from functools import partial", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "file", " ", "openp", "yx", "l", "/", "reader", "/", "iter", "\\u", "worksheet", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", " ", "openp", "yx", "l_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "license", ":", " ", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "mit", "-", "license", ".", "php", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "@", "author", ":", " ", "Eri", "c", " ", "Ga", "zon", "i_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Iterat", "ors", "-", "based", " ", "worksheet", " ", "reader", " ", "\\", "10", ";", "*", "Stil", "l", " ", "very", " ", "raw", "*", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "io_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "groupby_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "worksheet_", "import_", "Worksh", "eet", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "cell_", "import_", "coordinate", "\\u", "from", "\\u", "string_", ",_", "get", "\\u", "column", "\\u", "letter_", ",_", "Cell_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "excel_", "import_", "get", "\\u", "sheet", "\\u", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "strings_", "import_", "read", "\\u", "string", "\\u", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "style_", "import_", "read", "\\u", "style", "\\u", "table_", ",_", "Number", "Format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "shared_", "._", "date", "\\u", "time_", "import_", "Share", "d", "Date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "worksheet_", "import_", "read", "\\u", "dimension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "shared_", "._", "oo", "xml_", "import_", "(_", "MIN", "\\u", "COLUMN_", ",_", "MAX", "\\u", "COLUMN_", ",_", "PACKAG", "E", "\\u", "WORKS", "HE", "ET", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "ROW", "_", ",_", "MIN", "\\u", "ROW", "_", ",_", "ARC", "\\u", "SHARED", "\\u", "STRING", "S_", ",_", "ARC", "\\u", "APP_", ",_", "ARC", "\\u", "STYLE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "etree_", "._", "c", "Element", "Tree_", "import_", "iter", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zipfile_", "import_", "Zip", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "import_", "cell_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TYPE", "\\u", "NULL_", "=_", "Cell_", "._", "TYPE", "\\u", "NULL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MISSING", "\\u", "VALUE_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "RE", "\\u", "COORD", "INA", "TE_", "=_", "re_", "._", "compile_", "(_", "'", "^", "([", "A", "-", "Z", "]+)", "([", "0", "-", "9", "]+)", "$'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SHARED", "\\u", "DATE_", "=_", "Share", "d", "Date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "COL", "\\u", "CONVE", "RSI", "ON", "\\u", "CACHE_", "=_", "dict_", "(_", "(_", "get", "\\u", "column", "\\u", "letter_", "(_", "i_", ")_", ",_", "i_", ")_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "182", "79_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "\\u", "COL", "\\u", "CONVE", "RSI", "ON", "\\u", "CACHE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "RA", "W", "\\u", "ATTRIBUTES_", "=_", "[_", "'", "row", "'_", ",_", "'", "column", "'_", ",_", "'", "coordinate", "'_", ",_", "'", "internal", "\\u", "value", "'_", ",_", "'", "data\\u", "type", "'_", ",_", "'", "style", "\\u", "id", "'_", ",_", "'", "number", "\\u", "format", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base", "Ra", "w", "Cell_", "=_", "namedtuple_", "(_", "'", "Ra", "w", "Cel", "l", "'_", ",_", "RA", "W", "\\u", "ATTRIBUTES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"\"\"", "Una", "ble", " ", "to", " ", "import", " ", "'", "namedtupl", "e", "'", " ", "module", ",", " ", "this", " ", "may", " ", "caus", "e", " ", " ", "memory", " ", "issue", "s", " ", "whe", "n", " ", "usi", "ng", " ", "optimize", "d", " ", "reader", ".", " ", "Ple", "ase", " ", "upgrade", " ", "your", " ", "Pyth", "on", " ", "installation", " ", "to", " ", "2.6", "+\"", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "column", "\\u", "index", "\\u", "from", "\\u", "string_", "(_", "str", "\\u", "col_", ",_", "\\u", "col", "\\u", "conve", "rsi", "on", "\\u", "cache_", "=_", "\\u", "COL", "\\u", "CONVE", "RSI", "ON", "\\u", "CACHE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "use", " ", "a", " ", "function", " ", "argu", "ment", " ", "to", " ", "get", " ", "indexe", "d", " ", "name", " ", "lookup_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "col", "\\u", "conve", "rsi", "on", "\\u", "cache_", "[_", "str", "\\u", "col_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Base", "Ra", "w", "Cell_", "(_", "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_", "[SEP]_", "class_", "Base", "Ra", "w", "Cell_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "len_", "(_", "args_", ")_", "==_", "len_", "(_", "RA", "W", "\\u", "ATTRIBUTES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "attr_", ",_", "val_", "in_", "zip_", "(_", "RA", "W", "\\u", "ATTRIBUTES_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", ",_", "attr_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Ra", "w", "Cell_", "(_", "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", "replace_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "update_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ra", "w", "Cell_", "(_", "Base", "Ra", "w", "Cell_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Optimize", "d", " ", "version", " ", "of", " ", "the", " ", ":", "class", ":`", "..", "cell", ".", "Cel", "l", "`", ",", " ", "usi", "ng", " ", "named", " ", "tuple", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "efu", "l", " ", "attribute", "s", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "row", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "column", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "coordinate", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "internal", "\\u", "value", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "als", "o", " ", "access", " ", "if", " ", "need", "ed", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "data\\u", "type", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "number", "\\u", "format", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ra", "w", "Cell_", "(_", "Base", "Ra", "w", "Cell_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "is", "\\u", "date_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "(_", "self_", "._", "data\\u", "type_", "==_", "Cell_", "._", "TYPE", "\\u", "NUMERIC", "_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "self_", "._", "number", "\\u", "format_", "is_", "not_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "(_", "'", "d", "'_", "in_", "self_", "._", "number", "\\u", "format_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "'", "m", "'_", "in_", "self_", "._", "number", "\\u", "format_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "'", "y", "'_", "in_", "self_", "._", "number", "\\u", "format_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "'", "h", "'_", "in_", "self_", "._", "number", "\\u", "format_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "'", "s", "'_", "in_", "self_", "._", "number", "\\u", "format_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "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_", "def_", "iter", "\\u", "rows_", "(_", "workbook", "\\u", "name_", ",_", "sheet", "\\u", "name_", ",_", "xml", "\\u", "source_", ",_", "range", "\\u", "string_", "=_", "''_", ",_", "row", "\\u", "offset_", "=_", "0_", ",_", "column", "\\u", "offset_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "archive_", "=_", "get", "\\u", "archive", "\\u", "file_", "(_", "workbook", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "=_", "xml", "\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "range", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "col_", ",_", "min", "\\u", "row_", ",_", "max", "\\u", "col_", ",_", "max", "\\u", "row_", "=_", "get", "\\u", "range", "\\u", "boundaries_", "(_", "range", "\\u", "string_", ",_", "row", "\\u", "offset_", ",_", "column", "\\u", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "col_", ",_", "min", "\\u", "row_", ",_", "max", "\\u", "col_", ",_", "max", "\\u", "row_", "=_", "read", "\\u", "dimension_", "(_", "xml", "\\u", "source_", "=_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "col_", "=_", "column", "\\u", "index", "\\u", "from", "\\u", "string_", "(_", "min", "\\u", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "col_", "=_", "column", "\\u", "index", "\\u", "from", "\\u", "string_", "(_", "max", "\\u", "col_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "row_", "+=_", "6_", "\\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 ", " _", "string", "\\u", "table_", "=_", "read", "\\u", "string", "\\u", "table_", "(_", "archive_", "._", "read_", "(_", "ARC", "\\u", "SHARED", "\\u", "STRING", "S_", ")_", ")_", "\\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 ", " _", "string", "\\u", "table_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "style", "\\u", "table_", "=_", "read", "\\u", "style", "\\u", "table_", "(_", "archive_", "._", "read_", "(_", "ARC", "\\u", "STYLE_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "source_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "iter", "parse_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "get", "\\u", "square", "d\\u", "range_", "(_", "p_", ",_", "min", "\\u", "col_", ",_", "min", "\\u", "row_", ",_", "max", "\\u", "col_", ",_", "max", "\\u", "row_", ",_", "string", "\\u", "table_", ",_", "style", "\\u", "table_", ")_", "\\u\\u\\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", "rows_", "(_", "p_", ",_", "min", "\\u", "column_", "=_", "MIN", "\\u", "COLUMN_", ",_", "min", "\\u", "row_", "=_", "MIN", "\\u", "ROW", "_", ",_", "max", "\\u", "column_", "=_", "MAX", "\\u", "COLUMN_", ",_", "max", "\\u", "row_", "=_", "MAX", "\\u", "ROW", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "groupby_", "(_", "get", "\\u", "cells_", "(_", "p_", ",_", "min", "\\u", "row_", ",_", "min", "\\u", "column_", ",_", "max", "\\u", "row_", ",_", "max", "\\u", "column_", ")_", ",_", "operator_", "._", "attrgetter_", "(_", "'", "row", "'_", ")_", ")_", "\\u\\u\\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", "cells_", "(_", "p_", ",_", "min", "\\u", "row_", ",_", "min", "\\u", "col_", ",_", "max", "\\u", "row_", ",_", "max", "\\u", "col_", ",_", "\\u", "re", "\\u", "coordinate_", "=_", "RE", "\\u", "COORD", "INA", "TE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "\\u", "event_", ",_", "element_", "in_", "p_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "element_", "._", "tag_", "==_", "'{", "http", "://", "schema", "s", ".", "open", "xml", "formats", ".", "org", "/", "spreadsheet", "ml", "/", "2006", "/", "main", "}", "c", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coord_", "=_", "element_", "._", "get_", "(_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column", "\\u", "str_", ",_", "row_", "=_", "\\u", "re", "\\u", "coordinate_", "._", "match_", "(_", "coord_", ")_", "._", "groups_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "row_", "=_", "int_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "column_", "=_", "column", "\\u", "index", "\\u", "from", "\\u", "string_", "(_", "column", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "min", "\\u", "col_", "<=_", "column_", "<=_", "max", "\\u", "col_", "and_", "min", "\\u", "row_", "<=_", "row_", "<=_", "max", "\\u", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "type_", "=_", "element_", "._", "get_", "(_", "'", "t", "'_", ",_", "'", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style", "\\u", "id_", "=_", "element_", "._", "get_", "(_", "'", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "element_", "._", "findtext_", "(_", "'{", "http", "://", "schema", "s", ".", "open", "xml", "formats", ".", "org", "/", "spreadsheet", "ml", "/", "2006", "/", "main", "}", "v", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "Ra", "w", "Cell_", "(_", "row_", ",_", "column", "\\u", "str_", ",_", "coord_", ",_", "value_", ",_", "data\\u", "type_", ",_", "style", "\\u", "id_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "element_", "._", "tag_", "==_", "'{", "http", "://", "schema", "s", ".", "open", "xml", "formats", ".", "org", "/", "spreadsheet", "ml", "/", "2006", "/", "main", "}", "v", "'_", ":_", "\\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_", "element_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "range", "\\u", "boundaries_", "(_", "range", "\\u", "string_", ",_", "row_", "=_", "0_", ",_", "column_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "':'_", "in_", "range", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "range_", ",_", "max", "\\u", "range_", "=_", "range", "\\u", "string_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "col_", ",_", "min", "\\u", "row_", "=_", "coordinate", "\\u", "from", "\\u", "string_", "(_", "min", "\\u", "range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "col_", ",_", "max", "\\u", "row_", "=_", "coordinate", "\\u", "from", "\\u", "string_", "(_", "max", "\\u", "range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "col_", "=_", "column", "\\u", "index", "\\u", "from", "\\u", "string_", "(_", "min", "\\u", "col_", ")_", "+_", "column_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "col_", "=_", "column", "\\u", "index", "\\u", "from", "\\u", "string_", "(_", "max", "\\u", "col_", ")_", "+_", "column_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "row_", "+=_", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "row_", "+=_", "row_", "\\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 ", " _", "min", "\\u", "col_", ",_", "min", "\\u", "row_", "=_", "coordinate", "\\u", "from", "\\u", "string_", "(_", "range", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "col_", "=_", "column", "\\u", "index", "\\u", "from", "\\u", "string_", "(_", "min", "\\u", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "col_", "=_", "min", "\\u", "col_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "row_", "=_", "min", "\\u", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "min", "\\u", "col_", ",_", "min", "\\u", "row_", ",_", "max", "\\u", "col_", ",_", "max", "\\u", "row_", ")_", "\\u\\u\\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", "archive", "\\u", "file_", "(_", "archive", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Zip", "File_", "(_", "archive", "\\u", "name_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "xml", "\\u", "source_", "(_", "archive", "\\u", "file_", ",_", "sheet", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "archive", "\\u", "file_", "._", "read_", "(_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "PACKAG", "E", "\\u", "WORKS", "HE", "ET", "S_", ",_", "sheet", "\\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_", "get", "\\u", "missi", "ng", "\\u", "cells_", "(_", "row_", ",_", "columns_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "dict_", "(_", "[_", "(_", "column_", ",_", "Ra", "w", "Cell_", "(_", "row_", ",_", "column_", ",_", "'%", "s", "%", "s", "'_", "%_", "(_", "column_", ",_", "row_", ")_", ",_", "MISSING", "\\u", "VALUE_", ",_", "TYPE", "\\u", "NULL_", ",_", "None_", ",_", "None_", ")_", ")_", "for_", "column_", "in_", "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_", "get", "\\u", "square", "d\\u", "range_", "(_", "p_", ",_", "min", "\\u", "col_", ",_", "min", "\\u", "row_", ",_", "max", "\\u", "col_", ",_", "max", "\\u", "row_", ",_", "string", "\\u", "table_", ",_", "style", "\\u", "table_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "\\u", "columns_", "=_", "[_", "get", "\\u", "column", "\\u", "letter_", "(_", "ci_", ")_", "for_", "ci_", "in_", "range_", "(_", "min", "\\u", "col_", ",_", "max", "\\u", "col_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "row_", "=_", "min", "\\u", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", ",_", "cells_", "in_", "get", "\\u", "rows_", "(_", "p_", ",_", "min", "\\u", "row_", "=_", "min", "\\u", "row_", ",_", "max", "\\u", "row_", "=_", "max", "\\u", "row_", ",_", "min", "\\u", "column_", "=_", "min", "\\u", "col_", ",_", "max", "\\u", "column_", "=_", "max", "\\u", "col_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "row_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "row_", "<_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "gap", "\\u", "row_", "in_", "range_", "(_", "current", "\\u", "row_", ",_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dummy", "\\u", "cells_", "=_", "get", "\\u", "missi", "ng", "\\u", "cells_", "(_", "gap", "\\u", "row_", ",_", "expected", "\\u", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "tuple_", "(_", "[_", "dummy", "\\u", "cells_", "[_", "column_", "]_", "for_", "column_", "in_", "expected", "\\u", "columns_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "row_", "=_", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "\\u", "cells_", "=_", "list_", "(_", "cells_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "retrieved", "\\u", "columns_", "=_", "dict_", "(_", "[_", "(_", "c_", "._", "column_", ",_", "c_", ")_", "for_", "c_", "in_", "temp", "\\u", "cells_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "missi", "ng", "\\u", "columns_", "=_", "list_", "(_", "set_", "(_", "expected", "\\u", "columns_", ")_", "-_", "set_", "(_", "retrieved", "\\u", "columns_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "replace", "ment", "\\u", "columns_", "=_", "get", "\\u", "missi", "ng", "\\u", "cells_", "(_", "row_", ",_", "missi", "ng", "\\u", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "column_", "in_", "expected", "\\u", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "column_", "in_", "retrieved", "\\u", "columns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cell_", "=_", "retrieved", "\\u", "columns_", "[_", "column_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cell_", "._", "style", "\\u", "id_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "style_", "=_", "style", "\\u", "table_", "[_", "int_", "(_", "cell_", "._", "style", "\\u", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cell_", "=_", "cell_", "._", "\\u", "replace_", "(_", "number", "\\u", "format_", "=_", "style_", "._", "number", "\\u", "format_", "._", "format\\u", "code_", ")_", "#", "pylint", ":", " ", "disable", "-", "msg", "=", "W", "021", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cell_", "._", "internal", "\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "cell_", "._", "data\\u", "type_", "==_", "Cell_", "._", "TYPE", "\\u", "STRING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cell_", "=_", "cell_", "._", "\\u", "replace_", "(_", "internal", "\\u", "value_", "=_", "string", "\\u", "table_", "[_", "int_", "(_", "cell_", "._", "internal", "\\u", "value_", ")_", "]_", ")_", "#", "pylint", ":", " ", "disable", "-", "msg", "=", "W", "021", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cell_", "._", "data\\u", "type_", "==_", "Cell_", "._", "TYPE", "\\u", "BOOL_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cell_", "=_", "cell_", "._", "\\u", "replace_", "(_", "internal", "\\u", "value_", "=_", "cell_", "._", "internal", "\\u", "value_", "==_", "'", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cell_", "._", "is", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cell_", "=_", "cell_", "._", "\\u", "replace_", "(_", "internal", "\\u", "value_", "=_", "SHARED", "\\u", "DATE_", "._", "from", "\\u", "julia", "n_", "(_", "float_", "(_", "cell_", "._", "internal", "\\u", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cell_", "._", "data\\u", "type_", "==_", "Cell_", "._", "TYPE", "\\u", "NUMERIC", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cell_", "=_", "cell_", "._", "\\u", "replace_", "(_", "internal", "\\u", "value_", "=_", "float_", "(_", "cell_", "._", "internal", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full", "\\u", "row_", "._", "append_", "(_", "cell_", ")_", "\\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 ", " _", "full", "\\u", "row_", "._", "append_", "(_", "replace", "ment", "\\u", "columns_", "[_", "column_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "row_", "=_", "row_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "tuple_", "(_", "full", "\\u", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "It", "era", "ble", "Worksh", "eet", "_", "(_", "Worksh", "eet", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "It", "era", "ble", "Worksh", "eet", "_", "(_", "Worksh", "eet", "_", ")_", ":_", "\\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_", ",_", "parent", "\\u", "workbook_", ",_", "title_", ",_", "workbook", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sheet", "\\u", "codename_", ",_", "xml", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Worksh", "eet", "_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent", "\\u", "workbook_", ",_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "workbook", "\\u", "name_", "=_", "workbook", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sheet", "\\u", "codename_", "=_", "sheet", "\\u", "codename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "xml", "\\u", "source_", "=_", "xml", "\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "It", "era", "ble", "Worksh", "eet", "_", "(_", "Worksh", "eet", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "iter", "\\u", "rows_", "(_", "self_", ",_", "range", "\\u", "string_", "=_", "''_", ",_", "row", "\\u", "offset_", "=_", "0_", ",_", "column", "\\u", "offset_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", "s", " ", "a", " ", "square", "d", " ", "range", " ", "based", " ", "on", " ", "the", " ", "`", "range", "\\u", "string", "`", " ", "parameter", ",", " ", "\\", "10", ";", " ", " ", " ", " ", "usi", "ng", " ", "generat", "ors", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "range", "\\u", "string", ":", " ", "range", " ", "of", " ", "cells", " ", "(", "e", ".", "g", ".", " ", "'", "A1", ":", "C4", "')", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "range", "\\u", "string", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "row", ":", " ", "row", " ", "index", " ", "of", " ", "the", " ", "cell", " ", "(", "e", ".", "g", ".", " ", "4", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "row", ":", " ", "int", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "column", ":", " ", "column", " ", "index", " ", "of", " ", "the", " ", "cell", " ", "(", "e", ".", "g", ".", " ", "3", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "column", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "generat", "or", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "iter", "\\u", "rows_", "(_", "workbook", "\\u", "name_", "=_", "self_", "._", "\\u", "workbook", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sheet", "\\u", "name_", "=_", "self_", "._", "\\u", "sheet", "\\u", "codename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "\\u", "source_", "=_", "self_", "._", "\\u", "xml", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "string_", "=_", "range", "\\u", "string_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "row", "\\u", "offset_", "=_", "row", "\\u", "offset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "column", "\\u", "offset_", "=_", "column", "\\u", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "It", "era", "ble", "Worksh", "eet", "_", "(_", "Worksh", "eet", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cell_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "use", " ", "'", "iter", "\\u", "rows", "()'", " ", "inst", "ead", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "It", "era", "ble", "Worksh", "eet", "_", "(_", "Worksh", "eet", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "range_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "use", " ", "'", "iter", "\\u", "rows", "()'", " ", "inst", "ead", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unpack", "\\u", "worksheet_", "(_", "archive_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "file_", "=_", "tempfile_", "._", "Tempora", "ry", "File_", "(_", "mode_", "=_", "'", "r", "+'_", ",_", "prefix_", "=_", "'", "openp", "yx", "l", ".'_", ",_", "suffix_", "=_", "'.", "unpack", ".", "temp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "zin", "fo_", "=_", "archive_", "._", "getin", "fo_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "zin", "fo_", "._", "compress", "\\u", "type_", "==_", "zipfile_", "._", "ZI", "P", "\\u", "STORE", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "decoder_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "zin", "fo_", "._", "compress", "\\u", "type_", "==_", "zipfile_", "._", "ZI", "P", "\\u", "DEF", "LATE", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "decoder_", "=_", "zlib_", "._", "decompress", "obj_", "(_", "-_", "zlib_", "._", "MAX", "\\u", "WB", "IT", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "zipfile_", "._", "Ba", "d", "Zip", "File_", "(_", "\"", "Unre", "cogni", "zed", " ", "compress", "ion", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "archive_", "._", "fp_", "._", "seek_", "(_", "\\u", "get", "\\u", "file", "\\u", "offset_", "(_", "archive_", ",_", "zin", "fo_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bytes", "\\u", "to", "\\u", "read_", "=_", "zin", "fo_", "._", "compress", "\\u", "size_", "\\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 ", " _", "buff_", "=_", "archive_", "._", "fp_", "._", "read_", "(_", "min_", "(_", "bytes", "\\u", "to", "\\u", "read_", ",_", "1024", "00_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "buff_", ":_", "\\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_", "bytes", "\\u", "to", "\\u", "read_", "-=_", "len_", "(_", "buff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "decoder_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buff_", "=_", "decoder_", "._", "decompress_", "(_", "buff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "temp", "\\u", "file_", "._", "write_", "(_", "buff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "decoder_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp", "\\u", "file_", "._", "write_", "(_", "decoder_", "._", "decompress_", "(_", "'", "Z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "temp", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "file", "\\u", "offset_", "(_", "archive_", ",_", "zin", "fo_", ")_", ":_", "\\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 ", " _", "return_", "zin", "fo_", "._", "file", "\\u", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fro", "m", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "378", "126", "1", "/", "how", "-", "to", "-", "simulat", "e-", "zipfi", "le", "-", "open", "-", "in", "-", "python", "-", "2", "-", "5_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Seek", " ", "over", " ", "the", " ", "fixed", " ", "size", " ", "fields", " ", "to", " ", "the", " ", "\"", "file", " ", "name", " ", "length", "\"", " ", "field", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "file", " ", "header", " ", "(", "2", "6", " ", "bytes", ").", " ", "Unpack", " ", "this", " ", "and", " ", "the", " ", "\"", "extra", " ", "field", " ", "length", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "field", " ", "ours", "elv", "es", " ", "as", " ", "info", ".", "extra", " ", "doe", "sn", "'", "t", " ", "see", "m", " ", "to", " ", "be", " ", "the", " ", "correct", " ", "length", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "archive_", "._", "fp_", "._", "seek_", "(_", "zin", "fo_", "._", "header", "\\u", "offset_", "+_", "26_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "name", "\\u", "len_", ",_", "extra", "\\u", "len_", "=_", "struct_", "._", "unpack_", "(_", "\"<", "HH", "\"_", ",_", "archive_", "._", "fp_", "._", "read_", "(_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "zin", "fo_", "._", "header", "\\u", "offset_", "+_", "30_", "+_", "file", "\\u", "name", "\\u", "len_", "+_", "extra", "\\u", "len_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Module is imported more than once
genome/bam-readcount/integration-test/bam-readcount_test.py
[ { "content": "#!/usr/bin/env python\n\"\"\"This is a simple python script to perform an integration\ntest on bam-readcount. It uses a small BAM generated by merging\ntwo 1000 Genomes sequencing for NA12878 and NA12892.\nSee https://github.com/genome/somatic-snv-test-data for info\non the BAMs and reference. These are subsets of the ones from that repo.\"\"\"\n\nimport os\nprint \"I AM IN\", os.getcwd()\nfrom integrationtest import IntegrationTest, main\nfrom testdata import TEST_DATA_DIRECTORY\nimport unittest\nimport subprocess\nimport os\n\n\nif __name__ == \"__main__\":\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 9 } ]
[ { "span": "import os", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 9 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "is", " ", "a", " ", "simple", " ", "python", " ", "script", " ", "to", " ", "perform", " ", "an", " ", "integrati", "on", "\\", "10", ";", "test", " ", "on", " ", "bam", "-", "read", "count", ".", " ", "It", " ", "use", "s", " ", "a", " ", "small", " ", "BAM", " ", "generat", "ed", " ", "by", " ", "mer", "ging", "\\", "10", ";", "two", " ", "1000", " ", "Genome", "s", " ", "seque", "ncing", " ", "for", " ", "NA", "128", "7", "8", " ", "and", " ", "NA", "128", "92.", "\\", "10", ";", "See", " ", "https", "://", "git", "hub", ".", "com", "/", "geno", "me", "/", "soma", "tic", "-", "sn", "v", "-", "test", "-", "data", " ", "for", " ", "info", "\\", "10", ";", "on", " ", "the", " ", "BAM", "s", " ", "and", " ", "reference", ".", " ", "The", "se", " ", "are", " ", "subsets", " ", "of", " ", "the", " ", "ones", " ", "from", " ", "tha", "t", " ", "repo", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "I", " ", "AM", " ", "IN", "\"_", ",_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "integrati", "onte", "st_", "import_", "Integrati", "on", "Test_", ",_", "main_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "testdata_", "import_", "TEST", "\\u", "DATA", "\\u", "DIRECTORY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
columbia/libtrack/libtrack/elfmod/elfmod.py
[ { "content": "#!/usr/bin/python\n#\n\n\"\"\"\nElf modification tool\nCopyright (C) 2013 Jeremy C. Andrus\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see <http://www.gnu.org/licenses/>.\n\nBased on Kenshoto's Elf parser\n\n\"\"\"\n\nimport os\nimport sys\nimport argparse\nfrom Elf import Elf\nfrom Elf.elf_lookup import *\n\nPROGRAM=\"elfmod\"\nVERSION=\"0.1a\"\n\n\n\nparser = argparse.ArgumentParser(prog=PROGRAM, description=\"Modify an ELF library in-place\")\nsubparsers = parser.add_subparsers(title='Mode', help='ELF modification mode')\n\n# The \"hidesyms\" command\nparser_hs = subparsers.add_parser('hidesyms', help=\"Hide ELF symbols by re-writing the .dynsym table in-place\")\nparser_hs.add_argument('elf', help=\"Path to ELF shared-object file\")\nparser_hs.add_argument('syms', help=\"File containing symbols to hide (one per line)\")\nparser_hs.set_defaults(func=hidesyms)\n\n# The \"soname\" command\nparser_sonm = subparsers.add_parser('soname', help=\"Modify the ELF soname\")\nparser_sonm.add_argument('elf', help=\"Path to ELF shared-object file\")\nparser_sonm.add_argument('name', help=\"New SONAME (length must be less than or equal to original length)\")\nparser_sonm.set_defaults(func=soname)\n\nargs = parser.parse_args()\nargs.func(args)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def hidesyms(args):\n #print \"Loading\", args.elf\n elf = Elf(file(args.elf, \"r+b\"))\n #print \"Loading symbols from\", args.syms\n with open(args.syms) as sf:\n hidden_syms = sf.read().splitlines()\n #print elf\n for dsym in elf.getDynSyms():\n if dsym.name in hidden_syms:\n print 'SYM(0x%x,%s)' % (dsym.st_value, dsym.name)\n dsym.setStInfo(STB_LOCAL, dsym.getInfoType())\n dsym.setStOther(STV_HIDDEN)\n elf.writeDynamic()", "metadata": "root.hidesyms", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def soname(args):\n print \"\\tSetting soname to '%s' in %s\" % (args.name, args.elf)\n elf = Elf(file(args.elf, \"r+b\"))\n elf.setSoname(args.name)", "metadata": "root.soname", "header": "['module', '___EOS___']", "index": 47 } ]
[ { "span": "import os", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 9 }, { "span": "import sys", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "El", "f", " ", "modification", " ", "tool", "\\", "10", ";", "Copy", "right", " ", "(", "C", ")", " ", "2013", " ", "Jer", "em", "y", " ", "C", ".", " ", "And", "rus", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "program", " ", "is", " ", "free", " ", "software", ":", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modif", "y", "\\", "10", ";", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "as", " ", "publi", "shed", " ", "by", "\\", "10", ";", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ",", " ", "eit", "her", " ", "version", " ", "2", " ", "of", " ", "the", " ", "License", ",", " ", "or", "\\", "10", ";", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "program", " ", "is", " ", "distributed", " ", "in", " ", "the", " ", "hop", "e", " ", "tha", "t", " ", "it", " ", "will", " ", "be", " ", "usef", "ul", ",", "\\", "10", ";", "but", " ", "WITH", "OUT", " ", "ANY", " ", "WAR", "RAN", "TY", ";", " ", "with", "out", " ", "even", " ", "the", " ", "impli", "ed", " ", "warr", "ant", "y", " ", "of", "\\", "10", ";", "MER", "CHAN", "TAB", "ILI", "TY", " ", "or", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", " ", "See", " ", "the", "\\", "10", ";", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";", "\\", "10", ";", "You", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", "\\", "10", ";", "along", " ", "with", " ", "this", " ", "program", ".", " ", " ", "If", " ", "not", ",", " ", "see", " ", "<", "http", "://", "www", ".", "gnu", ".", "org", "/", "license", "s", "/>", ".", "\\", "10", ";", "\\", "10", ";", "Base", "d", " ", "on", " ", "Ken", "sho", "to", "'", "s", " ", "El", "f", " ", "parser", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "El", "f_", "import_", "El", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "El", "f_", "._", "elf", "\\u", "lookup_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PROGRAM", "_", "=_", "\"", "elf", "mod", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VERSION_", "=_", "\"", "0.", "1a", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "prog_", "=_", "PROGRAM", "_", ",_", "description_", "=_", "\"", "Modif", "y", " ", "an", " ", "ELF", " ", "librar", "y", " ", "in", "-", "place", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subparsers_", "=_", "parser_", "._", "add", "\\u", "subparsers_", "(_", "title_", "=_", "'", "Mode", "'_", ",_", "help_", "=_", "'", "ELF", " ", "modification", " ", "mode", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "\"", "hide", "sym", "s", "\"", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "hs_", "=_", "subparsers_", "._", "add", "\\u", "parser_", "(_", "'", "hide", "sym", "s", "'_", ",_", "help_", "=_", "\"", "Hi", "de", " ", "ELF", " ", "symbols", " ", "by", " ", "re", "-", "writ", "ing", " ", "the", " ", ".", "dyn", "sym", " ", "table", " ", "in", "-", "place", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "hs_", "._", "add", "\\u", "argument_", "(_", "'", "elf", "'_", ",_", "help_", "=_", "\"", "Path", " ", "to", " ", "ELF", " ", "shared", "-", "object", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "hs_", "._", "add", "\\u", "argument_", "(_", "'", "sym", "s", "'_", ",_", "help_", "=_", "\"", "File", " ", "contain", "ing", " ", "symbols", " ", "to", " ", "hide", " ", "(", "one", " ", "per", " ", "line", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "hs_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "hide", "syms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "\"", "sona", "me", "\"", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "parser", "\\u", "son", "m_", "=_", "subparsers_", "._", "add", "\\u", "parser_", "(_", "'", "sona", "me", "'_", ",_", "help_", "=_", "\"", "Modif", "y", " ", "the", " ", "ELF", " ", "sona", "me", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "son", "m_", "._", "add", "\\u", "argument_", "(_", "'", "elf", "'_", ",_", "help_", "=_", "\"", "Path", " ", "to", " ", "ELF", " ", "shared", "-", "object", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "son", "m_", "._", "add", "\\u", "argument_", "(_", "'", "name", "'_", ",_", "help_", "=_", "\"", "New", " ", "SON", "AME", " ", "(", "length", " ", "must", " ", "be", " ", "less", " ", "than", " ", "or", " ", "equal", " ", "to", " ", "original", " ", "length", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser", "\\u", "son", "m_", "._", "set\\u", "defaults_", "(_", "func_", "=_", "sona", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "func_", "(_", "args_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "hide", "syms_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "Load", "ing", "\",", " ", "args", ".", "elf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "elf_", "=_", "El", "f_", "(_", "file_", "(_", "args_", "._", "elf_", ",_", "\"", "r", "+", "b", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "Load", "ing", " ", "symbols", " ", "from", "\",", " ", "args", ".", "syms_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "args_", "._", "syms_", ")_", "as_", "sf_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hidden", "\\u", "syms_", "=_", "sf_", "._", "read_", "(_", ")_", "._", "splitlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "elf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ds", "ym_", "in_", "elf_", "._", "get", "Dyn", "Sym", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ds", "ym_", "._", "name_", "in_", "hidden", "\\u", "syms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "SYM", "(", "0", "x", "%", "x", ",%", "s", ")'_", "%_", "(_", "ds", "ym_", "._", "st", "\\u", "value_", ",_", "ds", "ym_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds", "ym_", "._", "set", "St", "Info_", "(_", "ST", "B", "\\u", "LOCAL_", ",_", "ds", "ym_", "._", "get", "Info", "Type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ds", "ym_", "._", "set", "St", "Other_", "(_", "ST", "V", "\\u", "HIDDEN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elf_", "._", "write", "Dynamic", "_", "(_", ")_", "\\u\\u\\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_", "sona", "me_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", "Sett", "ing", " ", "sona", "me", " ", "to", " ", "'%", "s", "'", " ", "in", " ", "%", "s", "\"_", "%_", "(_", "args_", "._", "name_", ",_", "args_", "._", "elf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elf_", "=_", "El", "f_", "(_", "file_", "(_", "args_", "._", "elf_", ",_", "\"", "r", "+", "b", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elf_", "._", "set", "Son", "ame_", "(_", "args_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
gferreira/hTools2/Lib/hTools2/modules/webfonts.py
[ { "content": "# [h] hTools2.modules.webfonts\n\n\"\"\"A collection of tools for working with webfonts.\n\nSome functions in this module require the following C libraries:\n\n- [ttfautohint](http://freetype.org/ttfautohint/)\n- [sfnt2woff](http://people.mozilla.org/~jkew/woff/)\n- [ttf2eot](http://code.google.com/p/ttf2eot/)\n- [woff2_compress](http://github.com/google/woff2)\n\n\"\"\"\n\nimport os\nimport shutil\n\nfrom base64 import b64encode\n\nfrom ufo2svg import convertUFOToSVGFont\n\nfrom hTools2.modules.ttx import otf2ttx, ttx2otf\nfrom hTools2.modules.ttx import strip_names as ttx_strip_names\n\ntry:\n from mojo.roboFont import OpenFont\n from mojo.compile import executeCommand, hasTTFAutoHint\n from lib.tools.bezierTools import curveConverter\nexcept:\n from robofab.world import OpenFont\n\n#--------------------\n# higher-level tools\n#--------------------\n\n\n#------------\n# WOFF tools\n#------------\n\n\n#-------------\n# WOFF2 tools\n#-------------\n\n\n#-----------\n# TTF tools\n#-----------\n\n\n\n\n#-----------\n# EOT tools\n#-----------\n\n\n\n#-----------\n# SVG tools\n#-----------\n\nfrom ufo2svg import convertUFOToSVGFont\nfrom defcon import Font\nfrom extractor import extractUFO\n\n\n#--------------\n# base64 tools\n#--------------\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def generate_svg(src_path, svg_path):\n font = Font()\n try:\n extractUFO(src_path, font)\n convertUFOToSVGFont(font, svg_path)\n except:\n print \"Failed to generate SVG.\"", "metadata": "root.generate_svg", "header": "['module', '___EOS___']", "index": 186 } ]
[ { "span": "except:", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 7 }, { "span": "except:", "start_line": 191, "start_column": 4, "end_line": 191, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "[", "h", "]", " ", "h", "Tool", "s2", ".", "module", "s", ".", "web", "fonts_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "A", " ", "collection", " ", "of", " ", "tool", "s", " ", "for", " ", "working", " ", "with", " ", "web", "font", "s", ".", "\\", "10", ";", "\\", "10", ";", "Some", " ", "function", "s", " ", "in", " ", "this", " ", "module", " ", "require", " ", "the", " ", "follow", "ing", " ", "C", " ", "librar", "ies", ":", "\\", "10", ";", "\\", "10", ";", "-", " ", "[", "tt", "fau", "to", "hin", "t", "](", "http", "://", "free", "type", ".", "org", "/", "tt", "fau", "to", "hin", "t", "/)", "\\", "10", ";", "-", " ", "[", "sf", "nt", "2w", "off", "](", "http", "://", "people", ".", "moz", "illa", ".", "org", "/", "~", "jk", "ew", "/", "wo", "ff", "/)", "\\", "10", ";", "-", " ", "[", "tt", "f2", "eo", "t", "](", "http", "://", "code", ".", "google", ".", "com", "/", "p", "/", "tt", "f2", "eo", "t", "/)", "\\", "10", ";", "-", " ", "[", "wo", "ff", "2", "\\u", "compress", "](", "http", "://", "git", "hub", ".", "com", "/", "google", "/", "wo", "ff", "2", ")", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "base64_", "import_", "b64encode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ufo", "2s", "vg_", "import_", "convert", "UF", "OT", "o", "SV", "GF", "ont", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "h", "Tool", "s2_", "._", "modules_", "._", "tt", "x_", "import_", "ot", "f2", "tt", "x_", ",_", "tt", "x2", "ot", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "h", "Tool", "s2_", "._", "modules_", "._", "tt", "x_", "import_", "strip", "\\u", "names_", "as_", "tt", "x", "\\u", "strip", "\\u", "names_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "mo", "jo", "_", "._", "robo", "Font_", "import_", "Open", "Font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mo", "jo", "_", "._", "compile_", "import_", "execute", "Command_", ",_", "has", "TT", "FA", "uto", "Hint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lib_", "._", "tools_", "._", "bezier", "Tools_", "import_", "curve", "Converter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "robo", "fab", "_", "._", "world_", "import_", "Open", "Font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "higher", "-", "level", " ", "tools_", "\\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_", "#", " ", "WO", "FF", " ", "tools_", "\\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_", "#", " ", "WO", "FF", "2", " ", "tools_", "\\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_", "#", " ", "TT", "F", " ", "tools_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EO", "T", " ", "tools_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SV", "G", " ", "tools_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "ufo", "2s", "vg_", "import_", "convert", "UF", "OT", "o", "SV", "GF", "ont", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "def", "con_", "import_", "Font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "extractor_", "import_", "extract", "UF", "O_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base64", " ", "tools_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "generat", "e\\u", "svg_", "(_", "src", "\\u", "path_", ",_", "svg", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "font_", "=_", "Font_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extract", "UF", "O_", "(_", "src", "\\u", "path_", ",_", "font_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "convert", "UF", "OT", "o", "SV", "GF", "ont", "_", "(_", "font_", ",_", "svg", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Fail", "ed", " ", "to", " ", "generat", "e", " ", "SV", "G", ".\"_", "\\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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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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
chb/py-umls/umls.py
[ { "content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n#\tUtilities to handle UMLS\n#\n#\t2013-01-01\tCreated by Pascal Pfiffner\n#\t2014-01-20\tExtracted and converted to Python 3\n#\n\n\nimport sys\nimport os.path\nimport logging\n\nfrom sqlite import SQLite\t\t\t# for py-umls standalone\n\n\n\n\n\n\n\n\n# running this as a script does the database setup/check\nif '__main__' == __name__:\n\tUMLS.check_database()\n\t\n\t# examples\n\tlook = UMLSLookup()\n\tcode = 'C0002962'\n\tmeaning = look.lookup_code_meaning(code)\n\tprint('UMLS code \"{0}\": {1}'.format(code, meaning))\n\t\n\tname = 'Pulmonary Arterial Hypertension'\n\tprint('Search for \"{}\" returns:'.format(name))\n\tcodes = look.lookup_code_for_name(name)\n\tfor cd in codes:\n\t\tprint('{}: {}'.format(cd, look.lookup_code_meaning(cd[0])))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class UMLS (object):\n\t\"\"\" A class for importing UMLS terminologies into an SQLite database.\n\t\"\"\"\n\t", "metadata": "root.UMLS", "header": "['module', '___EOS___']", "index": 17 }, { "content": "\t@classmethod\n\tdef check_database(cls):\n\t\t\"\"\" Check if our database is in place and if not, prompts to import it.\n\t\tWill raise on errors!\n\t\t\n\t\tUMLS: (umls.db)\n\t\tIf missing prompt to use the `umls.sh` script\n\t\t\"\"\"\n\t\t\n\t\tumls_db = os.path.join('databases', 'umls.db')\n\t\tif not os.path.exists(umls_db):\n\t\t\traise Exception(\"The UMLS database at {} does not exist. Run the import script `databases/umls.sh`.\"\n\t\t\t\t.format(os.path.abspath(umls_db)))", "metadata": "root.UMLS.check_database", "header": "['class', 'UMLS', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": "class UMLSLookup (object):\n\t\"\"\" UMLS lookup \"\"\"\n\t\n\tsqlite = None\n\tdid_check_dbs = False\n\tpreferred_sources = ['\"SNOMEDCT\"', '\"MTH\"']\t\n\t\n\t\n\t\n\t\n\t\n\t", "metadata": "root.UMLSLookup", "header": "['module', '___EOS___']", "index": 37 }, { "content": "\tdef __init__(self):\n\t\tabsolute = os.path.dirname(os.path.realpath(__file__))\n\t\tself.sqlite = SQLite.get(os.path.join(absolute, 'databases/umls.db'))", "metadata": "root.UMLSLookup.__init__", "header": "['class', 'UMLSLookup', '(', 'object', ')', ':', '___EOS___']", "index": 44 }, { "content": "\tdef lookup_code(self, cui, preferred=True):\n\t\t\"\"\" Return a list with triples that contain:\n\t\t- name\n\t\t- source\n\t\t- semantic type\n\t\tby looking it up in our \"descriptions\" database.\n\t\tThe \"preferred\" settings has the effect that only names from SNOMED\n\t\t(SNOMEDCD) and the Metathesaurus (MTH) will be reported. A lookup in\n\t\tour \"descriptions\" table is much faster than combing through the full\n\t\tMRCONSO table.\n\t\t\n\t\t:returns: A list of triples with (name, sab, sty)\n\t\t\"\"\"\n\t\tif cui is None or len(cui) < 1:\n\t\t\treturn []\n\t\t\n\t\t# lazy UMLS db checking\n\t\tif not UMLSLookup.did_check_dbs:\n\t\t\tUMLS.check_database()\n\t\t\tUMLSLookup.did_check_dbs = True\n\t\t\n\t\t# take care of negations\n\t\tnegated = '-' == cui[0]\n\t\tif negated:\n\t\t\tcui = cui[1:]\n\t\t\n\t\tparts = cui.split('@', 1)\n\t\tlookup_cui = parts[0]\n\t\t\n\t\t# STR: Name\n\t\t# SAB: Abbreviated Source Name\n\t\t# STY: Semantic Type\n\t\tif preferred:\n\t\t\tsql = 'SELECT STR, SAB, STY FROM descriptions WHERE CUI = ? AND SAB IN ({})'.format(\", \".join(UMLSLookup.preferred_sources))\n\t\telse:\n\t\t\tsql = 'SELECT STR, SAB, STY FROM descriptions WHERE CUI = ?'\n\t\t\n\t\t# return as list\n\t\tarr = []\n\t\tfor res in self.sqlite.execute(sql, (lookup_cui,)):\n\t\t\tif negated:\n\t\t\t\tarr.append((\"[NEGATED] {}\".format(res[0], res[1], res[2])))\n\t\t\telse:\n\t\t\t\tarr.append(res)\n\t\t\n\t\treturn arr", "metadata": "root.UMLSLookup.lookup_code", "header": "['class', 'UMLSLookup', '(', 'object', ')', ':', '___EOS___']", "index": 48 }, { "content": "\tdef lookup_code_meaning(self, cui, preferred=True, no_html=True):\n\t\t\"\"\" Return a string (an empty string if the cui is null or not found)\n\t\tby looking it up in our \"descriptions\" database.\n\t\tThe \"preferred\" settings has the effect that only names from SNOMED\n\t\t(SNOMEDCD) and the Metathesaurus (MTH) will be reported. A lookup in\n\t\tour \"descriptions\" table is much faster than combing through the full\n\t\tMRCONSO table.\n\t\t\"\"\"\n\t\tnames = []\n\t\tfor res in self.lookup_code(cui, preferred):\n\t\t\tif no_html:\n\t\t\t\tnames.append(\"{} ({}) [{}]\".format(res[0], res[1], res[2]))\n\t\t\telse:\n\t\t\t\tnames.append(\"{} (<span style=\\\"color:#090;\\\">{}</span>: {})\".format(res[0], res[1], res[2]))\n\t\t\n\t\tcomp = \", \" if no_html else \"<br/>\\n\"\n\t\treturn comp.join(names) if len(names) > 0 else ''", "metadata": "root.UMLSLookup.lookup_code_meaning", "header": "['class', 'UMLSLookup', '(', 'object', ')', ':', '___EOS___']", "index": 96 }, { "content": "\tdef lookup_code_for_name(self, name, preferred=True):\n\t\t\"\"\" Tries to find a good concept code for the given concept name.\n\t\t\n\t\tUses our indexed `descriptions` table.\n\t\t\n\t\t:returns: A list of triples with (cui, sab, sty)\n\t\t\"\"\"\n\t\tif name is None or len(name) < 1:\n\t\t\treturn None\n\t\t\n\t\t# lazy UMLS db checking\n\t\tif not UMLSLookup.did_check_dbs:\n\t\t\tUMLS.check_database()\n\t\t\tUMLSLookup.did_check_dbs = True\n\t\t\n\t\t# CUI: Concept-ID\n\t\t# STR: Name\n\t\t# SAB: Abbreviated Source Name\n\t\t# STY: Semantic Type\n\t\tif preferred:\n\t\t\tsql = 'SELECT CUI, SAB, STY FROM descriptions WHERE STR LIKE ? AND SAB IN ({})'.format(\", \".join(UMLSLookup.preferred_sources))\n\t\telse:\n\t\t\tsql = 'SELECT CUI, SAB, STY FROM descriptions WHERE STR LIKE ?'\n\t\t\n\t\t# return as list\n\t\tarr = []\n\t\tfor res in self.sqlite.execute(sql, ('%' + name + '%',)):\n\t\t\tarr.append(res)\n\t\t\n\t\treturn arr", "metadata": "root.UMLSLookup.lookup_code_for_name", "header": "['class', 'UMLSLookup', '(', 'object', ')', ':', '___EOS___']", "index": 115 } ]
[ { "span": "import sys", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 10 }, { "span": "import logging", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "Utili", "ties", " ", "to", " ", "handle", " ", "UM", "LS_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "2013", "-0", "1", "-0", "1", "\t", "Creat", "ed", " ", "by", " ", "Pas", "cal", " ", "Pf", "iff", "ner_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "2014", "-0", "1", "-", "20", "\t", "Extract", "ed", " ", "and", " ", "convert", "ed", " ", "to", " ", "Pyth", "on", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sqlite_", "import_", "SQL", "ite_", "#", " ", "for", " ", "py", "-", "uml", "s", " ", "standalone", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "runn", "ing", " ", "this", " ", "as", " ", "a", " ", "script", " ", "doe", "s", " ", "the", " ", "databa", "se", " ", "setup", "/", "check_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "\\u", "main", "\\u\\u'_", "==_", "\\u\\u", "name\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "UM", "LS_", "._", "check", "\\u", "database_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "examples_", "\\u\\u\\uNL\\u\\u\\u_", "look", "_", "=_", "UM", "LS", "Lookup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "'", "C0", "002", "962", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meaning", "_", "=_", "look", "_", "._", "look", "up", "\\u", "code", "\\u", "meaning", "_", "(_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "UM", "LS", " ", "code", " ", "\"{", "0", "}\"", ":", " ", " ", "{", "1", "}'_", "._", "format_", "(_", "code_", ",_", "meaning", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "Pul", "mona", "ry", " ", "Art", "eria", "l", " ", "Hyper", "tens", "ion", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Sear", "ch", " ", "for", " ", "\"{}\"", " ", "return", "s", ":'_", "._", "format_", "(_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "codes_", "=_", "look", "_", "._", "look", "up", "\\u", "code", "\\u", "for", "\\u", "name_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cd_", "in_", "codes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "(_", "'{}", ":", " ", " ", "{}'_", "._", "format_", "(_", "cd_", ",_", "look", "_", "._", "look", "up", "\\u", "code", "\\u", "meaning", "_", "(_", "cd_", "[_", "0_", "]_", ")_", ")_", ")_", "\\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_", "UM", "LS_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", " ", "A", " ", "class", " ", "for", " ", "import", "ing", " ", "UM", "LS", " ", "termin", "ologi", "es", " ", "int", "o", " ", "an", " ", "SQL", "ite", " ", "databa", "se", ".", "\\", "10", ";", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "UM", "LS_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "database_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", " ", "Check", " ", "if", " ", "our", " ", "databa", "se", " ", "is", " ", "in", " ", "place", " ", "and", " ", "if", " ", "not", ",", " ", "prompt", "s", " ", "to", " ", "import", " ", "it", ".", "\\", "10", ";", "\t", "\t", "Wil", "l", " ", "raise", " ", "on", " ", "error", "s", "!", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", "UM", "LS", ":", " ", "(", "uml", "s", ".", "db", ")", "\\", "10", ";", "\t", "\t", "If", " ", "missi", "ng", " ", "prompt", " ", "to", " ", "use", " ", "the", " ", "`", "uml", "s", ".", "sh", "`", " ", "script", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uml", "s", "\\u", "db_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'", "databa", "ses", "'_", ",_", "'", "uml", "s", ".", "db", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "uml", "s", "\\u", "db_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "raise_", "Exception_", "(_", "\"", "The", " ", "UM", "LS", " ", "databa", "se", " ", "at", " ", "{}", " ", "doe", "s", " ", "not", " ", "exist", ".", " ", "Run", " ", "the", " ", "import", " ", "script", " ", "`", "databa", "ses", "/", "uml", "s", ".", "sh", "`.", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "._", "format_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "uml", "s", "\\u", "db_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "UM", "LS", "Lookup_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", " ", "UM", "LS", " ", "look", "up", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sqlite_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "\\u", "check", "\\u", "dbs_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefer", "red", "\\u", "sources_", "=_", "[_", "'\"", "SN", "OME", "DC", "T", "\"'_", ",_", "'\"", "MT", "H", "\"'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "UM", "LS", "Lookup_", "(_", "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\t", "\t_", "absolute_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sqlite_", "=_", "SQL", "ite_", "._", "get_", "(_", "os_", "._", "path_", "._", "join_", "(_", "absolute_", ",_", "'", "databa", "ses", "/", "uml", "s", ".", "db", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UM", "LS", "Lookup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "look", "up", "\\u", "code_", "(_", "self_", ",_", "cui", "_", ",_", "prefer", "red_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", " ", "Return", " ", "a", " ", "list", " ", "with", " ", "triple", "s", " ", "tha", "t", " ", "contain", ":", "\\", "10", ";", "\t", "\t", "-", " ", "name", "\\", "10", ";", "\t", "\t", "-", " ", "source", "\\", "10", ";", "\t", "\t", "-", " ", "sema", "ntic", " ", "type", "\\", "10", ";", "\t", "\t", "by", " ", "look", "ing", " ", "it", " ", "up", " ", "in", " ", "our", " ", "\"", "description", "s", "\"", " ", "databa", "se", ".", "\\", "10", ";", "\t", "\t", "The", " ", "\"", "prefer", "red", "\"", " ", "settings", " ", "has", " ", "the", " ", "effect", " ", "tha", "t", " ", "only", " ", "names", " ", "from", " ", "SN", "OME", "D", "\\", "10", ";", "\t", "\t", "(", "SN", "OME", "DC", "D", ")", " ", "and", " ", "the", " ", "Meta", "thes", "aur", "us", " ", "(", "MT", "H", ")", " ", "will", " ", "be", " ", "reporte", "d", ".", " ", "A", " ", "look", "up", " ", "in", "\\", "10", ";", "\t", "\t", "our", " ", "\"", "description", "s", "\"", " ", "table", " ", "is", " ", "muc", "h", " ", "faste", "r", " ", "than", " ", "combin", "g", " ", "through", " ", "the", " ", "full", "\\", "10", ";", "\t", "\t", "MR", "CONS", "O", " ", "table", ".", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", ":", "return", "s", ":", " ", "A", " ", "list", " ", "of", " ", "triple", "s", " ", "with", " ", "(", "name", ",", " ", "sab", ",", " ", "sty", ")", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cui", "_", "is_", "None_", "or_", "len_", "(_", "cui", "_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "lazy", " ", "UM", "LS", " ", "db", " ", "checking", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "UM", "LS", "Lookup_", "._", "did", "\\u", "check", "\\u", "dbs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "UM", "LS_", "._", "check", "\\u", "database_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UM", "LS", "Lookup_", "._", "did", "\\u", "check", "\\u", "dbs_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "take", " ", "care", " ", "of", " ", "negati", "ons_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "negate", "d_", "=_", "'-'_", "==_", "cui", "_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "negate", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cui", "_", "=_", "cui", "_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parts_", "=_", "cui", "_", "._", "split_", "(_", "'@'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "look", "up", "\\u", "cui", "_", "=_", "parts_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "STR", ":", " ", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SA", "B", ":", " ", "Abbr", "evi", "ated", " ", "Sou", "rce", " ", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ST", "Y", ":", " ", "Semantic", " ", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "prefer", "red_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "sql_", "=_", "'", "SELECT", " ", "STR", ",", " ", "SA", "B", ",", " ", "ST", "Y", " ", "FROM", " ", "description", "s", " ", "WHE", "RE", " ", "CU", "I", " ", "=", " ", "?", " ", "AND", " ", "SA", "B", " ", "IN", " ", "({})'_", "._", "format_", "(_", "\",", " ", "\"_", "._", "join_", "(_", "UM", "LS", "Lookup_", "._", "prefer", "red", "\\u", "sources_", ")_", ")_", "\\u\\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_", "sql_", "=_", "'", "SELECT", " ", "STR", ",", " ", "SA", "B", ",", " ", "ST", "Y", " ", "FROM", " ", "description", "s", " ", "WHE", "RE", " ", "CU", "I", " ", "=", " ", "?'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "as", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arr_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "res_", "in_", "self_", "._", "sqlite_", "._", "execute_", "(_", "sql_", ",_", "(_", "look", "up", "\\u", "cui", "_", ",_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "negate", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "arr_", "._", "append_", "(_", "(_", "\"[", "NEGAT", "ED", "]", " ", "{}\"_", "._", "format_", "(_", "res_", "[_", "0_", "]_", ",_", "res_", "[_", "1_", "]_", ",_", "res_", "[_", "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\t", "\t\t\t_", "arr_", "._", "append_", "(_", "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_", "return_", "arr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UM", "LS", "Lookup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "look", "up", "\\u", "code", "\\u", "meaning", "_", "(_", "self_", ",_", "cui", "_", ",_", "prefer", "red_", "=_", "True_", ",_", "no", "\\u", "html_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", " ", "Return", " ", "a", " ", "string", " ", "(", "an", " ", "empty", " ", "string", " ", "if", " ", "the", " ", "cui", " ", "is", " ", "null", " ", "or", " ", "not", " ", "found", ")", "\\", "10", ";", "\t", "\t", "by", " ", "look", "ing", " ", "it", " ", "up", " ", "in", " ", "our", " ", "\"", "description", "s", "\"", " ", "databa", "se", ".", "\\", "10", ";", "\t", "\t", "The", " ", "\"", "prefer", "red", "\"", " ", "settings", " ", "has", " ", "the", " ", "effect", " ", "tha", "t", " ", "only", " ", "names", " ", "from", " ", "SN", "OME", "D", "\\", "10", ";", "\t", "\t", "(", "SN", "OME", "DC", "D", ")", " ", "and", " ", "the", " ", "Meta", "thes", "aur", "us", " ", "(", "MT", "H", ")", " ", "will", " ", "be", " ", "reporte", "d", ".", " ", "A", " ", "look", "up", " ", "in", "\\", "10", ";", "\t", "\t", "our", " ", "\"", "description", "s", "\"", " ", "table", " ", "is", " ", "muc", "h", " ", "faste", "r", " ", "than", " ", "combin", "g", " ", "through", " ", "the", " ", "full", "\\", "10", ";", "\t", "\t", "MR", "CONS", "O", " ", "table", ".", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "res_", "in_", "self_", "._", "look", "up", "\\u", "code_", "(_", "cui", "_", ",_", "prefer", "red_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "no", "\\u", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "names_", "._", "append_", "(_", "\"{}", " ", "({})", " ", " ", "[{}]", "\"_", "._", "format_", "(_", "res_", "[_", "0_", "]_", ",_", "res_", "[_", "1_", "]_", ",_", "res_", "[_", "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\t", "\t\t\t_", "names_", "._", "append_", "(_", "\"{}", " ", "(", "<", "span", " ", "style", "=\\\\\"", "color", ":", "#", "090", ";\\\\", "\">", "{}", "</", "span", ">:", " ", "{})\"_", "._", "format_", "(_", "res_", "[_", "0_", "]_", ",_", "res_", "[_", "1_", "]_", ",_", "res_", "[_", "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_", "comp_", "=_", "\",", " ", "\"_", "if_", "no", "\\u", "html_", "else_", "\"<", "br", "/>", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "comp_", "._", "join_", "(_", "names_", ")_", "if_", "len_", "(_", "names_", ")_", ">_", "0_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "UM", "LS", "Lookup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "look", "up", "\\u", "code", "\\u", "for", "\\u", "name_", "(_", "self_", ",_", "name_", ",_", "prefer", "red_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"\"\"", " ", "Trie", "s", " ", "to", " ", "find", " ", "a", " ", "good", " ", "concept", " ", "code", " ", "for", " ", "the", " ", "give", "n", " ", "concept", " ", "name", ".", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", "Us", "es", " ", "our", " ", "indexe", "d", " ", "`", "description", "s", "`", " ", "table", ".", "\\", "10", ";", "\t", "\t", "\\", "10", ";", "\t", "\t", ":", "return", "s", ":", " ", "A", " ", "list", " ", "of", " ", "triple", "s", " ", "with", " ", "(", "cui", ",", " ", "sab", ",", " ", "sty", ")", "\\", "10", ";", "\t", "\t", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "is_", "None_", "or_", "len_", "(_", "name_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "lazy", " ", "UM", "LS", " ", "db", " ", "checking", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "UM", "LS", "Lookup_", "._", "did", "\\u", "check", "\\u", "dbs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "UM", "LS_", "._", "check", "\\u", "database_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "UM", "LS", "Lookup_", "._", "did", "\\u", "check", "\\u", "dbs_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CU", "I", ":", " ", "Concept", "-", "ID_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "STR", ":", " ", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SA", "B", ":", " ", "Abbr", "evi", "ated", " ", "Sou", "rce", " ", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ST", "Y", ":", " ", "Semantic", " ", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "prefer", "red_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "sql_", "=_", "'", "SELECT", " ", "CU", "I", ",", " ", "SA", "B", ",", " ", "ST", "Y", " ", "FROM", " ", "description", "s", " ", "WHE", "RE", " ", "STR", " ", "LI", "KE", " ", "?", " ", "AND", " ", "SA", "B", " ", "IN", " ", "({})'_", "._", "format_", "(_", "\",", " ", "\"_", "._", "join_", "(_", "UM", "LS", "Lookup_", "._", "prefer", "red", "\\u", "sources_", ")_", ")_", "\\u\\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_", "sql_", "=_", "'", "SELECT", " ", "CU", "I", ",", " ", "SA", "B", ",", " ", "ST", "Y", " ", "FROM", " ", "description", "s", " ", "WHE", "RE", " ", "STR", " ", "LI", "KE", " ", "?'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "as", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arr_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "res_", "in_", "self_", "._", "sqlite_", "._", "execute_", "(_", "sql_", ",_", "(_", "'%'_", "+_", "name_", "+_", "'%'_", ",_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "arr_", "._", "append_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "arr_", "\\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, 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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 ]
Unused import
Kilian/Trimage/src/trimage/filesize/__init__.py
[ { "content": "from filesize import size\nfrom filesize import traditional, alternative, verbose, iec, si\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from filesize import size", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 25 }, { "span": "from filesize import traditional, alternative, verbose, iec, si", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 63 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "filesize_", "import_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "filesize_", "import_", "trad", "itional", "_", ",_", "alternative", "_", ",_", "verbose_", ",_", "ie", "c_", ",_", "si_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Except block handles 'BaseException'
treeio/treeio/treeio/sales/forms.py
[ { "content": " def __init__(self, user, *args, **kwargs):\n \"Sets choices and initial value\"\n super(SettingsForm, self).__init__(*args, **kwargs)\n self.fields['default_lead_status'].queryset = Object.filter_permitted(user,\n SaleStatus.objects.filter(use_leads=True))\n self.fields['default_opportunity_status'].queryset = Object.filter_permitted(user,\n SaleStatus.objects.filter(use_opportunities=True))\n self.fields['default_order_status'].queryset = Object.filter_permitted(user,\n SaleStatus.objects.filter(use_sales=True))\n self.fields['default_order_source'].queryset = Object.filter_permitted(user,\n SaleSource.objects.all())\n self.fields['order_fulfil_status'].queryset = Object.filter_permitted(user,\n SaleStatus.objects.filter(use_sales=True))\n self.fields['default_order_product'].queryset = Object.filter_permitted(user,\n Product.objects.filter(active=True))\n\n # Translation\n\n self.fields['default_currency'].label = _('Base Currency')\n self.fields['default_lead_status'].label = _('Default Lead Status')\n self.fields['default_opportunity_status'].label = _(\n 'Default Opportunity Status')\n self.fields['default_order_status'].label = _('Default Order Status')\n self.fields['default_order_source'].label = _('Default Order Source')\n self.fields['default_order_product'].label = _('Default Order Product')\n self.fields['order_fulfil_status'].label = _('Order Fulfilment Status')\n\n try:\n self.fields['default_currency'].queryset = Currency.objects\n self.fields['default_currency'].initial = Currency.objects.get(\n is_default__exact=True)\n self.fields['default_currency'].widget.attrs.update(\n {'popuplink': reverse('sales_currency_add')})\n except:\n pass\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_opportunity_status')[0]\n default_opportunity_status = SaleStatus.objects.get(\n pk=long(conf.value))\n self.fields[\n 'default_opportunity_status'].initial = default_opportunity_status.id\n except:\n pass\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_lead_status')[0]\n default_lead_status = SaleStatus.objects.get(pk=long(conf.value))\n self.fields['default_lead_status'].initial = default_lead_status.id\n except:\n pass\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_order_status')[0]\n default_order_status = SaleStatus.objects.get(pk=long(conf.value))\n self.fields[\n 'default_order_status'].initial = default_order_status.id\n except:\n pass\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_order_source')[0]\n default_order_source = SaleSource.objects.get(pk=long(conf.value))\n self.fields[\n 'default_order_source'].initial = default_order_source.id\n except:\n pass\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_order_product')[0]\n default_order_product = Product.objects.get(pk=long(conf.value))\n self.fields[\n 'default_order_product'].initial = default_order_product.id\n except:\n pass\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'order_fulfil_status')[0]\n order_fulfil_status = SaleStatus.objects.get(pk=long(conf.value))\n self.fields['order_fulfil_status'].initial = order_fulfil_status.id\n except:\n pass", "metadata": "root.SettingsForm.__init__", "header": "['class', 'SettingsForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 214 }, { "content": " def save(self):\n \"Form processor\"\n fields = self.fields\n try:\n for field in fields:\n if self.cleaned_data[field]:\n if field == 'default_currency':\n ModuleSetting.set_for_module('default_currency',\n self.cleaned_data[\n 'default_currency'],\n 'treeio.sales')\n currency = Currency.objects.get(\n pk=self.cleaned_data['default_currency'])\n currency.is_default = True\n currency.save()\n else:\n ModuleSetting.set_for_module(field, self.cleaned_data[field].id,\n 'treeio.sales')\n return True\n except:\n return False", "metadata": "root.SettingsForm.save", "header": "['class', 'SettingsForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 303 }, { "content": " def __init__(self, user, order, *args, **kwargs):\n\n super(OrderedProductForm, self).__init__(*args, **kwargs)\n\n self.fields['subscription'].queryset = Object.filter_permitted(\n user, Subscription.objects)\n self.fields['subscription'].widget.attrs.update({'class': 'autocomplete',\n 'callback': reverse('sales_ajax_subscription_lookup')})\n self.fields['subscription'].widget.attrs.update(\n {'popuplink': reverse('sales_subscription_add')})\n self.fields['subscription'].label = _(\"Subscription\")\n\n self.fields['product'].queryset = Object.filter_permitted(\n user, Product.objects.filter(active=True))\n if user.is_admin('treeio.sales'):\n self.fields['product'].widget.attrs.update(\n {'popuplink': reverse('sales_product_add')})\n self.fields['product'].label = _(\"Product\")\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_order_product')[0]\n # AJAX to set the initial rate as the currency converted value of\n # product sell price\n self.fields['product'].initial = long(conf.value)\n except:\n pass\n\n # Tax\n self.fields['tax'].widget.attrs.update(\n {'popuplink': reverse('finance_tax_add')})\n\n # TODO: rate\n # self.fields['rate_display'].label = _(\"Rate\")\n # self.fields['rate_display'].help_text = order.currency.code\n\n self.fields['quantity'].label = _(\"Quantity\")\n self.fields['quantity'].initial = 1\n self.fields['discount'].label = _(\"Discount\")\n self.fields['discount'].help_text = \"%\"", "metadata": "root.OrderedProductForm.__init__", "header": "['class', 'OrderedProductForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 632 }, { "content": " def __init__(self, user, lead=None, opportunity=None, *args, **kwargs):\n super(OrderForm, self).__init__(*args, **kwargs)\n\n self.fields['reference'].required = False\n self.fields['reference'].label = _(\"Reference\")\n if hasattr(self, 'instance') and not self.instance.reference:\n next_ref = self.instance.get_next_reference()\n if next_ref:\n self.fields['reference'].initial = next_ref\n\n self.fields['client'].queryset = Object.filter_permitted(\n user, Contact.objects)\n self.fields['client'].widget.attrs.update({'class': 'autocomplete',\n 'callback': reverse('identities_ajax_contact_lookup')})\n self.fields['client'].widget.attrs.update(\n {'popuplink': reverse('identities_contact_add')})\n self.fields['client'].label = _(\"Client\")\n\n self.fields['source'].queryset = Object.filter_permitted(\n user, SaleSource.objects.filter(active=True))\n self.fields['source'].label = _(\"Source\")\n\n # Currency\n self.fields['currency'].label = _('Currency')\n instance = getattr(self, 'instance', None)\n if instance and instance.id:\n del self.fields['currency']\n else:\n self.fields['currency'].widget.attrs.update(\n {'popuplink': reverse('finance_currency_add')})\n self.fields['currency'].initial = Currency.objects.get(\n is_default=True)\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_order_source')[0]\n self.fields['source'].initial = long(conf.value)\n except:\n pass\n\n self.fields['status'].queryset = Object.filter_permitted(user,\n SaleStatus.objects.filter(use_sales=True))\n self.fields['status'].label = _(\"Status\")\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_order_status')[0]\n self.fields['status'].initial = long(conf.value)\n except:\n pass\n\n if opportunity:\n self.fields['opportunity'].queryset = Object.filter_permitted(\n user, Opportunity.objects)\n self.fields['opportunity'].label = _(\"Opportunity\")\n self.fields['opportunity'].initial = opportunity.id\n self.fields['client'].initial = opportunity.contact_id\n self.fields['source'].initial = opportunity.source_id\n self.fields['assigned'].initial = [\n i.id for i in opportunity.assigned.only('id')]\n else:\n del self.fields['opportunity']\n\n if lead:\n self.fields['client'].initial = lead.contact_id\n self.fields['source'].initial = lead.source_id\n self.fields['assigned'].initial = [\n i.id for i in lead.assigned.only('id')]\n\n self.fields['assigned'].help_text = \"\"\n self.fields['assigned'].label = _(\"Assigned to\")\n self.fields['assigned'].widget.attrs.update({'class': 'multicomplete',\n 'callback': reverse('identities_ajax_user_lookup')})\n\n self.fields['datetime'].label = _(\"Date\")\n self.fields['datetime'].widget.attrs.update(\n {'class': 'datetimepicker'})\n self.fields['details'].label = _(\"Details\")", "metadata": "root.OrderForm.__init__", "header": "['class', 'OrderForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 738 }, { "content": " def __init__(self, user, *args, **kwargs):\n super(LeadForm, self).__init__(*args, **kwargs)\n\n self.fields['contact'].queryset = Object.filter_permitted(\n user, Contact.objects)\n self.fields['contact'].widget.attrs.update({'class': 'autocomplete',\n 'callback': reverse('identities_ajax_contact_lookup')})\n self.fields['contact'].widget.attrs.update(\n {'popuplink': reverse('identities_contact_add')})\n self.fields['contact'].label = _(\"Contact\")\n\n self.fields['source'].queryset = Object.filter_permitted(\n user, SaleSource.objects.filter(active=True))\n self.fields['source'].label = _(\"Source\")\n self.fields['products_interested'].queryset = Object.filter_permitted(\n user, Product.objects)\n self.fields['products_interested'].help_text = \"\"\n self.fields['products_interested'].widget.attrs.update(\n {'popuplink': reverse('sales_product_add')})\n self.fields['products_interested'].label = _(\"Products interested\")\n\n self.fields['assigned'].help_text = \"\"\n self.fields['assigned'].label = _(\"Assigned to\")\n self.fields['assigned'].widget.attrs.update({'class': 'multicomplete',\n 'callback': reverse('identities_ajax_user_lookup')})\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_order_product')[0]\n self.fields['products_interested'].initial = [long(conf.value)]\n except:\n pass\n\n self.fields['status'].queryset = Object.filter_permitted(\n user, SaleStatus.objects.filter(use_leads=True))\n self.fields['status'].label = _(\"Status\")\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_lead_status')[0]\n self.fields['status'].initial = long(conf.value)\n except:\n pass\n\n self.fields['contact_method'].label = _(\"Contact method\")\n self.fields['details'].label = _(\"Details\")", "metadata": "root.LeadForm.__init__", "header": "['class', 'LeadForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 878 }, { "content": " def __init__(self, user, lead, *args, **kwargs):\n super(OpportunityForm, self).__init__(*args, **kwargs)\n\n self.fields['lead'].queryset = Object.filter_permitted(\n user, Lead.objects)\n self.fields['contact'].queryset = Object.filter_permitted(\n user, Contact.objects)\n self.fields['contact'].widget.attrs.update(\n {'popuplink': reverse('identities_contact_add')})\n self.fields['contact'].widget.attrs.update({'class': 'autocomplete',\n 'callback': reverse('identities_ajax_contact_lookup')})\n self.fields['products_interested'].queryset = Object.filter_permitted(\n user, Product.objects)\n self.fields['products_interested'].widget.attrs.update(\n {'popuplink': reverse('sales_product_add')})\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_order_product')[0]\n self.fields['products_interested'].initial = [long(conf.value)]\n except:\n pass\n self.fields['source'].queryset = Object.filter_permitted(user,\n SaleSource.objects.filter(active=True))\n self.fields['status'].queryset = Object.filter_permitted(user,\n SaleStatus.objects.filter(use_opportunities=True))\n self.fields['assigned'].widget.attrs.update({'class': 'multicomplete',\n 'callback': reverse('identities_ajax_user_lookup')})\n\n try:\n conf = ModuleSetting.get_for_module(\n 'treeio.sales', 'default_opportunity_status')[0]\n self.fields['status'].initial = long(conf.value)\n except:\n pass\n\n if lead:\n self.fields['lead'].initial = lead.id\n self.fields['contact'].initial = lead.contact_id\n self.fields['products_interested'].initial = [\n i.id for i in lead.products_interested.only('id')]\n self.fields['source'].initial = lead.source_id\n self.fields['assigned'].initial = [\n i.id for i in lead.assigned.only('id')]\n else:\n del self.fields['lead']\n\n self.fields['products_interested'].help_text = \"\"\n self.fields['assigned'].help_text = \"\"\n\n self.fields['expected_date'].widget.attrs.update(\n {'class': 'datepicker'})\n self.fields['closed_date'].widget.attrs.update({'class': 'datepicker'})\n\n self.fields['contact'].label = _(\"Contact\")\n self.fields['products_interested'].label = _(\"Products interested\")\n self.fields['source'].label = _(\"Source\")\n self.fields['expected_date'].label = _(\"Expected date\")\n self.fields['closed_date'].label = _(\"Closed date\")\n self.fields['assigned'].label = _(\"Assigned to\")\n self.fields['amount_display'].label = _(\"Amount\")\n self.fields['amount_currency'].label = _(\"Currency\")\n self.fields['amount_currency'].widget.attrs.update(\n {'popuplink': reverse('finance_currency_add')})\n self.fields['amount_currency'].initial = Currency.objects.get(\n is_default=True)\n\n self.fields['probability'].label = _(\"Probability\")\n self.fields['status'].label = _(\"Status\")\n self.fields['details'].label = _(\"Details\")", "metadata": "root.OpportunityForm.__init__", "header": "['class', 'OpportunityForm', '(', 'forms', '.', 'ModelForm', ')', ':', '___EOS___']", "index": 980 } ]
[ { "span": "except:", "start_line": 247, "start_column": 8, "end_line": 247, "end_column": 15 }, { "span": "except:", "start_line": 257, "start_column": 8, "end_line": 257, "end_column": 15 }, { "span": "except:", "start_line": 265, "start_column": 8, "end_line": 265, "end_column": 15 }, { "span": "except:", "start_line": 274, "start_column": 8, "end_line": 274, "end_column": 15 }, { "span": "except:", "start_line": 283, "start_column": 8, "end_line": 283, "end_column": 15 }, { "span": "except:", "start_line": 292, "start_column": 8, "end_line": 292, "end_column": 15 }, { "span": "except:", "start_line": 300, "start_column": 8, "end_line": 300, "end_column": 15 }, { "span": "except:", "start_line": 322, "start_column": 8, "end_line": 322, "end_column": 15 }, { "span": "except:", "start_line": 657, "start_column": 8, "end_line": 657, "end_column": 15 }, { "span": "except:", "start_line": 775, "start_column": 8, "end_line": 775, "end_column": 15 }, { "span": "except:", "start_line": 786, "start_column": 8, "end_line": 786, "end_column": 15 }, { "span": "except:", "start_line": 908, "start_column": 8, "end_line": 908, "end_column": 15 }, { "span": "except:", "start_line": 919, "start_column": 8, "end_line": 919, "end_column": 15 }, { "span": "except:", "start_line": 999, "start_column": 8, "end_line": 999, "end_column": 15 }, { "span": "except:", "start_line": 1012, "start_column": 8, "end_line": 1012, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Set", "s", " ", "choice", "s", " ", "and", " ", "initial", " ", "value", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Sett", "ings", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "lead", "\\u", "status", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Status_", "._", "objects_", "._", "filter_", "(_", "use", "\\u", "leads", "_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "opportunit", "y", "\\u", "status", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Status_", "._", "objects_", "._", "filter_", "(_", "use", "\\u", "opportunit", "ies_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "order", "\\u", "status", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Status_", "._", "objects_", "._", "filter_", "(_", "use", "\\u", "sales", "_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "order", "\\u", "source", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Source_", "._", "objects_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "order", "\\u", "ful", "fil", "\\u", "status", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Status_", "._", "objects_", "._", "filter_", "(_", "use", "\\u", "sales", "_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "order", "\\u", "product", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Product_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Translation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "curr", "ency", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "'", "Base", " ", "Currenc", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "lead", "\\u", "status", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "'", "Default", " ", "Lead", " ", "Status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "opportunit", "y", "\\u", "status", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Default", " ", "Oppo", "rtu", "nit", "y", " ", "Status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "order", "\\u", "status", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "'", "Default", " ", "Order", " ", "Status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "order", "\\u", "source", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "'", "Default", " ", "Order", " ", "Sou", "rce", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "order", "\\u", "product", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "'", "Default", " ", "Order", " ", "Product", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "order", "\\u", "ful", "fil", "\\u", "status", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "'", "Order", " ", "Fu", "lfil", "ment", " ", "Status", "'_", ")_", "\\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_", "._", "fields_", "[_", "'", "default", "\\u", "curr", "ency", "'_", "]_", "._", "queryset_", "=_", "Currenc", "y_", "._", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "curr", "ency", "'_", "]_", "._", "initial_", "=_", "Currenc", "y_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "default", "\\u\\u", "exact_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "curr", "ency", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "sales", "\\u", "curr", "ency", "\\u", "add", "'_", ")_", "}_", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "opportunit", "y", "\\u", "status", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "opportunit", "y", "\\u", "status_", "=_", "Sal", "e", "Status_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pk_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "opportunit", "y", "\\u", "status", "'_", "]_", "._", "initial_", "=_", "default", "\\u", "opportunit", "y", "\\u", "status_", "._", "id_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "lead", "\\u", "status", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "lead", "\\u", "status_", "=_", "Sal", "e", "Status_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "default", "\\u", "lead", "\\u", "status", "'_", "]_", "._", "initial_", "=_", "default", "\\u", "lead", "\\u", "status_", "._", "id_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "order", "\\u", "status", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "order", "\\u", "status_", "=_", "Sal", "e", "Status_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "order", "\\u", "status", "'_", "]_", "._", "initial_", "=_", "default", "\\u", "order", "\\u", "status_", "._", "id_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "order", "\\u", "source", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "order", "\\u", "source_", "=_", "Sal", "e", "Source_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "order", "\\u", "source", "'_", "]_", "._", "initial_", "=_", "default", "\\u", "order", "\\u", "source_", "._", "id_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "order", "\\u", "product", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "order", "\\u", "product_", "=_", "Product_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "order", "\\u", "product", "'_", "]_", "._", "initial_", "=_", "default", "\\u", "order", "\\u", "product_", "._", "id_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "order", "\\u", "ful", "fil", "\\u", "status", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "\\u", "ful", "fil", "\\u", "status_", "=_", "Sal", "e", "Status_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "order", "\\u", "ful", "fil", "\\u", "status", "'_", "]_", "._", "initial_", "=_", "order", "\\u", "ful", "fil", "\\u", "status_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Form", " ", "process", "or", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "self_", "._", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "field_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "field_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "field_", "==_", "'", "default", "\\u", "curr", "ency", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Modul", "e", "Setting_", "._", "set\\u", "for", "\\u", "module_", "(_", "'", "default", "\\u", "curr", "ency", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "\\u", "curr", "ency", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "currency_", "=_", "Currenc", "y_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pk_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "default", "\\u", "curr", "ency", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "currency_", "._", "is", "\\u", "default_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "currency_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "Modul", "e", "Setting_", "._", "set\\u", "for", "\\u", "module_", "(_", "field_", ",_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "field_", "]_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ")_", "\\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_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order", "ed", "Product", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user_", ",_", "order_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Order", "ed", "Product", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "subscript", "ion", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Subscription_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "subscript", "ion", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "autocomplete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "sales", "\\u", "aja", "x", "\\u", "subscript", "ion", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "subscript", "ion", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "sales", "\\u", "subscript", "ion", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "subscript", "ion", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Subscription", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "product", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Product_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "._", "is", "\\u", "admin_", "(_", "'", "treei", "o", ".", "sales", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "product", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "sales", "\\u", "product", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "product", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Product", "\"_", ")_", "\\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 ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "order", "\\u", "product", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "AJ", "AX", " ", "to", " ", "set", " ", "the", " ", "initial", " ", "rate", " ", "as", " ", "the", " ", "curr", "ency", " ", "convert", "ed", " ", "value", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "product", " ", "sell", " ", "price_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "product", "'_", "]_", "._", "initial_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tax", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "tax", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "finance", "\\u", "tax", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "rate_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "self", ".", "fields", "['", "rate", "\\u", "display", "']", ".", "label", " ", "=", " ", "\\u(", "\"", "Rat", "e", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "self", ".", "fields", "['", "rate", "\\u", "display", "']", ".", "help", "\\u", "text", " ", "=", " ", "order", ".", "curr", "ency", ".", "code_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "quanti", "ty", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Quanti", "ty", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "quanti", "ty", "'_", "]_", "._", "initial_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "discou", "nt", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Disco", "unt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "discou", "nt", "'_", "]_", "._", "help", "\\u", "text_", "=_", "\"%\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user_", ",_", "lead_", "=_", "None_", ",_", "opportunit", "y_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Order", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "reference", "'_", "]_", "._", "required_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "reference", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Reference", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "'", "instance", "'_", ")_", "and_", "not_", "self_", "._", "instance_", "._", "reference_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "ref_", "=_", "self_", "._", "instance_", "._", "get", "\\u", "next", "\\u", "reference_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "next", "\\u", "ref_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "reference", "'_", "]_", "._", "initial_", "=_", "next", "\\u", "ref_", "\\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_", "._", "fields_", "[_", "'", "client", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Contact_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "client", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "autocomplete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "aja", "x", "\\u", "contact", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "client", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "contact", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "client", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Client", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Sal", "e", "Source_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Currenc", "y_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "curr", "ency", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "'", "Currenc", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "getattr_", "(_", "self_", ",_", "'", "instance", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instance_", "and_", "instance_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "fields_", "[_", "'", "curr", "ency", "'_", "]_", "\\u\\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_", "._", "fields_", "[_", "'", "curr", "ency", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "finance", "\\u", "curr", "ency", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "curr", "ency", "'_", "]_", "._", "initial_", "=_", "Currenc", "y_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "default_", "=_", "True_", ")_", "\\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 ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "order", "\\u", "source", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "initial_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Status_", "._", "objects_", "._", "filter_", "(_", "use", "\\u", "sales", "_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Status", "\"_", ")_", "\\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 ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "order", "\\u", "status", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "initial_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opportunit", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "opportunit", "y", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Oppo", "rtu", "nit", "y_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "opportunit", "y", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Oppo", "rtu", "nit", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "opportunit", "y", "'_", "]_", "._", "initial_", "=_", "opportunit", "y_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "client", "'_", "]_", "._", "initial_", "=_", "opportunit", "y_", "._", "contact", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "initial_", "=_", "opportunit", "y_", "._", "source", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "initial_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "._", "id_", "for_", "i_", "in_", "opportunit", "y_", "._", "assigned_", "._", "only_", "(_", "'", "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 ", " _", "del_", "self_", "._", "fields_", "[_", "'", "opportunit", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lead_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "client", "'_", "]_", "._", "initial_", "=_", "lead_", "._", "contact", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "initial_", "=_", "lead_", "._", "source", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "initial_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "._", "id_", "for_", "i_", "in_", "lead_", "._", "assigned_", "._", "only_", "(_", "'", "id", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "help", "\\u", "text_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Assign", "ed", " ", "to", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "multico", "mplet", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "aja", "x", "\\u", "user", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "datetime", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Date", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "datetime", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "class", "'_", ":_", "'", "datetime", "picker", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "deta", "il", "s", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Det", "ail", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Lead", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Lead", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Contact_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "autocomplete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "aja", "x", "\\u", "contact", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "contact", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Conta", "ct", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Sal", "e", "Source_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Product_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "help", "\\u", "text_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "sales", "\\u", "product", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Product", "s", " ", "interest", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "help", "\\u", "text_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Assign", "ed", " ", "to", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "multico", "mplet", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "aja", "x", "\\u", "user", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\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 ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "order", "\\u", "product", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "initial_", "=_", "[_", "long_", "(_", "conf_", "._", "value_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Sal", "e", "Status_", "._", "objects_", "._", "filter_", "(_", "use", "\\u", "leads", "_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Status", "\"_", ")_", "\\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 ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "lead", "\\u", "status", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "initial_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "\\u", "method", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Conta", "ct", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "deta", "il", "s", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Det", "ail", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oppo", "rtu", "nit", "y", "Form_", "(_", "forms_", "._", "Model", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user_", ",_", "lead_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Oppo", "rtu", "nit", "y", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "lead", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Lead", "_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Contact_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "contact", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "autocomplete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "aja", "x", "\\u", "contact", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "user_", ",_", "Product_", "._", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "sales", "\\u", "product", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "order", "\\u", "product", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "initial_", "=_", "[_", "long_", "(_", "conf_", "._", "value_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Source_", "._", "objects_", "._", "filter_", "(_", "active_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "queryset_", "=_", "Object_", "._", "filter", "\\u", "permit", "ted_", "(_", "user_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "e", "Status_", "._", "objects_", "._", "filter_", "(_", "use", "\\u", "opportunit", "ies_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "multico", "mplet", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "callback", "'_", ":_", "reverse_", "(_", "'", "identities", "\\u", "aja", "x", "\\u", "user", "\\u", "look", "up", "'_", ")_", "}_", ")_", "\\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 ", " _", "conf_", "=_", "Modul", "e", "Setting_", "._", "get", "\\u", "for", "\\u", "module_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "treei", "o", ".", "sales", "'_", ",_", "'", "default", "\\u", "opportunit", "y", "\\u", "status", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "initial_", "=_", "long_", "(_", "conf_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lead_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fields_", "[_", "'", "lead", "'_", "]_", "._", "initial_", "=_", "lead_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "initial_", "=_", "lead_", "._", "contact", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "initial_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "._", "id_", "for_", "i_", "in_", "lead_", "._", "products", "\\u", "interest", "ed_", "._", "only_", "(_", "'", "id", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "initial_", "=_", "lead_", "._", "source", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "initial_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "._", "id_", "for_", "i_", "in_", "lead_", "._", "assigned_", "._", "only_", "(_", "'", "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 ", " _", "del_", "self_", "._", "fields_", "[_", "'", "lead", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "help", "\\u", "text_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "help", "\\u", "text_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "expected", "\\u", "date", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "class", "'_", ":_", "'", "date", "picker", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "close", "d\\u", "date", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "{_", "'", "class", "'_", ":_", "'", "date", "picker", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "contact", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Conta", "ct", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "products", "\\u", "interest", "ed", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Product", "s", " ", "interest", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "source", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Sou", "rce", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "expected", "\\u", "date", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Expect", "ed", " ", "date", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "close", "d\\u", "date", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Clos", "ed", " ", "date", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "assign", "ed", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Assign", "ed", " ", "to", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "amo", "unt", "\\u", "display", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Amo", "unt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "amo", "unt", "\\u", "curr", "ency", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Currenc", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "amo", "unt", "\\u", "curr", "ency", "'_", "]_", "._", "widget_", "._", "attrs_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "popu", "plin", "k", "'_", ":_", "reverse_", "(_", "'", "finance", "\\u", "curr", "ency", "\\u", "add", "'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "amo", "unt", "\\u", "curr", "ency", "'_", "]_", "._", "initial_", "=_", "Currenc", "y_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "default_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "probabilit", "y", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Probabili", "ty", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "status", "'_", "]_", "._", "label_", "=_", "\\u_", "(_", "\"", "Status", "\"_", ")_", "\\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 ]
Unused import
vereseproject/verese/verese/examples/views.py
[ { "content": "\"\"\"Example views. Feel free to delete this app.\"\"\"\n\nimport logging\n\nfrom django import http\nfrom django.shortcuts import render\n\nimport bleach\nimport commonware\nfrom funfactory.log import log_cef\nfrom mobility.decorators import mobile_template\nfrom session_csrf import anonymous_csrf\n\n\nlog = commonware.log.getLogger('playdoh')\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@mobile_template('examples/{mobile/}home.html')\ndef home(request, template=None):\n \"\"\"Main example view.\"\"\"\n data = {} # You'd add data here that you're sending to the template.\n log.debug(\"I'm alive!\")\n return render(request, template, data)", "metadata": "root.home", "header": "['module', '___EOS___']", "index": 17 }, { "content": "@anonymous_csrf\ndef bleach_test(request):\n \"\"\"A view outlining bleach's HTML sanitization.\"\"\"\n allowed_tags = ('strong', 'em')\n\n data = {}\n\n if request.method == 'POST':\n bleachme = request.POST.get('bleachme', None)\n data['bleachme'] = bleachme\n if bleachme:\n data['bleached'] = bleach.clean(bleachme, tags=allowed_tags)\n\n # CEF logging: Log user input that needed to be \"bleached\".\n if data['bleached'] != bleachme:\n log_cef('Bleach Alert', logging.INFO, request,\n username='anonymous', signature='BLEACHED',\n msg='User data needed to be bleached: %s' % bleachme)\n\n return render(request, 'examples/bleach.html', data)", "metadata": "root.bleach_test", "header": "['module', '___EOS___']", "index": 25 } ]
[ { "span": "from django import http", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Exam", "ple", " ", "views", ".", " ", "Fee", "l", " ", "free", " ", "to", " ", "delete", " ", "this", " ", "app", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "import_", "http_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "ble", "ach", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "common", "ware_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fun", "factory_", "._", "log_", "import_", "log", "\\u", "cef", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mobi", "lity_", "._", "decorators_", "import_", "mobile", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "session", "\\u", "csrf_", "import_", "anonym", "ous", "\\u", "csrf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "common", "ware_", "._", "log_", "._", "get", "Logger_", "(_", "'", "play", "do", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "mobile", "\\u", "template_", "(_", "'", "example", "s", "/{", "mobile", "/", "}", "home", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "home_", "(_", "request_", ",_", "template_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Main", " ", "example", " ", "view", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "{_", "}_", "#", " ", "You", "'", "d", " ", "add", " ", "data", " ", "here", " ", "tha", "t", " ", "you", "'", "re", " ", "sendin", "g", " ", "to", " ", "the", " ", "template", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "I", "'", "m", " ", "alive", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "template_", ",_", "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_", "@_", "anonym", "ous", "\\u", "csrf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "ble", "ach", "\\u", "test_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "view", " ", "outl", "inin", "g", " ", "ble", "ach", "'", "s", " ", "HTM", "L", " ", "sani", "ti", "zatio", "n", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "tags_", "=_", "(_", "'", "strong", "'_", ",_", "'", "em", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ble", "ach", "me_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "'", "ble", "ach", "me", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "ble", "ach", "me", "'_", "]_", "=_", "ble", "ach", "me_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ble", "ach", "me_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "ble", "ache", "d", "'_", "]_", "=_", "ble", "ach", "_", "._", "clean_", "(_", "ble", "ach", "me_", ",_", "tags_", "=_", "allow", "ed", "\\u", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CE", "F", " ", "logg", "ing", ":", " ", "Log", " ", "user", " ", "input", " ", "tha", "t", " ", "need", "ed", " ", "to", " ", "be", " ", "\"", "ble", "ache", "d", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", "[_", "'", "ble", "ache", "d", "'_", "]_", "!=_", "ble", "ach", "me_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log", "\\u", "cef", "_", "(_", "'", "Ble", "ach", " ", "Alert", "'_", ",_", "logging_", "._", "INFO_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "'", "anonym", "ous", "'_", ",_", "signature_", "=_", "'", "BL", "EAC", "HED", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "'", "User", " ", "data", " ", "need", "ed", " ", "to", " ", "be", " ", "ble", "ache", "d", ":", " ", "%", "s", "'_", "%_", "ble", "ach", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "example", "s", "/", "ble", "ach", ".", "html", "'_", ",_", "data_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
cigroup-ol/windml/examples/missingdata/reconstruction_prediction.py
[ { "content": "def static_mreg_knn(windpark):\n target = windpark.get_target()\n measurements = repair_nrel(target.get_measurements()[:10000])\n neighbors = windpark.get_turbines()[:-1]\n nseries = [repair_nrel(t.get_measurements()[:10000]) for t in neighbors]\n\n iargs = {'method':'mreg',\n 'timestep': timestep,\n 'neighbor_series': nseries,\n 'reg' : 'knn',\n 'regargs' : {'kfold': 5, 'n' : [5,10,20,50,100], 'variant' : 'uniform'}}\n\n return iargs, nseries", "metadata": "root.static_mreg_knn", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def static_mreg_lin(windpark):\n target = windpark.get_target()\n measurements = repair_nrel(target.get_measurements()[:10000])\n neighbors = windpark.get_turbines()[:-1]\n nseries = [repair_nrel(t.get_measurements()[:10000]) for t in neighbors]\n\n iargs = {'method':'mreg',\n 'timestep': timestep,\n 'neighbor_series': nseries,\n 'reg' : 'linear_model'}\n return iargs, nseries", "metadata": "root.static_mreg_lin", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def static_linear(windpark):\n target = windpark.get_target()\n measurements = repair_nrel(target.get_measurements()[:10000])\n neighbors = windpark.get_turbines()[:-1]\n nseries = [repair_nrel(t.get_measurements()[:10000]) for t in neighbors]\n\n return {'method':'linear','timestep': timestep}, nseries", "metadata": "root.static_linear", "header": "['module', '___EOS___']", "index": 78 }, { "content": "def static_forwardcopy(windpark):\n target = windpark.get_target()\n measurements = repair_nrel(target.get_measurements()[:10000])\n neighbors = windpark.get_turbines()[:-1]\n nseries = [repair_nrel(t.get_measurements()[:10000]) for t in neighbors]\n\n return {'method':'forwardcopy','timestep': timestep}, nseries", "metadata": "root.static_forwardcopy", "header": "['module', '___EOS___']", "index": 86 }, { "content": "def experiment(method, windpark, windpark_test, damaged, rate):\n args, nseries = argfuncs[method](windpark)\n reconstructed = interpolate(damaged, **args)\n\n target = windpark.get_target()\n measurements = repair_nrel(target.get_measurements()[:10000])\n turbines = windpark.get_turbines()\n\n for t in range(len(turbines)):\n turbines[t].add_measurements(\\\n repair_nrel(turbines[t].get_measurements()[:10000]))\n\n # this is the target turbine, use the reconstructed here.\n turbines[-1].add_measurements(reconstructed)\n\n feature_window, horizon = 3,3\n\n mapping = PowerMapping()\n # with damaged\n X = mapping.get_features_park(windpark, feature_window, horizon)\n Y = mapping.get_labels_turbine(target, feature_window, horizon)\n\n train_to = int(math.floor(len(X)))\n train_step, test_step = 1, 1\n\n reg = linear_model.LinearRegression()\n reg = reg.fit(X[0:train_to:train_step], Y[0:train_to:train_step])\n\n # USE THE 2005 YEAR FOR TESTING, WITHOUT DAMAGE\n # predict on second year without damage\n\n turbines = windpark_test.get_turbines()\n for t in turbines:\n t.add_measurements(repair_nrel(t.get_measurements()[:10000]))\n target_test = windpark_test.get_target()\n\n XT = mapping.get_features_park(windpark_test, feature_window, horizon)\n test_to = int(math.floor(len(XT)))\n\n YT = mapping.get_labels_turbine(target_test, feature_window, horizon)[:test_to]\n y_hat = reg.predict(XT[:test_to])\n\n mse_y_hat = 0\n for i in range(0, len(y_hat)):\n y = YT[i]\n mse_y_hat += (y_hat[i] - y) ** 2\n\n mse_y_hat /= float(len(y_hat))\n\n return mse_y_hat", "metadata": "root.experiment", "header": "['module', '___EOS___']", "index": 100 } ]
[ { "span": "measurements ", "start_line": 54, "start_column": 4, "end_line": 54, "end_column": 16 }, { "span": "measurements ", "start_line": 68, "start_column": 4, "end_line": 68, "end_column": 16 }, { "span": "measurements ", "start_line": 80, "start_column": 4, "end_line": 80, "end_column": 16 }, { "span": "measurements ", "start_line": 88, "start_column": 4, "end_line": 88, "end_column": 16 }, { "span": "measurements ", "start_line": 105, "start_column": 4, "end_line": 105, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "static", "\\u", "mre", "g", "\\u", "knn", "_", "(_", "wind", "park", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "wind", "park", "_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "repair", "\\u", "nre", "l_", "(_", "target_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "wind", "park", "_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nse", "ries_", "=_", "[_", "repair", "\\u", "nre", "l_", "(_", "t_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "for_", "t_", "in_", "neighbors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iar", "gs_", "=_", "{_", "'", "method", "'_", ":_", "'", "mre", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timestep", "'_", ":_", "timestep_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "neighbor", "\\u", "series", "'_", ":_", "nse", "ries_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reg", "'_", ":_", "'", "knn", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rega", "rg", "s", "'_", ":_", "{_", "'", "kf", "old", "'_", ":_", "5_", ",_", "'", "n", "'_", ":_", "[_", "5_", ",_", "10_", ",_", "20_", ",_", "50_", ",_", "100_", "]_", ",_", "'", "variant", "'_", ":_", "'", "uniform", "'_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "iar", "gs_", ",_", "nse", "ries_", "\\u\\u\\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_", "static", "\\u", "mre", "g", "\\u", "lin_", "(_", "wind", "park", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "wind", "park", "_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "repair", "\\u", "nre", "l_", "(_", "target_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "wind", "park", "_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nse", "ries_", "=_", "[_", "repair", "\\u", "nre", "l_", "(_", "t_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "for_", "t_", "in_", "neighbors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iar", "gs_", "=_", "{_", "'", "method", "'_", ":_", "'", "mre", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timestep", "'_", ":_", "timestep_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "neighbor", "\\u", "series", "'_", ":_", "nse", "ries_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reg", "'_", ":_", "'", "linear", "\\u", "model", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "iar", "gs_", ",_", "nse", "ries_", "\\u\\u\\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_", "static", "\\u", "linear_", "(_", "wind", "park", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "wind", "park", "_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "repair", "\\u", "nre", "l_", "(_", "target_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "wind", "park", "_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nse", "ries_", "=_", "[_", "repair", "\\u", "nre", "l_", "(_", "t_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "for_", "t_", "in_", "neighbors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "'", "method", "'_", ":_", "'", "linear", "'_", ",_", "'", "timestep", "'_", ":_", "timestep_", "}_", ",_", "nse", "ries_", "\\u\\u\\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_", "static", "\\u", "forward", "copy_", "(_", "wind", "park", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "wind", "park", "_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "repair", "\\u", "nre", "l_", "(_", "target_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbors_", "=_", "wind", "park", "_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nse", "ries_", "=_", "[_", "repair", "\\u", "nre", "l_", "(_", "t_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "for_", "t_", "in_", "neighbors_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "'", "method", "'_", ":_", "'", "forward", "copy", "'_", ",_", "'", "timestep", "'_", ":_", "timestep_", "}_", ",_", "nse", "ries_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "experiment_", "(_", "method_", ",_", "wind", "park", "_", ",_", "wind", "park", "\\u", "test_", ",_", "damage", "d_", ",_", "rate_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", ",_", "nse", "ries_", "=_", "arg", "funcs_", "[_", "method_", "]_", "(_", "wind", "park", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reconstruct", "ed_", "=_", "interpolate_", "(_", "damage", "d_", ",_", "**_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "wind", "park", "_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "measurements_", "=_", "repair", "\\u", "nre", "l_", "(_", "target_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "turb", "ines_", "=_", "wind", "park", "_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "range_", "(_", "len_", "(_", "turb", "ines_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "turb", "ines_", "[_", "t_", "]_", "._", "add", "\\u", "measurements_", "(_", "repair", "\\u", "nre", "l_", "(_", "turb", "ines_", "[_", "t_", "]_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "the", " ", "target", " ", "turb", "ine", ",", " ", "use", " ", "the", " ", "reconstruct", "ed", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "turb", "ines_", "[_", "-_", "1_", "]_", "._", "add", "\\u", "measurements_", "(_", "reconstruct", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "feature", "\\u", "window_", ",_", "horizon_", "=_", "3_", ",_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mapping_", "=_", "Power", "Mapping_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "with", " ", "damage", "d_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "mapping_", "._", "get", "\\u", "features", "\\u", "park", "_", "(_", "wind", "park", "_", ",_", "feature", "\\u", "window_", ",_", "horizon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "mapping_", "._", "get", "\\u", "labels", "\\u", "turb", "ine_", "(_", "target_", ",_", "feature", "\\u", "window_", ",_", "horizon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "to_", "=_", "int_", "(_", "math_", "._", "floor_", "(_", "len_", "(_", "X_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "train", "\\u", "step_", ",_", "test\\u", "step_", "=_", "1_", ",_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "=_", "linear", "\\u", "model_", "._", "Linea", "r", "Regression_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "=_", "reg_", "._", "fit_", "(_", "X_", "[_", "0_", ":_", "train", "\\u", "to_", ":_", "train", "\\u", "step_", "]_", ",_", "Y_", "[_", "0_", ":_", "train", "\\u", "to_", ":_", "train", "\\u", "step_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "USE", " ", "THE", " ", "2005", " ", "YEA", "R", " ", "FOR", " ", "TESTING", ",", " ", "WITH", "OUT", " ", "DA", "MAGE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "predi", "ct", " ", "on", " ", "second", " ", "year", " ", "with", "out", " ", "damage_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "turb", "ines_", "=_", "wind", "park", "\\u", "test_", "._", "get", "\\u", "turb", "ines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "turb", "ines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "._", "add", "\\u", "measurements_", "(_", "repair", "\\u", "nre", "l_", "(_", "t_", "._", "get", "\\u", "measurements_", "(_", ")_", "[_", ":_", "10000_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target", "\\u", "test_", "=_", "wind", "park", "\\u", "test_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "XT", "_", "=_", "mapping_", "._", "get", "\\u", "features", "\\u", "park", "_", "(_", "wind", "park", "\\u", "test_", ",_", "feature", "\\u", "window_", ",_", "horizon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "to_", "=_", "int_", "(_", "math_", "._", "floor_", "(_", "len_", "(_", "XT", "_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "YT", "_", "=_", "mapping_", "._", "get", "\\u", "labels", "\\u", "turb", "ine_", "(_", "target", "\\u", "test_", ",_", "feature", "\\u", "window_", ",_", "horizon_", ")_", "[_", ":_", "test\\u", "to_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "hat_", "=_", "reg_", "._", "predict_", "(_", "XT", "_", "[_", ":_", "test\\u", "to_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mse", "\\u", "y", "\\u", "hat_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "y", "\\u", "hat_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "YT", "_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mse", "\\u", "y", "\\u", "hat_", "+=_", "(_", "y", "\\u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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
lisa-lab/pylearn2/pylearn2/datasets/tests/test_mnistplus.py
[ { "content": "\"\"\"\nThis file tests the MNISTPlus class. majorly concerning the X and y member\nof the dataset and their corresponding sizes, data scales and topological\nviews.\n\"\"\"\nfrom pylearn2.datasets.mnistplus import MNISTPlus\nfrom pylearn2.space import IndexSpace, VectorSpace\nimport unittest\nfrom pylearn2.testing.skip import skip_if_no_data\nimport numpy as np\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_MNISTPlus():\n \"\"\"\n Test the MNISTPlus warper.\n Tests the scale of data, the splitting of train, valid, test sets.\n Tests that a topological batch has 4 dimensions.\n Tests that it work well with selected type of augmentation.\n \"\"\"\n skip_if_no_data()\n for subset in ['train', 'valid', 'test']:\n ids = MNISTPlus(which_set=subset)\n assert 0.01 >= ids.X.min() >= 0.0\n assert 0.99 <= ids.X.max() <= 1.0\n topo = ids.get_batch_topo(1)\n assert topo.ndim == 4\n del ids\n\n train_y = MNISTPlus(which_set='train', label_type='label')\n assert 0.99 <= train_y.X.max() <= 1.0\n assert 0.0 <= train_y.X.min() <= 0.01\n assert train_y.y.max() == 9\n assert train_y.y.min() == 0\n assert train_y.y.shape == (train_y.X.shape[0], 1)\n\n train_y = MNISTPlus(which_set='train', label_type='azimuth')\n assert 0.99 <= train_y.X.max() <= 1.0\n assert 0.0 <= train_y.X.min() <= 0.01\n assert 0.0 <= train_y.y.max() <= 1.0\n assert 0.0 <= train_y.y.min() <= 1.0\n assert train_y.y.shape == (train_y.X.shape[0], 1)\n\n train_y = MNISTPlus(which_set='train', label_type='rotation')\n assert 0.99 <= train_y.X.max() <= 1.0\n assert 0.0 <= train_y.X.min() <= 0.01\n assert train_y.y.max() == 9\n assert train_y.y.min() == 0\n assert train_y.y.shape == (train_y.X.shape[0], 1)\n\n train_y = MNISTPlus(which_set='train', label_type='texture_id')\n assert 0.99 <= train_y.X.max() <= 1.0\n assert 0.0 <= train_y.X.min() <= 0.01\n assert train_y.y.max() == 9\n assert train_y.y.min() == 0\n assert train_y.y.shape == (train_y.X.shape[0], 1)", "metadata": "root.test_MNISTPlus", "header": "['module', '___EOS___']", "index": 12 } ]
[ { "span": "from pylearn2.space import IndexSpace, VectorSpace", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 50 }, { "span": "import unittest", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 15 }, { "span": "import numpy as np", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "file", " ", "tests", " ", "the", " ", "MNIST", "Plus", " ", "class", ".", " ", "major", "ly", " ", "concern", "ing", " ", "the", " ", "X", " ", "and", " ", "y", " ", "member", "\\", "10", ";", "of", " ", "the", " ", "dataset", " ", "and", " ", "thei", "r", " ", "correspond", "ing", " ", "size", "s", ",", " ", "data", " ", "scale", "s", " ", "and", " ", "topologi", "cal", "\\", "10", ";", "views", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "datasets_", "._", "mni", "stp", "lus", "_", "import_", "MNIST", "Plus", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "space_", "import_", "Index", "Space_", ",_", "Vector", "Space_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "testing_", "._", "skip_", "import_", "skip", "\\u", "if", "\\u", "no", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\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", "MNIST", "Plus", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "the", " ", "MNIST", "Plus", " ", "warp", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "the", " ", "scale", " ", "of", " ", "data", ",", " ", "the", " ", "splitting", " ", "of", " ", "train", ",", " ", "valid", ",", " ", "test", " ", "sets", ".", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "tha", "t", " ", "a", " ", "topologi", "cal", " ", "batch", " ", "has", " ", "4", " ", "dimension", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "tha", "t", " ", "it", " ", "work", " ", "well", " ", "with", " ", "selecte", "d", " ", "type", " ", "of", " ", "augmenta", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip", "\\u", "if", "\\u", "no", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "subset_", "in_", "[_", "'", "train", "'_", ",_", "'", "valid", "'_", ",_", "'", "test", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ids_", "=_", "MNIST", "Plus", "_", "(_", "whi", "ch", "\\u", "set_", "=_", "subset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.01_", ">=_", "ids_", "._", "X_", "._", "min_", "(_", ")_", ">=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.99_", "<=_", "ids_", "._", "X_", "._", "max_", "(_", ")_", "<=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topo_", "=_", "ids_", "._", "get", "\\u", "batch", "\\u", "topo_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "topo_", "._", "ndim_", "==_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "train", "\\u", "y_", "=_", "MNIST", "Plus", "_", "(_", "whi", "ch", "\\u", "set_", "=_", "'", "train", "'_", ",_", "label", "\\u", "type_", "=_", "'", "label", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.99_", "<=_", "train", "\\u", "y_", "._", "X_", "._", "max_", "(_", ")_", "<=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.0_", "<=_", "train", "\\u", "y_", "._", "X_", "._", "min_", "(_", ")_", "<=_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train", "\\u", "y_", "._", "y_", "._", "max_", "(_", ")_", "==_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train", "\\u", "y_", "._", "y_", "._", "min_", "(_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train", "\\u", "y_", "._", "y_", "._", "shape_", "==_", "(_", "train", "\\u", "y_", "._", "X_", "._", "shape_", "[_", "0_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "y_", "=_", "MNIST", "Plus", "_", "(_", "whi", "ch", "\\u", "set_", "=_", "'", "train", "'_", ",_", "label", "\\u", "type_", "=_", "'", "azimuth", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.99_", "<=_", "train", "\\u", "y_", "._", "X_", "._", "max_", "(_", ")_", "<=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.0_", "<=_", "train", "\\u", "y_", "._", "X_", "._", "min_", "(_", ")_", "<=_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.0_", "<=_", "train", "\\u", "y_", "._", "y_", "._", "max_", "(_", ")_", "<=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.0_", "<=_", "train", "\\u", "y_", "._", "y_", "._", "min_", "(_", ")_", "<=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train", "\\u", "y_", "._", "y_", "._", "shape_", "==_", "(_", "train", "\\u", "y_", "._", "X_", "._", "shape_", "[_", "0_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "y_", "=_", "MNIST", "Plus", "_", "(_", "whi", "ch", "\\u", "set_", "=_", "'", "train", "'_", ",_", "label", "\\u", "type_", "=_", "'", "rotati", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.99_", "<=_", "train", "\\u", "y_", "._", "X_", "._", "max_", "(_", ")_", "<=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.0_", "<=_", "train", "\\u", "y_", "._", "X_", "._", "min_", "(_", ")_", "<=_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train", "\\u", "y_", "._", "y_", "._", "max_", "(_", ")_", "==_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train", "\\u", "y_", "._", "y_", "._", "min_", "(_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train", "\\u", "y_", "._", "y_", "._", "shape_", "==_", "(_", "train", "\\u", "y_", "._", "X_", "._", "shape_", "[_", "0_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "y_", "=_", "MNIST", "Plus", "_", "(_", "whi", "ch", "\\u", "set_", "=_", "'", "train", "'_", ",_", "label", "\\u", "type_", "=_", "'", "textu", "re", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.99_", "<=_", "train", "\\u", "y_", "._", "X_", "._", "max_", "(_", ")_", "<=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "0.0_", "<=_", "train", "\\u", "y_", "._", "X_", "._", "min_", "(_", ")_", "<=_", "0.01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train", "\\u", "y_", "._", "y_", "._", "max_", "(_", ")_", "==_", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train", "\\u", "y_", "._", "y_", "._", "min_", "(_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "train", "\\u", "y_", "._", "y_", "._", "shape_", "==_", "(_", "train", "\\u", "y_", "._", "X_", "._", "shape_", "[_", "0_", "]_", ",_", "1_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 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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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 ]
Redundant comparison
sympy/sympy/sympy/matrices/sparse.py
[ { "content": " def _LDL_sparse(self):\n \"\"\"Algorithm for numeric LDL factization, exploiting sparse structure.\n \"\"\"\n Lrowstruc = self.row_structure_symbolic_cholesky()\n L = self.eye(self.rows)\n D = self.zeros(self.rows, self.cols)\n\n for i in range(len(Lrowstruc)):\n for j in Lrowstruc[i]:\n if i != j:\n L[i, j] = self[i, j]\n summ = 0\n for p1 in Lrowstruc[i]:\n if p1 < j:\n for p2 in Lrowstruc[j]:\n if p2 < j:\n if p1 == p2:\n summ += L[i, p1]*L[j, p1]*D[p1, p1]\n else:\n break\n else:\n break\n L[i, j] -= summ\n L[i, j] /= D[j, j]\n elif i == j:\n D[i, i] = self[i, i]\n summ = 0\n for k in Lrowstruc[i]:\n if k < i:\n summ += L[i, k]**2*D[k, k]\n else:\n break\n D[i, i] -= summ\n\n return L, D", "metadata": "root.SparseMatrix._LDL_sparse", "header": "['class', 'SparseMatrix', '(', 'MatrixBase', ')', ':', '___EOS___']", "index": 800 } ]
[ { "span": "i == j:", "start_line": 824, "start_column": 21, "end_line": 824, "end_column": 27 } ]
[ { "span": "i != j:", "start_line": 809, "start_column": 19, "end_line": 809, "end_column": 25 } ]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "class_", "Spar", "se", "Matrix_", "(_", "Matrix", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "LD", "L", "\\u", "sparse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Algorit", "hm", " ", "for", " ", "numeri", "c", " ", "LD", "L", " ", "fact", "izatio", "n", ",", " ", "exploit", "ing", " ", "spars", "e", " ", "structure", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Lr", "ow", "struc", "_", "=_", "self_", "._", "row", "\\u", "structure", "\\u", "symbolic", "\\u", "choles", "ky_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "=_", "self_", "._", "eye_", "(_", "self_", "._", "rows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "D_", "=_", "self_", "._", "zeros_", "(_", "self_", "._", "rows_", ",_", "self_", "._", "cols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "Lr", "ow", "struc", "_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "Lr", "ow", "struc", "_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "!=_", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "L_", "[_", "i_", ",_", "j_", "]_", "=_", "self_", "[_", "i_", ",_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "summ", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p1_", "in_", "Lr", "ow", "struc", "_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "p1_", "<_", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "p2_", "in_", "Lr", "ow", "struc", "_", "[_", "j_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "p2_", "<_", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "p1_", "==_", "p2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " ", " _", "summ", "_", "+=_", "L_", "[_", "i_", ",_", "p1_", "]_", "*_", "L_", "[_", "j_", ",_", "p1_", "]_", "*_", "D_", "[_", "p1_", ",_", "p1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "L_", "[_", "i_", ",_", "j_", "]_", "-=_", "summ", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L_", "[_", "i_", ",_", "j_", "]_", "/=_", "D_", "[_", "j_", ",_", "j_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "i_", "==_", "j_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "D_", "[_", "i_", ",_", "i_", "]_", "=_", "self_", "[_", "i_", ",_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "summ", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "Lr", "ow", "struc", "_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "k_", "<_", "i_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "summ", "_", "+=_", "L_", "[_", "i_", ",_", "k_", "]_", "**_", "2_", "*_", "D_", "[_", "k_", ",_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "D_", "[_", "i_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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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
JuhaniImberg/tmc.py/tmc/exercise_tests/__init__.py
[ { "content": "import tmc.exercise_tests.basetest\nimport tmc.exercise_tests.check\nimport tmc.exercise_tests.java\nimport tmc.exercise_tests.gtest\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import tmc.exercise_tests.basetest", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 34 }, { "span": "import tmc.exercise_tests.check", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 31 }, { "span": "import tmc.exercise_tests.java", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 30 }, { "span": "import tmc.exercise_tests.gtest", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "tm", "c_", "._", "exercise", "\\u", "tests_", "._", "base", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tm", "c_", "._", "exercise", "\\u", "tests_", "._", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tm", "c_", "._", "exercise", "\\u", "tests_", "._", "java_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tm", "c_", "._", "exercise", "\\u", "tests_", "._", "gte", "st_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Variable defined multiple times
tgonzales/mingus/mingus/resources.py
[ { "content": " @tornado.gen.coroutine\n def bulk(self):\n params = self.params.getParams()\n data = params['bulk']\n try:\n bulk = self.collection.initialize_ordered_bulk_op()\n data = params['bulk']\n if 'insert' in data:\n for obj in data['insert']:\n obj['created'] = datetime.datetime.utcnow()\n obj['_id'] = ObjectId()\n bulk.insert(obj)\n result = yield bulk.execute()\n except BulkWriteError as e:\n self.setResponseDictErrors(e)\n\n '''\n bulk = self.collection.initialize_ordered_bulk_op()\n # Remove all documents from the previous example.\n bulk.find({}).remove()\n for i in range(10000):\n bulk.insert({'_id': i})\n #bulk.insert({'_id': 2})\n #bulk.insert({'_id': 3})\n bulk.find({'_id': 1}).update({'$set': {'foo': 'bar'}})\n bulk.find({'_id': 4}).upsert().update({'$inc': {'j': 1}})\n bulk.find({'j': 1}).replace_one({'j': 2})\n result = yield bulk.execute()\n '''", "metadata": "root.ResourceModel.bulk", "header": "['class', 'ResourceModel', '(', 'Model', ')', ':', '___EOS___']", "index": 276 } ]
[ { "span": "data ", "start_line": 279, "start_column": 8, "end_line": 279, "end_column": 12 } ]
[ { "span": "data ", "start_line": 282, "start_column": 12, "end_line": 282, "end_column": 16 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Reso", "urc", "e", "Model_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "tornado_", "._", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "bulk_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "self_", "._", "params_", "._", "get", "Params_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "params_", "[_", "'", "bul", "k", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bulk_", "=_", "self_", "._", "collection_", "._", "initialize", "\\u", "order", "ed", "\\u", "bul", "k", "\\u", "op_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "params_", "[_", "'", "bul", "k", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "insert", "'_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "obj_", "in_", "data_", "[_", "'", "insert", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "obj_", "[_", "'", "created", "'_", "]_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "[_", "'\\u", "id", "'_", "]_", "=_", "Object", "Id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bulk_", "._", "insert_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "yield_", "bulk_", "._", "execute_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Bul", "k", "Write", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "Respons", "e", "Dict", "Errors_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", " ", "=", " ", "self", ".", "collection", ".", "initialize", "\\u", "order", "ed", "\\u", "bul", "k", "\\u", "op", "()", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Remove", " ", "all", " ", "document", "s", " ", "from", " ", "the", " ", "previ", "ous", " ", "example", ".", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", ".", "find", "({})", ".", "remove", "()", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "i", " ", "in", " ", "range", "(", "10000", "):", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", ".", "insert", "({", "'\\u", "id", "':", " ", "i", "})", "\\", "10", ";", " ", " ", " ", " ", "#", "bul", "k", ".", "insert", "({", "'\\u", "id", "':", " ", "2", "})", "\\", "10", ";", " ", " ", " ", " ", "#", "bul", "k", ".", "insert", "({", "'\\u", "id", "':", " ", "3", "})", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", ".", "find", "({", "'\\u", "id", "':", " ", "1", "}).", "update", "({", "'$", "set", "':", " ", "{", "'", "foo", "':", " ", "'", "bar", "'}", "})", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", ".", "find", "({", "'\\u", "id", "':", " ", "4", "}).", "upse", "rt", "()", ".", "update", "({", "'$", "inc", "':", " ", "{", "'", "j", "':", " ", "1", "}}", ")", "\\", "10", ";", " ", " ", " ", " ", "bul", "k", ".", "find", "({", "'", "j", "':", " ", "1", "}).", "replace", "\\u", "one", "({", "'", "j", "':", " ", "2", "})", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "=", " ", "yield", " ", "bul", "k", ".", "execute", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 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 ]
Unused import
operasoftware/tlsprober/cluster_manager.py
[ { "content": "# Copyright 2010-2012 Opera Software ASA \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\nimport libinit\nimport probedb.standalone\nimport probedb.cluster.models as Cluster\nimport probedb.scanner.models as Scanner\nimport os,time,subprocess,datetime\nfrom optparse import OptionParser\nfrom django.db import connection,transaction\n\n\nmain()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@transaction.commit_manually\ndef main():\n\t\"\"\"Main management handler on each cluster, checks every 10 minutes for new tasks\"\"\"\n\n\n\tcomputername = os.environ.get('COMPUTERNAME',\"any\").lower()\n\tif computername == \"any\":\n\t\tcomputername = os.environ.get('HOSTNAME',\"any\").lower()\n\tif computername == \"any\":\n\t\traise Exception(\"Computername was empty\")\n\t\n\tcomputername = computername.partition('.')[0]\n\t\n\toptions_config = OptionParser()\n\t\n\toptions_config.add_option(\"--testbase2\", action=\"store_true\", dest=\"use_testbase2\")\n\toptions_config.add_option(\"--verbose\", action=\"store_true\", dest=\"verbose\")\n\toptions_config.add_option(\"--persistent\", action=\"store_true\", dest=\"persistent\")\n\toptions_config.add_option(\"--nogit\", action=\"store_true\", dest=\"nogit\")\n\t\n\t\n\t(options, args) = options_config.parse_args()\n\t\n\twhile True:\n\t\tmaster_configuration,created = Cluster.ClusterNode.objects.get_or_create(hostname = \"tlsprober-cluster\", defaults={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"probe_parameters\":\"not used\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#\"result_parameters\":\"not used\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"active_node\":True,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})\n\t\tconfiguration,created = Cluster.ClusterNode.objects.get_or_create(hostname = computername, defaults={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"probe_parameters\":\"--processes 40 --iterations 40\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#\"result_parameters\":\"--processes 10 --iterations 100\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"active_node\":True,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})\n\t\tconfiguration.save()\n\t\ttransaction.commit()\n\t\tdone_something = False\n\t\tif Cluster.ClusterRun.objects.filter(enabled=True).count() >0:\n\t\t\t\"\"\"Any enabled TLS Prober jobs?\"\"\"\n\t\t\tdone_something = True\n\t\t\tif master_configuration.active_node and configuration.active_node:\n\t\t\t\tif not options.nogit:\n\t\t\t\t\t\"\"\"Check out the code to be used\"\"\"\n\t\t\t\t\tsubprocess.call([\"git\", \"pull\",])\n\t\t\t\t\tsubprocess.call([\"git\", \"submodule\", \"update\", \"--recursive\"])\n\t\t\t\t\t\n\t\t\t\t\tmaster_branch = \"pincushion\" if options.use_testbase2 else \"master\"\n\t\t\t\t\t\t\n\t\t\t\t\trun = Cluster.ClusterRun.objects.filter(enabled=True).order_by(\"-priority\", \"entered_date\")[0]\n\t\t\t\t\tbranch = run.perform_run.branch\n\t\t\t\t\tsubprocess.call([\"git\", \"checkout\", branch if branch else master_branch])\n\t\t\t\t\tsubprocess.call([\"git\", \"submodule\", \"update\", \"--recursive\"])\n\t\t\n\t\t\t\ttry:\n\t\t\t\t\tconnection.close()\n\t\t\t\texcept:\n\t\t\t\t\tpass\n\t\t\t\t\"\"\"Start the prober on this cluster node for the job\"\"\"\n\t\t\t\tsubprocess.call([\"python\", \"-O\", \n\t\t\t\t\t\t\t\t\t\"cluster_start.py\",\n\t\t\t\t\t\t\t\t\t\t\"--performance\",\n\t\t\t\t\t\t\t\t\t\t\"--managed\"]\n\t\t\t\t\t\t\t\t\t+ ([\"--testbase2\"] if options.use_testbase2 else [])\n\t\t\t\t\t\t\t\t\t+ ([\"--verbose\"] if options.verbose else [])\n\t\t\t\t\t\t\t\t, shell=False)\n\t\t\telse:\n\t\t\t\ttry:\n\t\t\t\t\tconnection.close()\n\t\t\t\texcept:\n\t\t\t\t\tpass\n\t\t\t\ttime.sleep(30)\n\t\telse:\n\t\t\tmaster_configuration,created = Scanner.ScannerNode.objects.get_or_create(hostname = \"tlsprober-cluster\", defaults={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"scan_parameters\":\"not used\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"active_node\":True,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\tconfiguration,created = Scanner.ScannerNode.objects.get_or_create(hostname = computername, defaults={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"scan_parameters\":\"--processes 40 --iterations 40\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"active_node\":True,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})\n\t\t\tconfiguration.save()\n\t\t\ttransaction.commit()\n\t\n\t\t\tif (master_configuration.active_node and configuration.active_node and \n\t\t\t\tScanner.ScannerRun.objects.filter(enabled=True).count() >0):\n\t\t\t\t\"\"\"Any enabled Scanner jobs?\"\"\"\n\t\t\t\tdone_something = True\n\t\t\t\tif master_configuration.active_node and configuration.active_node:\n\t\t\t\t\tif not options.nogit:\n\t\t\t\t\t\t\"\"\"Check out code to be used\"\"\"\n\t\t\t\t\t\tsubprocess.call([\"git\", \"pull\",])\n\t\t\t\t\t\tsubprocess.call([\"git\", \"submodule\", \"update\", \"--recursive\"])\n\t\t\t\t\t\t\n\t\t\t\t\t\tmaster_branch = \"pincushion\" if options.use_testbase2 else \"master\"\n\t\t\t\t\t\t\t\n\t\t\t\t\t\trun = Scanner.ScannerRun.objects.filter(enabled=True).order_by(\"-priority\", \"entered_date\")[0]\n\t\t\t\t\t\tbranch = run.branch\n\t\t\t\t\t\tsubprocess.call([\"git\", \"checkout\", branch if branch else master_branch])\n\t\t\t\t\t\tsubprocess.call([\"git\", \"submodule\", \"update\", \"--recursive\"])\n\t\t\t\t\t\t\n\t\t\t\t\ttry:\n\t\t\t\t\t\tconnection.close()\n\t\t\t\t\texcept:\n\t\t\t\t\t\tpass\n\t\t\t\t\t\"\"\"Start the scanner on this node for the job\"\"\"\n\t\t\t\t\tsubprocess.call([\"python\", \"-O\", \n\t\t\t\t\t\t\t\t\t\t\"scan_start.py\",\n\t\t\t\t\t\t\t\t\t\t\t\"--performance\",\n\t\t\t\t\t\t\t\t\t\t\t\"--managed\"]\n\t\t\t\t\t\t\t\t\t\t+ ([\"--testbase2\"] if options.use_testbase2 else [])\n\t\t\t\t\t\t\t\t\t\t+ ([\"--verbose\"] if options.verbose else [])\n\t\t\t\t\t\t\t\t\t, cwd = \"scan\"\n\t\t\t\t\t\t\t\t\t, shell=False)\n\t\t\t\telse:\n\t\t\t\t\ttry:\n\t\t\t\t\t\tconnection.close()\n\t\t\t\t\texcept:\n\t\t\t\t\t\tpass\n\t\t\t\t\ttime.sleep(30)\n\t\t\t\n\t\tif not done_something :\n\t\t\tif not options.persistent:\t\n\t\t\t\tbreak; # exit if nothing is going on, wait 20 minutes, then recheck\n\t\t\ttry:\n\t\t\t\tconnection.close()\n\t\t\texcept:\n\t\t\t\tpass\n\t\t\ttime.sleep(10*60) # if there are no runs, sleep for 10 minutes", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 23 } ]
[ { "span": "import libinit", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 14 }, { "span": "import probedb.standalone", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 25 }, { "span": "import os,time,subprocess,datetime", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "2010", "-", "2012", " ", "Opera", " ", "Sof", "twa", "re", " ", "AS", "A", " _", "\\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_", "import_", "lib", "init_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "prob", "edb", "_", "._", "standalone", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "prob", "edb", "_", "._", "cluster_", "._", "models_", "as_", "Cluster_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "prob", "edb", "_", "._", "scanner_", "._", "models_", "as_", "Scanner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", ",_", "time_", ",_", "subprocess_", ",_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "connection_", ",_", "transaction_", "\\u\\u\\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_", "main_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "transaction_", "._", "commit", "\\u", "manu", "ally", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "\"\"\"", "Main", " ", "manage", "ment", " ", "handler", " ", "on", " ", "each", " ", "cluster", ",", " ", "checks", " ", "every", " ", "10", " ", "minute", "s", " ", "for", " ", "new", " ", "task", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "computer", "name_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "COMPUTE", "RNA", "ME", "'_", ",_", "\"", "any", "\"_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "computer", "name_", "==_", "\"", "any", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "computer", "name_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "HOSTNAME", "'_", ",_", "\"", "any", "\"_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "computer", "name_", "==_", "\"", "any", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Exception_", "(_", "\"", "Compute", "rnam", "e", " ", "was", " ", "empty", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "computer", "name_", "=_", "computer", "name_", "._", "partition_", "(_", "'.'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options", "\\u", "config_", "=_", "Optio", "n", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options", "\\u", "config_", "._", "add", "\\u", "option_", "(_", "\"--", "testb", "ase", "2", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "dest_", "=_", "\"", "use", "\\u", "testb", "ase", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options", "\\u", "config_", "._", "add", "\\u", "option_", "(_", "\"--", "verbo", "se", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "dest_", "=_", "\"", "verbo", "se", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options", "\\u", "config_", "._", "add", "\\u", "option_", "(_", "\"--", "persiste", "nt", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "dest_", "=_", "\"", "persiste", "nt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options", "\\u", "config_", "._", "add", "\\u", "option_", "(_", "\"--", "nog", "it", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "dest_", "=_", "\"", "nog", "it", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "options", "\\u", "config_", "._", "parse", "\\u", "args_", "(_", ")_", "\\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\t", "\t_", "master", "\\u", "configuration_", ",_", "created_", "=_", "Cluster_", "._", "Cluster", "Node_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "hostname_", "=_", "\"", "tls", "prob", "er", "-", "cluster", "\"_", ",_", "defaults_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prob", "e\\u", "parameter", "s", "\"_", ":_", "\"", "not", " ", "used", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "result", "\\u", "parameter", "s", "\":\"", "not", " ", "used", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "active", "\\u", "node", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "configuration_", ",_", "created_", "=_", "Cluster_", "._", "Cluster", "Node_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "hostname_", "=_", "computer", "name_", ",_", "defaults_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "prob", "e\\u", "parameter", "s", "\"_", ":_", "\"--", "process", "es", " ", "40", " ", "--", "iterati", "ons", " ", "40", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#\"", "result", "\\u", "parameter", "s", "\":\"", "--", "process", "es", " ", "10", " ", "--", "iterati", "ons", " ", "100", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "active", "\\u", "node", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "configuration_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "e\\u", "something_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Cluster_", "._", "Cluster", "Run_", "._", "objects_", "._", "filter_", "(_", "enabled_", "=_", "True_", ")_", "._", "count_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "\"\"\"", "Any", " ", "enable", "d", " ", "TLS", " ", "Probe", "r", " ", "jobs", "?\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "e\\u", "something_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "master", "\\u", "configuration_", "._", "active", "\\u", "node_", "and_", "configuration_", "._", "active", "\\u", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "not_", "options_", "._", "nog", "it_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "\"\"\"", "Check", " ", "out", " ", "the", " ", "code", " ", "to", " ", "be", " ", "used", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "[_", "\"", "git", "\"_", ",_", "\"", "pull", "\"_", ",_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "[_", "\"", "git", "\"_", ",_", "\"", "submodule", "\"_", ",_", "\"", "update", "\"_", ",_", "\"--", "recurs", "ive", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "branch_", "=_", "\"", "pin", "cus", "hio", "n", "\"_", "if_", "options_", "._", "use", "\\u", "testb", "ase", "2_", "else_", "\"", "master", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "=_", "Cluster_", "._", "Cluster", "Run_", "._", "objects_", "._", "filter_", "(_", "enabled_", "=_", "True_", ")_", "._", "order", "\\u", "by_", "(_", "\"-", "priorit", "y", "\"_", ",_", "\"", "enter", "ed", "\\u", "date", "\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "=_", "run_", "._", "perform", "\\u", "run_", "._", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "[_", "\"", "git", "\"_", ",_", "\"", "check", "out", "\"_", ",_", "branch_", "if_", "branch_", "else_", "master", "\\u", "branch_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "[_", "\"", "git", "\"_", ",_", "\"", "submodule", "\"_", ",_", "\"", "update", "\"_", ",_", "\"--", "recurs", "ive", "\"_", "]_", ")_", "\\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\t", "\t\t\t\t_", "connection_", "._", "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\t", "\t\t\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\"\"\"", "Start", " ", "the", " ", "prob", "er", " ", "on", " ", "this", " ", "cluster", " ", "node", " ", "for", " ", "the", " ", "job", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "[_", "\"", "python", "\"_", ",_", "\"-", "O", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cluster", "\\u", "start", ".", "py", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "perform", "anc", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "manage", "d", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "(_", "[_", "\"--", "testb", "ase", "2", "\"_", "]_", "if_", "options_", "._", "use", "\\u", "testb", "ase", "2_", "else_", "[_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "(_", "[_", "\"--", "verbo", "se", "\"_", "]_", "if_", "options_", "._", "verbose_", "else_", "[_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "shell_", "=_", "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\t", "\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "connection_", "._", "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\t", "\t\t\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "30_", ")_", "\\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\t", "\t\t_", "master", "\\u", "configuration_", ",_", "created_", "=_", "Scanner_", "._", "Scann", "er", "Node_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "hostname_", "=_", "\"", "tls", "prob", "er", "-", "cluster", "\"_", ",_", "defaults_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "scan", "\\u", "parameter", "s", "\"_", ":_", "\"", "not", " ", "used", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "active", "\\u", "node", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "configuration_", ",_", "created_", "=_", "Scanner_", "._", "Scann", "er", "Node_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "hostname_", "=_", "computer", "name_", ",_", "defaults_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "scan", "\\u", "parameter", "s", "\"_", ":_", "\"--", "process", "es", " ", "40", " ", "--", "iterati", "ons", " ", "40", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "active", "\\u", "node", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "configuration_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transaction_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "master", "\\u", "configuration_", "._", "active", "\\u", "node_", "and_", "configuration_", "._", "active", "\\u", "node_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "Scanner_", "._", "Scann", "er", "Run_", "._", "objects_", "._", "filter_", "(_", "enabled_", "=_", "True_", ")_", "._", "count_", "(_", ")_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "\"\"\"", "Any", " ", "enable", "d", " ", "Scann", "er", " ", "jobs", "?\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "e\\u", "something_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "master", "\\u", "configuration_", "._", "active", "\\u", "node_", "and_", "configuration_", "._", "active", "\\u", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "not_", "options_", "._", "nog", "it_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "\"\"\"", "Check", " ", "out", " ", "code", " ", "to", " ", "be", " ", "used", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "[_", "\"", "git", "\"_", ",_", "\"", "pull", "\"_", ",_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "[_", "\"", "git", "\"_", ",_", "\"", "submodule", "\"_", ",_", "\"", "update", "\"_", ",_", "\"--", "recurs", "ive", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "branch_", "=_", "\"", "pin", "cus", "hio", "n", "\"_", "if_", "options_", "._", "use", "\\u", "testb", "ase", "2_", "else_", "\"", "master", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "=_", "Scanner_", "._", "Scann", "er", "Run_", "._", "objects_", "._", "filter_", "(_", "enabled_", "=_", "True_", ")_", "._", "order", "\\u", "by_", "(_", "\"-", "priorit", "y", "\"_", ",_", "\"", "enter", "ed", "\\u", "date", "\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch_", "=_", "run_", "._", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "[_", "\"", "git", "\"_", ",_", "\"", "check", "out", "\"_", ",_", "branch_", "if_", "branch_", "else_", "master", "\\u", "branch_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "[_", "\"", "git", "\"_", ",_", "\"", "submodule", "\"_", ",_", "\"", "update", "\"_", ",_", "\"--", "recurs", "ive", "\"_", "]_", ")_", "\\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\t", "\t\t\t\t\t_", "connection_", "._", "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\t", "\t\t\t\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\"\"\"", "Start", " ", "the", " ", "scanner", " ", "on", " ", "this", " ", "node", " ", "for", " ", "the", " ", "job", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "call_", "(_", "[_", "\"", "python", "\"_", ",_", "\"-", "O", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "scan", "\\u", "start", ".", "py", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "perform", "anc", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"--", "manage", "d", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "(_", "[_", "\"--", "testb", "ase", "2", "\"_", "]_", "if_", "options_", "._", "use", "\\u", "testb", "ase", "2_", "else_", "[_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "(_", "[_", "\"--", "verbo", "se", "\"_", "]_", "if_", "options_", "._", "verbose_", "else_", "[_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "cwd_", "=_", "\"", "scan", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ",_", "shell_", "=_", "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\t", "\t\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "connection_", "._", "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\t", "\t\t\t\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "don", "e\\u", "something_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "not_", "options_", "._", "persistent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "break_", ";_", "#", " ", "exit", " ", "if", " ", "not", "hing", " ", "is", " ", "goi", "ng", " ", "on", ",", " ", "wait", " ", "20", " ", "minute", "s", ",", " ", "then", " ", "rech", "eck", "_", "\\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\t", "\t\t\t_", "connection_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
uwdata/termite-visualizations/web2py/gluon/contrib/pysimplesoap/client.py
[ { "content": " def __init__(self, location = None, action = None, namespace = None,\n cert = None, trace = False, exceptions = True, proxy = None, ns=False, \n soap_ns=None, wsdl = None, cache = False, cacert=None,\n sessions=False, soap_server=None, timeout=_USE_GLOBAL_DEFAULT,\n http_headers={}\n ):\n \"\"\"\n :param http_headers: Additional HTTP Headers; example: {'Host': 'ipsec.example.com'}\n \"\"\"\n self.certssl = cert \n self.keyssl = None \n self.location = location # server location (url)\n self.action = action # SOAP base action\n self.namespace = namespace # message \n self.trace = trace # show debug messages\n self.exceptions = exceptions # lanzar execpiones? (Soap Faults)\n self.xml_request = self.xml_response = ''\n self.http_headers = http_headers\n if not soap_ns and not ns:\n self.__soap_ns = 'soap' # 1.1\n elif not soap_ns and ns:\n self.__soap_ns = 'soapenv' # 1.2\n else:\n self.__soap_ns = soap_ns\n \n # SOAP Server (special cases like oracle or jbossas6)\n self.__soap_server = soap_server\n \n # SOAP Header support\n self.__headers = {} # general headers\n self.__call_headers = None # OrderedDict to be marshalled for RPC Call\n \n # check if the Certification Authority Cert is a string and store it\n if cacert and cacert.startswith(\"-----BEGIN CERTIFICATE-----\"):\n fd, filename = tempfile.mkstemp()\n f = os.fdopen(fd, 'w+b', -1)\n if self.trace: log.info(u\"Saving CA certificate to %s\" % filename)\n f.write(cacert)\n cacert = filename\n f.close()\n self.cacert = cacert\n \n if timeout is _USE_GLOBAL_DEFAULT:\n timeout = TIMEOUT\n else:\n timeout = timeout\n\n # Create HTTP wrapper\n Http = get_Http()\n self.http = Http(timeout=timeout, cacert=cacert, proxy=proxy, sessions=sessions)\n \n self.__ns = ns # namespace prefix or False to not use it\n if not ns:\n self.__xml = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n<%(soap_ns)s:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n xmlns:%(soap_ns)s=\"%(soap_uri)s\">\n<%(soap_ns)s:Header/>\n<%(soap_ns)s:Body>\n <%(method)s xmlns=\"%(namespace)s\">\n </%(method)s>\n</%(soap_ns)s:Body>\n</%(soap_ns)s:Envelope>\"\"\"\n else:\n self.__xml = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<%(soap_ns)s:Envelope xmlns:%(soap_ns)s=\"%(soap_uri)s\" xmlns:%(ns)s=\"%(namespace)s\">\n<%(soap_ns)s:Header/>\n<%(soap_ns)s:Body>\n <%(ns)s:%(method)s>\n </%(ns)s:%(method)s>\n</%(soap_ns)s:Body>\n</%(soap_ns)s:Envelope>\"\"\"\n\n # parse wsdl url\n self.services = wsdl and self.wsdl_parse(wsdl, debug=trace, cache=cache) \n self.service_port = None # service port for late binding", "metadata": "root.SoapClient.__init__", "header": "['class', 'SoapClient', '(', 'object', ')', ':', '___EOS___']", "index": 64 }, { "content": " def wsdl_call(self, method, *args, **kwargs):\n \"Pre and post process SOAP call, input and output parameters using WSDL\"\n soap_uri = soap_namespaces[self.__soap_ns]\n operation = self.get_operation(method)\n # get i/o type declarations:\n input = operation['input']\n output = operation['output']\n header = operation.get('header')\n if 'action' in operation:\n self.action = operation['action']\n # sort parameters (same order as xsd:sequence)\n def sort_dict(od, d):\n if isinstance(od, dict):\n ret = OrderedDict()\n for k in od.keys():\n v = d.get(k)\n # don't append null tags!\n if v is not None:\n if isinstance(v, dict):\n v = sort_dict(od[k], v)\n elif isinstance(v, list):\n v = [sort_dict(od[k][0], v1) \n for v1 in v]\n ret[str(k)] = v \n return ret\n else:\n return d\n # construct header and parameters\n if header:\n self.__call_headers = sort_dict(header, self.__headers)\n if input and args:\n # convert positional parameters to named parameters:\n d = [(k, arg) for k, arg in zip(input.values()[0].keys(), args)]\n kwargs.update(dict(d))\n if input and kwargs:\n params = sort_dict(input.values()[0], kwargs).items()\n if self.__soap_server == \"axis\":\n # use the operation name\n method = method\n else:\n # use the message (element) name\n method = input.keys()[0]\n #elif not input:\n #TODO: no message! (see wsmtxca.dummy) \n else:\n params = kwargs and kwargs.items()\n # call remote procedure\n response = self.call(method, *params)\n # parse results:\n resp = response('Body',ns=soap_uri).children().unmarshall(output)\n return resp and resp.values()[0] # pass Response tag children", "metadata": "root.SoapClient.wsdl_call", "header": "['class', 'SoapClient', '(', 'object', ')', ':', '___EOS___']", "index": 278 } ]
[ { "span": "timeout = timeout", "start_line": 109, "start_column": 12, "end_line": 109, "end_column": 29 }, { "span": "method = method", "start_line": 316, "start_column": 16, "end_line": 316, "end_column": 31 } ]
[]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "class_", "So", "ap", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "location_", "=_", "None_", ",_", "action_", "=_", "None_", ",_", "namespace_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert_", "=_", "None_", ",_", "trace_", "=_", "False_", ",_", "exceptions_", "=_", "True_", ",_", "proxy_", "=_", "None_", ",_", "ns_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "soap", "\\u", "ns_", "=_", "None_", ",_", "ws", "dl_", "=_", "None_", ",_", "cache_", "=_", "False_", ",_", "cacert", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sessions_", "=_", "False_", ",_", "soap", "\\u", "server_", "=_", "None_", ",_", "timeout_", "=_", "\\u", "USE", "\\u", "GLOB", "AL", "\\u", "DEFAULT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "http", "\\u", "headers_", "=_", "{_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "http", "\\u", "header", "s", ":", " ", "Addition", "al", " ", "HTTP", " ", "Head", "ers", ";", " ", "example", ":", " ", "{", "'", "Host", "':", " ", "'", "ipsec", ".", "example", ".", "com", "'}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cert", "ssl_", "=_", "cert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "keys", "sl_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "location_", "=_", "location_", "#", " ", "server", " ", "location", " ", "(", "url", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "action_", "=_", "action_", "#", " ", "SOA", "P", " ", "base", " ", "action_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "namespace_", "=_", "namespace_", "#", " ", "message", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "trace_", "=_", "trace_", "#", " ", "show", " ", "debug", " ", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exceptions_", "=_", "exceptions_", "#", " ", "lan", "zar", " ", "exec", "pio", "nes", "?", " ", "(", "So", "ap", " ", "Fau", "lts", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "xml", "\\u", "request_", "=_", "self_", "._", "xml", "\\u", "response_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "http", "\\u", "headers_", "=_", "http", "\\u", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "soap", "\\u", "ns_", "and_", "not_", "ns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "soap", "\\u", "ns_", "=_", "'", "soap", "'_", "#", " ", "1.1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "soap", "\\u", "ns_", "and_", "ns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "soap", "\\u", "ns_", "=_", "'", "soap", "env", "'_", "#", " ", "1.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 ", " _", "self_", "._", "\\u\\u", "soap", "\\u", "ns_", "=_", "soap", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOA", "P", " ", "Server", " ", "(", "special", " ", "case", "s", " ", "like", " ", "oracle", " ", "or", " ", "jbo", "ssa", "s", "6", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "soap", "\\u", "server_", "=_", "soap", "\\u", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOA", "P", " ", "Head", "er", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "headers_", "=_", "{_", "}_", "#", " ", "genera", "l", " ", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "call", "\\u", "headers_", "=_", "None_", "#", " ", "Order", "ed", "Dict", " ", "to", " ", "be", " ", "marshal", "led", " ", "for", " ", "RP", "C", " ", "Call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "the", " ", "Certificat", "ion", " ", "Author", "it", "y", " ", "Cert", " ", "is", " ", "a", " ", "string", " ", "and", " ", "store", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cacert", "_", "and_", "cacert", "_", "._", "startswith_", "(_", "\"----", "-", "BEGIN", " ", "CERT", "IFIC", "ATE", "-----", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", ",_", "filename_", "=_", "tempfile_", "._", "mkstemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "os_", "._", "fdo", "pen_", "(_", "fd_", ",_", "'", "w", "+", "b", "'_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "trace_", ":_", "log_", "._", "info_", "(_", "u", "\"", "Sav", "ing", " ", "CA", " ", "certifica", "te", " ", "to", " ", "%", "s", "\"_", "%_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "cacert", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cacert", "_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cacert", "_", "=_", "cacert", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "timeout_", "is_", "\\u", "USE", "\\u", "GLOB", "AL", "\\u", "DEFAULT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\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 ", " _", "timeout_", "=_", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "HTTP", " ", "wrapper_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Http_", "=_", "get", "\\u", "Http_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "http_", "=_", "Http_", "(_", "timeout_", "=_", "timeout_", ",_", "cacert", "_", "=_", "cacert", "_", ",_", "proxy_", "=_", "proxy_", ",_", "sessions_", "=_", "sessions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "ns_", "=_", "ns_", "#", " ", "namespace", " ", "prefix", " ", "or", " ", "Fal", "se", " ", "to", " ", "not", " ", "use", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "xml_", "=_", "\"\"\"", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "UT", "F", "-", "8", "\"?", ">", " ", "\\", "10", ";<", "%", "(", "soap", "\\u", "ns", ")", "s", ":", "Env", "elope", " ", "xml", "ns", ":", "xsi", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "-", "instance", "\"", " ", "\\", "10", ";", " ", " ", " ", " ", "xml", "ns", ":", "xsd", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "\"", " ", "\\", "10", ";", " ", " ", " ", " ", "xml", "ns", ":", "%", "(", "soap", "\\u", "ns", ")", "s", "=\"", "%", "(", "soap", "\\u", "uri", ")", "s", "\">", "\\", "10", ";<", "%", "(", "soap", "\\u", "ns", ")", "s", ":", "Head", "er", "/>", "\\", "10", ";<", "%", "(", "soap", "\\u", "ns", ")", "s", ":", "Bod", "y", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "%", "(", "method", ")", "s", " ", "xml", "ns", "=\"", "%", "(", "namespace", ")", "s", "\">", "\\", "10", ";", " ", " ", " ", " ", "</", "%", "(", "method", ")", "s", ">", "\\", "10", ";<", "/", "%", "(", "soap", "\\u", "ns", ")", "s", ":", "Bod", "y", ">", "\\", "10", ";<", "/", "%", "(", "soap", "\\u", "ns", ")", "s", ":", "Env", "elope", ">\"\"\"_", "\\u\\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\\u", "xml_", "=_", "\"\"\"", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "UT", "F", "-", "8", "\"?", ">", "\\", "10", ";<", "%", "(", "soap", "\\u", "ns", ")", "s", ":", "Env", "elope", " ", "xml", "ns", ":", "%", "(", "soap", "\\u", "ns", ")", "s", "=\"", "%", "(", "soap", "\\u", "uri", ")", "s", "\"", " ", "xml", "ns", ":", "%", "(", "ns", ")", "s", "=\"", "%", "(", "namespace", ")", "s", "\">", "\\", "10", ";<", "%", "(", "soap", "\\u", "ns", ")", "s", ":", "Head", "er", "/>", "\\", "10", ";<", "%", "(", "soap", "\\u", "ns", ")", "s", ":", "Bod", "y", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "%", "(", "ns", ")", "s", ":", "%", "(", "method", ")", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "%", "(", "ns", ")", "s", ":", "%", "(", "method", ")", "s", ">", "\\", "10", ";<", "/", "%", "(", "soap", "\\u", "ns", ")", "s", ":", "Bod", "y", ">", "\\", "10", ";<", "/", "%", "(", "soap", "\\u", "ns", ")", "s", ":", "Env", "elope", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "ws", "dl", " ", "url_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "services_", "=_", "ws", "dl_", "and_", "self_", "._", "ws", "dl", "\\u", "parse_", "(_", "ws", "dl_", ",_", "debug_", "=_", "trace_", ",_", "cache_", "=_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "service", "\\u", "port_", "=_", "None_", "#", " ", "service", " ", "port", " ", "for", " ", "late", " ", "binding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "So", "ap", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ws", "dl", "\\u", "call_", "(_", "self_", ",_", "method_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Pre", " ", "and", " ", "post", " ", "process", " ", "SOA", "P", " ", "call", ",", " ", "input", " ", "and", " ", "output", " ", "parameter", "s", " ", "usi", "ng", " ", "WS", "DL", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "soap", "\\u", "uri_", "=_", "soap", "\\u", "namespaces_", "[_", "self_", "._", "\\u\\u", "soap", "\\u", "ns_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "operation_", "=_", "self_", "._", "get", "\\u", "operation_", "(_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "i", "/", "o", " ", "type", " ", "declaration", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "input_", "=_", "operation_", "[_", "'", "input", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "operation_", "[_", "'", "output", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "operation_", "._", "get_", "(_", "'", "header", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "action", "'_", "in_", "operation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "action_", "=_", "operation_", "[_", "'", "action", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sort", " ", "parameter", "s", " ", "(", "same", " ", "order", " ", "as", " ", "xsd", ":", "sequence", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sort", "\\u", "dict_", "(_", "od_", ",_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "od_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "Order", "ed", "Dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "od_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "v_", "=_", "d_", "._", "get_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "append", " ", "null", " ", "tags", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "v_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "isinstance_", "(_", "v_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "sort", "\\u", "dict_", "(_", "od_", "[_", "k_", "]_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "v_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "[_", "sort", "\\u", "dict_", "(_", "od_", "[_", "k_", "]_", "[_", "0_", "]_", ",_", "v1_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "v1_", "in_", "v_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ret_", "[_", "str_", "(_", "k_", ")_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "construct", " ", "header", " ", "and", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "header_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "call", "\\u", "headers_", "=_", "sort", "\\u", "dict_", "(_", "header_", ",_", "self_", "._", "\\u\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "input_", "and_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "convert", " ", "positional", " ", "parameter", "s", " ", "to", " ", "named", " ", "parameter", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "[_", "(_", "k_", ",_", "arg_", ")_", "for_", "k_", ",_", "arg_", "in_", "zip_", "(_", "input_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "._", "keys_", "(_", ")_", ",_", "args_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "dict_", "(_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "input_", "and_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "sort", "\\u", "dict_", "(_", "input_", "._", "values_", "(_", ")_", "[_", "0_", "]_", ",_", "kwargs_", ")_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u\\u", "soap", "\\u", "server_", "==_", "\"", "axis", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "the", " ", "operati", "on", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "the", " ", "message", " ", "(", "element", ")", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", "=_", "input_", "._", "keys_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "eli", "f", " ", "not", " ", "input", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", ":", " ", "no", " ", "message", "!", " ", "(", "see", " ", "wsm", "tx", "ca", ".", "dummy", ")", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "kwargs_", "and_", "kwargs_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "call", " ", "remote", " ", "procedure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "call_", "(_", "method_", ",_", "*_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parse", " ", "results", ":_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "response_", "(_", "'", "Bod", "y", "'_", ",_", "ns_", "=_", "soap", "\\u", "uri_", ")_", "._", "children_", "(_", ")_", "._", "unma", "rsh", "all_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "resp_", "and_", "resp_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "#", " ", "pass", " ", "Respons", "e", " ", "tag", " ", "children_", "\\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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2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
ejeschke/ginga/ginga/misc/plugins/Pick.py
[ { "content": " def plot_contours(self, image):\n # Make a contour plot\n\n ht, wd = self.pick_data.shape\n\n # If size of pick region is too large, carve out a subset around\n # the picked object coordinates for plotting contours\n maxsize = max(ht, wd)\n if maxsize > self.contour_size_limit:\n radius = int(self.contour_size_limit // 2)\n x, y = self.pick_qs.x, self.pick_qs.y\n data, x1, y1, x2, y2 = image.cutout_radius(x, y, radius)\n x, y = x - x1, y - y1\n ht, wd = data.shape\n else:\n data = self.pick_data\n x, y = self.pickcenter.x, self.pickcenter.y\n\n try:\n self.contour_plot.plot_contours_data(x, y, data,\n num_contours=self.num_contours)\n\n except Exception as e:\n self.logger.error(\"Error making contour plot: %s\" % (\n str(e)))", "metadata": "root.Pick.plot_contours", "header": "['class', 'Pick', '(', 'GingaPlugin', '.', 'LocalPlugin', ')', ':', '___EOS___']", "index": 608 }, { "content": " def start(self):\n self.instructions()\n self.open_report_log()\n\n # insert layer if it is not already\n p_canvas = self.fitsimage.get_canvas()\n try:\n obj = p_canvas.get_object_by_tag(self.layertag)\n\n except KeyError:\n # Add canvas layer\n p_canvas.add(self.canvas, tag=self.layertag)\n\n self.resume()", "metadata": "root.Pick.start", "header": "['class', 'Pick', '(', 'GingaPlugin', '.', 'LocalPlugin', ')', ':', '___EOS___']", "index": 697 }, { "content": " def redo(self):\n if self.picktag is None:\n return\n\n serialnum = self.bump_serial()\n self.ev_intr.set()\n\n pickobj = self.canvas.get_object_by_tag(self.picktag)\n if pickobj.kind != 'compound':\n return True\n bbox = pickobj.objects[0]\n point = pickobj.objects[1]\n text = pickobj.objects[2]\n data_x, data_y = point.x, point.y\n #self.fitsimage.panset_xy(data_x, data_y)\n\n # set the pick image to have the same cut levels and transforms\n self.fitsimage.copy_attributes(self.pickimage,\n ['transforms', 'cutlevels',\n 'rgbmap'])\n\n try:\n image = self.fitsimage.get_image()\n\n # sanity check on region\n width = bbox.x2 - bbox.x1\n height = bbox.y2 - bbox.y1\n if (width > self.max_side) or (height > self.max_side):\n errmsg = \"Image area (%dx%d) too large!\" % (\n width, height)\n self.fv.show_error(errmsg)\n raise Exception(errmsg)\n\n # Cut and show pick image in pick window\n #self.pick_x, self.pick_y = data_x, data_y\n self.logger.debug(\"bbox %f,%f %f,%f\" % (bbox.x1, bbox.y1,\n bbox.x2, bbox.y2))\n x1, y1, x2, y2, data = self.cutdetail(self.fitsimage,\n self.pickimage,\n int(bbox.x1), int(bbox.y1),\n int(bbox.x2), int(bbox.y2))\n self.logger.debug(\"cut box %f,%f %f,%f\" % (x1, y1, x2, y2))\n\n # calculate center of pick image\n wd, ht = self.pickimage.get_data_size()\n xc = wd // 2\n yc = ht // 2\n if self.pickcenter is None:\n p_canvas = self.pickimage.get_canvas()\n tag = p_canvas.add(self.dc.Point(xc, yc, 5,\n linewidth=1, color='red'))\n self.pickcenter = p_canvas.get_object_by_tag(tag)\n\n self.pick_x1, self.pick_y1 = x1, y1\n self.pick_data = data\n self.wdetail.sample_area.set_text('%dx%d' % (x2-x1, y2-y1))\n\n point.color = 'red'\n text.text = '{0}: calc'.format(self._textlabel)\n self.pickcenter.x = xc\n self.pickcenter.y = yc\n self.pickcenter.color = 'red'\n\n # clear contour and fwhm plots\n if self.have_mpl:\n self.clear_contours()\n self.clear_fwhm()\n self.clear_radial()\n\n # Delete previous peak marks\n objs = self.canvas.getObjectsByTagpfx('peak')\n self.canvas.delete_objects(objs)\n\n # Offload this task to another thread so that GUI remains\n # responsive\n self.fv.nongui_do(self.search, serialnum, data,\n x1, y1, wd, ht, pickobj)\n\n except Exception as e:\n self.logger.error(\"Error calculating quality metrics: %s\" % (\n str(e)))\n return True", "metadata": "root.Pick.redo", "header": "['class', 'Pick', '(', 'GingaPlugin', '.', 'LocalPlugin', ')', ':', '___EOS___']", "index": 739 }, { "content": " def _make_report(self, image, qs):\n d = Bunch.Bunch()\n try:\n x, y = qs.objx, qs.objy\n equinox = float(image.get_keyword('EQUINOX', 2000.0))\n\n try:\n ra_deg, dec_deg = image.pixtoradec(x, y, coords='data')\n ra_txt, dec_txt = wcs.deg2fmt(ra_deg, dec_deg, 'str')\n\n except Exception as e:\n self.logger.warning(\"Couldn't calculate sky coordinates: %s\" % (str(e)))\n ra_deg, dec_deg = 0.0, 0.0\n ra_txt = dec_txt = 'BAD WCS'\n\n # Calculate star size from pixel pitch\n try:\n header = image.get_header()\n ((xrot, yrot),\n (cdelt1, cdelt2)) = wcs.get_xy_rotation_and_scale(header)\n\n starsize = self.iqcalc.starsize(qs.fwhm_x, cdelt1,\n qs.fwhm_y, cdelt2)\n except Exception as e:\n self.logger.warning(\"Couldn't calculate star size: %s\" % (str(e)))\n starsize = 0.0\n\n rpt_x = x + self.pixel_coords_offset\n rpt_y = y + self.pixel_coords_offset\n\n # make a report in the form of a dictionary\n d.setvals(x = rpt_x, y = rpt_y,\n ra_deg = ra_deg, dec_deg = dec_deg,\n ra_txt = ra_txt, dec_txt = dec_txt,\n equinox = equinox,\n fwhm = qs.fwhm,\n fwhm_x = qs.fwhm_x, fwhm_y = qs.fwhm_y,\n ellipse = qs.elipse, background = qs.background,\n skylevel = qs.skylevel, brightness = qs.brightness,\n starsize = starsize,\n time_local = time.strftime(\"%Y-%m-%d %H:%M:%S\",\n time.localtime()),\n time_ut = time.strftime(\"%Y-%m-%d %H:%M:%S\",\n time.gmtime()),\n )\n except Exception as e:\n self.logger.error(\"Error making report: %s\" % (str(e)))\n\n return d", "metadata": "root.Pick._make_report", "header": "['class', 'Pick', '(', 'GingaPlugin', '.', 'LocalPlugin', ')', ':', '___EOS___']", "index": 881 }, { "content": " def update_pick(self, serialnum, objlist, qs, x1, y1, wd, ht, pickobj, msg):\n if serialnum != self.get_serial():\n return\n\n try:\n image = self.fitsimage.get_image()\n point = pickobj.objects[1]\n text = pickobj.objects[2]\n text.text = self._textlabel\n\n if msg is not None:\n raise Exception(msg)\n\n # Mark new peaks, if desired\n if self.show_candidates:\n for obj in objlist:\n tag = self.canvas.add(self.dc.Point(x1+obj.objx,\n y1+obj.objy,\n 5,\n linewidth=1,\n color=self.candidate_color),\n tagpfx='peak')\n\n # Add back in offsets into image to get correct values with respect\n # to the entire image\n qs.x += x1\n qs.y += y1\n qs.objx += x1\n qs.objy += y1\n\n # Calculate X/Y of center of star\n obj_x = qs.objx\n obj_y = qs.objy\n fwhm = qs.fwhm\n fwhm_x, fwhm_y = qs.fwhm_x, qs.fwhm_y\n point.x, point.y = obj_x, obj_y\n text.color = 'cyan'\n\n # Make report\n self.last_rpt = self._make_report(image, qs)\n d = self.last_rpt\n if self.do_record:\n self.add_pick_cb()\n\n self.wdetail.fwhm_x.set_text('%.3f' % fwhm_x)\n self.wdetail.fwhm_y.set_text('%.3f' % fwhm_y)\n self.wdetail.fwhm.set_text('%.3f' % fwhm)\n self.wdetail.object_x.set_text('%.3f' % (d.x))\n self.wdetail.object_y.set_text('%.3f' % (d.y))\n self.wdetail.sky_level.set_text('%.3f' % qs.skylevel)\n self.wdetail.background.set_text('%.3f' % qs.background)\n self.wdetail.brightness.set_text('%.3f' % qs.brightness)\n self.wdetail.ra.set_text(d.ra_txt)\n self.wdetail.dec.set_text(d.dec_txt)\n self.wdetail.equinox.set_text(str(d.equinox))\n self.wdetail.star_size.set_text('%.3f' % d.starsize)\n\n self.w.btn_sky_cut.set_enabled(True)\n self.w.btn_bright_cut.set_enabled(True)\n\n # Mark center of object on pick image\n i1 = point.x - x1\n j1 = point.y - y1\n self.pickcenter.x = i1\n self.pickcenter.y = j1\n self.pickcenter.color = 'cyan'\n self.pick_qs = qs\n self.pickimage.panset_xy(i1, j1)\n\n # Mark object center on image\n point.color = 'cyan'\n #self.fitsimage.panset_xy(obj_x, obj_y)\n\n self.update_status(\"Done\")\n self.plot_panx = float(i1) / wd\n self.plot_pany = float(j1) / ht\n if self.have_mpl:\n self.plot_contours(image)\n self.plot_fwhm(qs, image)\n self.plot_radial(qs, image)\n\n except Exception as e:\n errmsg = \"Error calculating quality metrics: %s\" % (\n str(e))\n self.logger.error(errmsg)\n self.fv.show_error(errmsg, raisetab=False)\n #self.update_status(\"Error\")\n for key in ('sky_level', 'background', 'brightness',\n 'star_size', 'fwhm_x', 'fwhm_y'):\n self.wdetail[key].set_text('')\n self.wdetail.fwhm.set_text('Failed')\n self.w.btn_sky_cut.set_enabled(False)\n self.w.btn_bright_cut.set_enabled(False)\n self.pick_qs = None\n text.color = 'red'\n\n self.plot_panx = self.plot_pany = 0.5\n #self.plot_contours(image)\n # TODO: could calc background based on numpy calc\n\n self.w.btn_intr_eval.set_enabled(False)\n self.pickimage.redraw(whence=3)\n self.canvas.redraw(whence=3)\n\n self.fv.showStatus(\"Click left mouse button to reposition pick\")\n return True", "metadata": "root.Pick.update_pick", "header": "['class', 'Pick', '(', 'GingaPlugin', '.', 'LocalPlugin', ')', ':', '___EOS___']", "index": 931 }, { "content": " def btndown(self, canvas, event, data_x, data_y, viewer):\n try:\n obj = self.canvas.get_object_by_tag(self.picktag)\n if obj.kind == 'rectangle':\n bbox = obj\n else:\n bbox = obj.objects[0]\n point = obj.objects[1]\n self.dx = (bbox.x2 - bbox.x1) // 2\n self.dy = (bbox.y2 - bbox.y1) // 2\n except Exception as e:\n pass\n\n dx = self.dx\n dy = self.dy\n\n # Mark center of object and region on main image\n try:\n self.canvas.delete_object_by_tag(self.picktag)\n except:\n pass\n\n x1, y1 = data_x - dx, data_y - dy\n x2, y2 = data_x + dx, data_y + dy\n\n tag = self.canvas.add(self.dc.Rectangle(x1, y1, x2, y2,\n color='cyan',\n linestyle='dash'))\n self.picktag = tag\n\n #self.draw_cb(self.canvas, tag)\n return True", "metadata": "root.Pick.btndown", "header": "['class', 'Pick', '(', 'GingaPlugin', '.', 'LocalPlugin', ')', ':', '___EOS___']", "index": 1041 }, { "content": " def update(self, canvas, event, data_x, data_y, viewer):\n try:\n obj = self.canvas.get_object_by_tag(self.picktag)\n if obj.kind == 'rectangle':\n bbox = obj\n else:\n bbox = obj.objects[0]\n point = obj.objects[1]\n self.dx = (bbox.x2 - bbox.x1) // 2\n self.dy = (bbox.y2 - bbox.y1) // 2\n except Exception as e:\n obj = None\n pass\n\n dx = self.dx\n dy = self.dy\n\n x1, y1 = data_x - dx, data_y - dy\n x2, y2 = data_x + dx, data_y + dy\n\n if (not obj) or (obj.kind == 'compound'):\n # Replace compound image with rectangle\n try:\n self.canvas.delete_object_by_tag(self.picktag)\n except:\n pass\n\n tag = self.canvas.add(self.dc.Rectangle(x1, y1, x2, y2,\n color='cyan',\n linestyle='dash'))\n else:\n # Update current rectangle with new coords\n bbox.x1, bbox.y1, bbox.x2, bbox.y2 = x1, y1, x2, y2\n tag = self.picktag\n\n self.draw_cb(self.canvas, tag)\n return True", "metadata": "root.Pick.update", "header": "['class', 'Pick', '(', 'GingaPlugin', '.', 'LocalPlugin', ')', ':', '___EOS___']", "index": 1074 } ]
[ { "span": "ht,", "start_line": 621, "start_column": 12, "end_line": 621, "end_column": 14 }, { "span": "wd ", "start_line": 621, "start_column": 16, "end_line": 621, "end_column": 18 }, { "span": "obj ", "start_line": 704, "start_column": 12, "end_line": 704, "end_column": 15 }, { "span": "data_x,", "start_line": 752, "start_column": 8, "end_line": 752, "end_column": 14 }, { "span": "data_y ", "start_line": 752, "start_column": 16, "end_line": 752, "end_column": 22 }, { "span": "image ", "start_line": 761, "start_column": 12, "end_line": 761, "end_column": 17 }, { "span": "xrot,", "start_line": 899, "start_column": 18, "end_line": 899, "end_column": 22 }, { "span": "yrot)", "start_line": 899, "start_column": 24, "end_line": 899, "end_column": 28 }, { "span": "tag ", "start_line": 947, "start_column": 20, "end_line": 947, "end_column": 23 }, { "span": "point ", "start_line": 1048, "start_column": 16, "end_line": 1048, "end_column": 21 }, { "span": "point ", "start_line": 1081, "start_column": 16, "end_line": 1081, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Pick", "_", "(_", "Gi", "nga", "Plugin_", "._", "Local", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plot", "\\u", "contours_", "(_", "self_", ",_", "image_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "conto", "ur", " ", "plot_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ht_", ",_", "wd_", "=_", "self_", "._", "pick", "\\u", "data_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "size", " ", "of", " ", "pick", " ", "region", " ", "is", " ", "too", " ", "large", ",", " ", "car", "ve", " ", "out", " ", "a", " ", "subse", "t", " ", "around_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "picked", " ", "object", " ", "coordinate", "s", " ", "for", " ", "plott", "ing", " ", "contours_", "\\u\\u\\uNL\\u\\u\\u_", "maxsize_", "=_", "max_", "(_", "ht_", ",_", "wd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "maxsize_", ">_", "self_", "._", "conto", "ur\\u", "size", "\\u", "limit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "radius_", "=_", "int_", "(_", "self_", "._", "conto", "ur\\u", "size", "\\u", "limit_", "//_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "self_", "._", "pick", "\\u", "qs_", "._", "x_", ",_", "self_", "._", "pick", "\\u", "qs_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", ",_", "x1_", ",_", "y1_", ",_", "x2_", ",_", "y2_", "=_", "image_", "._", "cuto", "ut", "\\u", "radius_", "(_", "x_", ",_", "y_", ",_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "x_", "-_", "x1_", ",_", "y_", "-_", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ht_", ",_", "wd_", "=_", "data_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "pick", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "self_", "._", "pick", "center_", "._", "x_", ",_", "self_", "._", "pick", "center_", "._", "y_", "\\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_", "._", "conto", "ur\\u", "plot_", "._", "plot", "\\u", "contours", "\\u", "data_", "(_", "x_", ",_", "y_", ",_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "contours_", "=_", "self_", "._", "num", "\\u", "contours_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "\"", "Error", " ", "mak", "ing", " ", "conto", "ur", " ", "plot", ":", " ", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pick", "_", "(_", "Gi", "nga", "Plugin_", "._", "Local", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "instructions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "open", "\\u", "report", "\\u", "log_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "insert", " ", "layer", " ", "if", " ", "it", " ", "is", " ", "not", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "canvas_", "=_", "self_", "._", "fits", "image_", "._", "get", "\\u", "canvas_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "p", "\\u", "canvas_", "._", "get", "\\u", "object\\u", "by", "\\u", "tag_", "(_", "self_", "._", "layer", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "canv", "as", " ", "layer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p", "\\u", "canvas_", "._", "add_", "(_", "self_", "._", "canvas_", ",_", "tag_", "=_", "self_", "._", "layer", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "resume_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pick", "_", "(_", "Gi", "nga", "Plugin_", "._", "Local", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "redo", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "pick", "tag_", "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_", "serial", "num_", "=_", "self_", "._", "bump", "\\u", "serial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ev", "\\u", "intr", "_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pick", "obj_", "=_", "self_", "._", "canvas_", "._", "get", "\\u", "object\\u", "by", "\\u", "tag_", "(_", "self_", "._", "pick", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pick", "obj_", "._", "kind_", "!=_", "'", "compo", "und", "'_", ":_", "\\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_", "bbox_", "=_", "pick", "obj_", "._", "objects_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point_", "=_", "pick", "obj_", "._", "objects_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "pick", "obj_", "._", "objects_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "x_", ",_", "data\\u", "y_", "=_", "point_", "._", "x_", ",_", "point_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "fits", "image", ".", "pan", "set\\u", "xy", "(", "data\\u", "x", ",", " ", "data\\u", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "pick", " ", "image", " ", "to", " ", "have", " ", "the", " ", "same", " ", "cut", " ", "level", "s", " ", "and", " ", "transforms_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fits", "image_", "._", "copy", "\\u", "attributes_", "(_", "self_", "._", "pick", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "transform", "s", "'_", ",_", "'", "cut", "level", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rgb", "map", "'_", "]_", ")_", "\\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 ", " _", "image_", "=_", "self_", "._", "fits", "image_", "._", "get", "\\u", "image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sanity", " ", "check", " ", "on", " ", "region_", "\\u\\u\\uNL\\u\\u\\u_", "width_", "=_", "bbox_", "._", "x2_", "-_", "bbox_", "._", "x1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "bbox_", "._", "y2_", "-_", "bbox_", "._", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "width_", ">_", "self_", "._", "max", "\\u", "side_", ")_", "or_", "(_", "height_", ">_", "self_", "._", "max", "\\u", "side_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errmsg_", "=_", "\"", "Image", " ", "area", " ", "(%", "dx", "%", "d", ")", " ", "too", " ", "large", "!\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "width_", ",_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fv_", "._", "show", "\\u", "error_", "(_", "errmsg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Exception_", "(_", "errmsg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cut", " ", "and", " ", "show", " ", "pick", " ", "image", " ", "in", " ", "pick", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "pick", "\\u", "x", ",", " ", "self", ".", "pick", "\\u", "y", " ", "=", " ", "data\\u", "x", ",", " ", "data\\u", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "bbox", " ", "%", "f", ",%", "f", " ", "%", "f", ",%", "f", "\"_", "%_", "(_", "bbox_", "._", "x1_", ",_", "bbox_", "._", "y1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bbox_", "._", "x2_", ",_", "bbox_", "._", "y2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x1_", ",_", "y1_", ",_", "x2_", ",_", "y2_", ",_", "data_", "=_", "self_", "._", "cut", "detail_", "(_", "self_", "._", "fits", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pick", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "bbox_", "._", "x1_", ")_", ",_", "int_", "(_", "bbox_", "._", "y1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "int_", "(_", "bbox_", "._", "x2_", ")_", ",_", "int_", "(_", "bbox_", "._", "y2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "debug_", "(_", "\"", "cut", " ", "box", " ", "%", "f", ",%", "f", " ", "%", "f", ",%", "f", "\"_", "%_", "(_", "x1_", ",_", "y1_", ",_", "x2_", ",_", "y2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "center", " ", "of", " ", "pick", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "wd_", ",_", "ht_", "=_", "self_", "._", "pick", "image_", "._", "get", "\\u", "data\\u", "size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xc_", "=_", "wd_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yc_", "=_", "ht_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "pick", "center_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p", "\\u", "canvas_", "=_", "self_", "._", "pick", "image_", "._", "get", "\\u", "canvas_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "p", "\\u", "canvas_", "._", "add_", "(_", "self_", "._", "dc_", "._", "Point_", "(_", "xc_", ",_", "yc_", ",_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "linewidth_", "=_", "1_", ",_", "color_", "=_", "'", "red", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "center_", "=_", "p", "\\u", "canvas_", "._", "get", "\\u", "object\\u", "by", "\\u", "tag_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "pick", "\\u", "x1_", ",_", "self_", "._", "pick", "\\u", "y1_", "=_", "x1_", ",_", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "\\u", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "sample", "\\u", "area_", "._", "set\\u", "text_", "(_", "'%", "dx", "%", "d", "'_", "%_", "(_", "x2_", "-_", "x1_", ",_", "y2_", "-_", "y1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "point_", "._", "color_", "=_", "'", "red", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "._", "text_", "=_", "'{", "0", "}:", " ", "calc", "'_", "._", "format_", "(_", "self_", "._", "\\u", "textl", "abel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "center_", "._", "x_", "=_", "xc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "center_", "._", "y_", "=_", "yc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "center_", "._", "color_", "=_", "'", "red", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clear", " ", "conto", "ur", " ", "and", " ", "fwhm", " ", "plots_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "have", "\\u", "mpl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "contours_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "fwhm_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "\\u", "radial", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "previ", "ous", " ", "peak", " ", "marks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "objs_", "=_", "self_", "._", "canvas_", "._", "get", "Object", "s", "By", "Ta", "gpf", "x_", "(_", "'", "peak", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "canvas_", "._", "delete", "\\u", "objects_", "(_", "objs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Off", "load", " ", "this", " ", "task", " ", "to", " ", "anot", "her", " ", "thread", " ", "so", " ", "tha", "t", " ", "GU", "I", " ", "remains", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "respons", "ive_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fv_", "._", "non", "gui", "\\u", "do_", "(_", "self_", "._", "search_", ",_", "serial", "num_", ",_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x1_", ",_", "y1_", ",_", "wd_", ",_", "ht_", ",_", "pick", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "\"", "Error", " ", "calculati", "ng", " ", "quali", "ty", " ", "metric", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pick", "_", "(_", "Gi", "nga", "Plugin_", "._", "Local", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "make", "\\u", "report_", "(_", "self_", ",_", "image_", ",_", "qs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Bun", "ch_", "._", "Bun", "ch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", ",_", "y_", "=_", "qs_", "._", "obj", "x_", ",_", "qs_", "._", "obj", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "equi", "nox", "_", "=_", "float_", "(_", "image_", "._", "get", "\\u", "keyword_", "(_", "'", "EQU", "IN", "OX", "'_", ",_", "2000", ".0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ra", "\\u", "deg_", ",_", "dec", "\\u", "deg_", "=_", "image_", "._", "pix", "tora", "dec_", "(_", "x_", ",_", "y_", ",_", "coords_", "=_", "'", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra", "\\u", "txt_", ",_", "dec", "\\u", "txt_", "=_", "wcs_", "._", "deg", "2f", "mt_", "(_", "ra", "\\u", "deg_", ",_", "dec", "\\u", "deg_", ",_", "'", "str", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "warning_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "calcul", "ate", " ", "sky", " ", "coordinate", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra", "\\u", "deg_", ",_", "dec", "\\u", "deg_", "=_", "0.0_", ",_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ra", "\\u", "txt_", "=_", "dec", "\\u", "txt_", "=_", "'", "BAD", " ", "WC", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "star", " ", "size", " ", "from", " ", "pixel", " ", "pitch_", "\\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 ", " _", "header_", "=_", "image_", "._", "get", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "(_", "xr", "ot_", ",_", "yro", "t_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "cde", "lt", "1_", ",_", "cde", "lt", "2_", ")_", ")_", "=_", "wcs_", "._", "get", "\\u", "xy", "\\u", "rotati", "on", "\\u", "and", "\\u", "scale_", "(_", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "star", "size_", "=_", "self_", "._", "iq", "calc_", "._", "star", "size_", "(_", "qs_", "._", "fwhm", "\\u", "x_", ",_", "cde", "lt", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "qs_", "._", "fwhm", "\\u", "y_", ",_", "cde", "lt", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "warning_", "(_", "\"", "Cou", "ld", "n", "'", "t", " ", "calcul", "ate", " ", "star", " ", "size", ":", " ", "%", "s", "\"_", "%_", "(_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "star", "size_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rpt", "\\u", "x_", "=_", "x_", "+_", "self_", "._", "pixel", "\\u", "coords", "\\u", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rpt", "\\u", "y_", "=_", "y_", "+_", "self_", "._", "pixel", "\\u", "coords", "\\u", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "a", " ", "report", " ", "in", " ", "the", " ", "form", " ", "of", " ", "a", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "._", "setv", "als_", "(_", "x_", "=_", "rpt", "\\u", "x_", ",_", "y_", "=_", "rpt", "\\u", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ra", "\\u", "deg_", "=_", "ra", "\\u", "deg_", ",_", "dec", "\\u", "deg_", "=_", "dec", "\\u", "deg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ra", "\\u", "txt_", "=_", "ra", "\\u", "txt_", ",_", "dec", "\\u", "txt_", "=_", "dec", "\\u", "txt_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "equi", "nox", "_", "=_", "equi", "nox", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fwhm_", "=_", "qs_", "._", "fwhm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fwhm", "\\u", "x_", "=_", "qs_", "._", "fwhm", "\\u", "x_", ",_", "fwhm", "\\u", "y_", "=_", "qs_", "._", "fwhm", "\\u", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ellipse_", "=_", "qs_", "._", "eli", "pse", "_", ",_", "background_", "=_", "qs_", "._", "background_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sky", "level_", "=_", "qs_", "._", "sky", "level_", ",_", "brightness_", "=_", "qs_", "._", "brightness_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "star", "size_", "=_", "star", "size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "local_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "localtime_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "time", "\\u", "ut_", "=_", "time_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "time_", "._", "gmtime_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "logger_", "._", "error_", "(_", "\"", "Error", " ", "mak", "ing", " ", "report", ":", " ", "%", "s", "\"_", "%_", "(_", "str_", "(_", "e_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pick", "_", "(_", "Gi", "nga", "Plugin_", "._", "Local", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "pick_", "(_", "self_", ",_", "serial", "num_", ",_", "obj", "list_", ",_", "qs_", ",_", "x1_", ",_", "y1_", ",_", "wd_", ",_", "ht_", ",_", "pick", "obj_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "serial", "num_", "!=_", "self_", "._", "get", "\\u", "serial_", "(_", ")_", ":_", "\\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 ", " _", "image_", "=_", "self_", "._", "fits", "image_", "._", "get", "\\u", "image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point_", "=_", "pick", "obj_", "._", "objects_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "pick", "obj_", "._", "objects_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "._", "text_", "=_", "self_", "._", "\\u", "textl", "abel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "msg_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mark", " ", "new", " ", "peaks", ",", " ", "if", " ", "desired_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "show", "\\u", "candidates_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "obj_", "in_", "obj", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tag_", "=_", "self_", "._", "canvas_", "._", "add_", "(_", "self_", "._", "dc_", "._", "Point_", "(_", "x1_", "+_", "obj_", "._", "obj", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "y1_", "+_", "obj_", "._", "obj", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "linewidth_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "self_", "._", "candidate", "\\u", "color_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag", "pfx", "_", "=_", "'", "peak", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "back", " ", "in", " ", "offset", "s", " ", "int", "o", " ", "image", " ", "to", " ", "get", " ", "correct", " ", "values", " ", "with", " ", "respec", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "entire", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "qs_", "._", "x_", "+=_", "x1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "._", "y_", "+=_", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "._", "obj", "x_", "+=_", "x1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qs_", "._", "obj", "y_", "+=_", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "X", "/", "Y", " ", "of", " ", "center", " ", "of", " ", "star_", "\\u\\u\\uNL\\u\\u\\u_", "obj", "\\u", "x_", "=_", "qs_", "._", "obj", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "\\u", "y_", "=_", "qs_", "._", "obj", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fwhm_", "=_", "qs_", "._", "fwhm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fwhm", "\\u", "x_", ",_", "fwhm", "\\u", "y_", "=_", "qs_", "._", "fwhm", "\\u", "x_", ",_", "qs_", "._", "fwhm", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point_", "._", "x_", ",_", "point_", "._", "y_", "=_", "obj", "\\u", "x_", ",_", "obj", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "._", "color_", "=_", "'", "cya", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "report_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "last", "\\u", "rpt", "_", "=_", "self_", "._", "\\u", "make", "\\u", "report_", "(_", "image_", ",_", "qs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "last", "\\u", "rpt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "do", "\\u", "record_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "pick", "\\u", "cb_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "fwhm", "\\u", "x_", "._", "set\\u", "text_", "(_", "'%", ".3", "f", "'_", "%_", "fwhm", "\\u", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "fwhm", "\\u", "y_", "._", "set\\u", "text_", "(_", "'%", ".3", "f", "'_", "%_", "fwhm", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "fwhm_", "._", "set\\u", "text_", "(_", "'%", ".3", "f", "'_", "%_", "fwhm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "object\\u", "x_", "._", "set\\u", "text_", "(_", "'%", ".3", "f", "'_", "%_", "(_", "d_", "._", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "object\\u", "y_", "._", "set\\u", "text_", "(_", "'%", ".3", "f", "'_", "%_", "(_", "d_", "._", "y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "sky", "\\u", "level_", "._", "set\\u", "text_", "(_", "'%", ".3", "f", "'_", "%_", "qs_", "._", "sky", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "background_", "._", "set\\u", "text_", "(_", "'%", ".3", "f", "'_", "%_", "qs_", "._", "background_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "brightness_", "._", "set\\u", "text_", "(_", "'%", ".3", "f", "'_", "%_", "qs_", "._", "brightness_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "ra_", "._", "set\\u", "text_", "(_", "d_", "._", "ra", "\\u", "txt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "dec_", "._", "set\\u", "text_", "(_", "d_", "._", "dec", "\\u", "txt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "equi", "nox", "_", "._", "set\\u", "text_", "(_", "str_", "(_", "d_", "._", "equi", "nox", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "star", "\\u", "size_", "._", "set\\u", "text_", "(_", "'%", ".3", "f", "'_", "%_", "d_", "._", "star", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "w_", "._", "btn", "\\u", "sky", "\\u", "cut_", "._", "set\\u", "enabled_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "w_", "._", "btn", "\\u", "bright", "\\u", "cut_", "._", "set\\u", "enabled_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mark", " ", "center", " ", "of", " ", "object", " ", "on", " ", "pick", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "i1_", "=_", "point_", "._", "x_", "-_", "x1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j1_", "=_", "point_", "._", "y_", "-_", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "center_", "._", "x_", "=_", "i1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "center_", "._", "y_", "=_", "j1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "center_", "._", "color_", "=_", "'", "cya", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "\\u", "qs_", "=_", "qs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "image_", "._", "pan", "set\\u", "xy_", "(_", "i1_", ",_", "j1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mark", " ", "object", " ", "center", " ", "on", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "point_", "._", "color_", "=_", "'", "cya", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "fits", "image", ".", "pan", "set\\u", "xy", "(", "obj", "\\u", "x", ",", " ", "obj", "\\u", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update", "\\u", "status_", "(_", "\"", "Don", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plot", "\\u", "pan", "x_", "=_", "float_", "(_", "i1_", ")_", "/_", "wd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plot", "\\u", "pan", "y_", "=_", "float_", "(_", "j1_", ")_", "/_", "ht_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "have", "\\u", "mpl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "plot", "\\u", "contours_", "(_", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plot", "\\u", "fwhm_", "(_", "qs_", ",_", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plot", "\\u", "radial", "_", "(_", "qs_", ",_", "image_", ")_", "\\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_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errmsg_", "=_", "\"", "Error", " ", "calculati", "ng", " ", "quali", "ty", " ", "metric", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "logger_", "._", "error_", "(_", "errmsg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fv_", "._", "show", "\\u", "error_", "(_", "errmsg_", ",_", "raise", "tab_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "update", "\\u", "status", "(\"", "Error", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", "in_", "(_", "'", "sky", "\\u", "level", "'_", ",_", "'", "background", "'_", ",_", "'", "bright", "ness", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "star", "\\u", "size", "'_", ",_", "'", "fwhm", "\\u", "x", "'_", ",_", "'", "fwhm", "\\u", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wd", "eta", "il_", "[_", "key_", "]_", "._", "set\\u", "text_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "wd", "eta", "il_", "._", "fwhm_", "._", "set\\u", "text_", "(_", "'", "Fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "w_", "._", "btn", "\\u", "sky", "\\u", "cut_", "._", "set\\u", "enabled_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "w_", "._", "btn", "\\u", "bright", "\\u", "cut_", "._", "set\\u", "enabled_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "\\u", "qs_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "._", "color_", "=_", "'", "red", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "plot", "\\u", "pan", "x_", "=_", "self_", "._", "plot", "\\u", "pan", "y_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "plot", "\\u", "contours", "(", "image", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "coul", "d", " ", "calc", " ", "background", " ", "based", " ", "on", " ", "nump", "y", " ", "calc_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "w_", "._", "btn", "\\u", "intr", "\\u", "eval_", "._", "set\\u", "enabled_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "image_", "._", "redraw_", "(_", "whe", "nce_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "canvas_", "._", "redraw_", "(_", "whe", "nce_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "fv_", "._", "show", "Status_", "(_", "\"", "Click", " ", "left", " ", "mouse", " ", "button", " ", "to", " ", "repos", "ition", " ", "pick", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pick", "_", "(_", "Gi", "nga", "Plugin_", "._", "Local", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "btn", "down_", "(_", "self_", ",_", "canvas_", ",_", "event_", ",_", "data\\u", "x_", ",_", "data\\u", "y_", ",_", "viewer_", ")_", ":_", "\\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 ", " _", "obj_", "=_", "self_", "._", "canvas_", "._", "get", "\\u", "object\\u", "by", "\\u", "tag_", "(_", "self_", "._", "pick", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "kind_", "==_", "'", "rectangle", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bbox_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bbox_", "=_", "obj_", "._", "objects_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point_", "=_", "obj_", "._", "objects_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dx_", "=_", "(_", "bbox_", "._", "x2_", "-_", "bbox_", "._", "x1_", ")_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dy_", "=_", "(_", "bbox_", "._", "y2_", "-_", "bbox_", "._", "y1_", ")_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dx_", "=_", "self_", "._", "dx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dy_", "=_", "self_", "._", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mark", " ", "center", " ", "of", " ", "object", " ", "and", " ", "region", " ", "on", " ", "main", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "canvas_", "._", "delete", "\\u", "object\\u", "by", "\\u", "tag_", "(_", "self_", "._", "pick", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x1_", ",_", "y1_", "=_", "data\\u", "x_", "-_", "dx_", ",_", "data\\u", "y_", "-_", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", ",_", "y2_", "=_", "data\\u", "x_", "+_", "dx_", ",_", "data\\u", "y_", "+_", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "self_", "._", "canvas_", "._", "add_", "(_", "self_", "._", "dc_", "._", "Rectangle_", "(_", "x1_", ",_", "y1_", ",_", "x2_", ",_", "y2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "'", "cya", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "linestyle_", "=_", "'", "dash", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pick", "tag_", "=_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "draw", "\\u", "cb", "(", "self", ".", "canv", "as", ",", " ", "tag", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pick", "_", "(_", "Gi", "nga", "Plugin_", "._", "Local", "Plugin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "canvas_", ",_", "event_", ",_", "data\\u", "x_", ",_", "data\\u", "y_", ",_", "viewer_", ")_", ":_", "\\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 ", " _", "obj_", "=_", "self_", "._", "canvas_", "._", "get", "\\u", "object\\u", "by", "\\u", "tag_", "(_", "self_", "._", "pick", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "kind_", "==_", "'", "rectangle", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bbox_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bbox_", "=_", "obj_", "._", "objects_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "point_", "=_", "obj_", "._", "objects_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dx_", "=_", "(_", "bbox_", "._", "x2_", "-_", "bbox_", "._", "x1_", ")_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dy_", "=_", "(_", "bbox_", "._", "y2_", "-_", "bbox_", "._", "y1_", ")_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dx_", "=_", "self_", "._", "dx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dy_", "=_", "self_", "._", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x1_", ",_", "y1_", "=_", "data\\u", "x_", "-_", "dx_", ",_", "data\\u", "y_", "-_", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", ",_", "y2_", "=_", "data\\u", "x_", "+_", "dx_", ",_", "data\\u", "y_", "+_", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "obj_", ")_", "or_", "(_", "obj_", "._", "kind_", "==_", "'", "compo", "und", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Replace", " ", "compo", "und", " ", "image", " ", "with", " ", "rectangle_", "\\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 ", " _", "self_", "._", "canvas_", "._", "delete", "\\u", "object\\u", "by", "\\u", "tag_", "(_", "self_", "._", "pick", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tag_", "=_", "self_", "._", "canvas_", "._", "add_", "(_", "self_", "._", "dc_", "._", "Rectangle_", "(_", "x1_", ",_", "y1_", ",_", "x2_", ",_", "y2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "'", "cya", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "linestyle_", "=_", "'", "dash", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "current", " ", "rectangle", " ", "with", " ", "new", " ", "coords_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bbox_", "._", "x1_", ",_", "bbox_", "._", "y1_", ",_", "bbox_", "._", "x2_", ",_", "bbox_", "._", "y2_", "=_", "x1_", ",_", "y1_", ",_", "x2_", ",_", "y2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "self_", "._", "pick", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "draw", "\\u", "cb_", "(_", "self_", "._", "canvas_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Unused import
daviddrysdale/python-phonenumbers/python/tests/testdata/region_BS.py
[ { "content": "\"\"\"Auto-generated file, do not edit by hand. BS metadata\"\"\"\nfrom phonenumbers.phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata\n\nPHONE_METADATA_BS = PhoneMetadata(id='BS', country_code=1, international_prefix='011',\n general_desc=PhoneNumberDesc(national_number_pattern='(242|8(00|66|77|88)|900)\\\\d{7}', possible_number_pattern='\\\\d{7,10}'),\n fixed_line=PhoneNumberDesc(national_number_pattern='242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[3-57]|9[2-5])|4(?:2[237]|51|64|77)|502|636|702)\\\\d{4}', possible_number_pattern='\\\\d{7,10}'),\n mobile=PhoneNumberDesc(national_number_pattern='242(357|359|457|557)\\\\d{4}', possible_number_pattern='\\\\d{10}'),\n toll_free=PhoneNumberDesc(national_number_pattern='8(00|66|77|88)\\\\d{7}', possible_number_pattern='\\\\d{10}'),\n premium_rate=PhoneNumberDesc(national_number_pattern='900\\\\d{7}', possible_number_pattern='\\\\d{10}'),\n shared_cost=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),\n personal_number=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),\n voip=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),\n pager=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),\n uan=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),\n voicemail=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),\n no_international_dialling=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),\n national_prefix='1',\n national_prefix_for_parsing='1')\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from phonenumbers.phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 83 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Auto", "-", "generat", "ed", " ", "file", ",", " ", "do", " ", "not", " ", "edit", " ", "by", " ", "hand", ".", " ", "BS", " ", "metadata", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "phone", "numbers_", "._", "phoneme", "tad", "ata_", "import_", "Number", "Format_", ",_", "Phone", "Number", "Desc_", ",_", "Phone", "Metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PHONE", "\\u", "METAD", "ATA", "\\u", "BS", "_", "=_", "Phone", "Metadata_", "(_", "id_", "=_", "'", "BS", "'_", ",_", "countr", "y", "\\u", "code_", "=_", "1_", ",_", "international", "\\u", "prefix_", "=_", "'", "011", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "genera", "l\\u", "desc_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'(", "242", "|", "8", "(", "00", "|", "6", "6", "|", "7", "7", "|", "88", ")|", "900", ")\\\\\\\\", "d", "{", "7", "}'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'\\\\\\\\", "d", "{", "7", ",", "10", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fixed", "\\u", "line_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "242", "(?:", "3", "(?:", "02", "|[", "236", "][", "1", "-", "9", "]|", "4", "[", "0", "-", "24", "-", "9", "]|", "5", "[", "0", "-", "6", "8", "]|", "7", "[", "3", "-", "5", "7", "]|", "9", "[", "2", "-", "5", "])", "|", "4", "(?:", "2", "[", "237", "]|", "5", "1", "|", "64", "|", "7", "7", ")|", "502", "|", "636", "|", "702", ")\\\\\\\\", "d", "{", "4", "}'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'\\\\\\\\", "d", "{", "7", ",", "10", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mobile_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "242", "(", "357", "|", "359", "|", "457", "|", "557", ")\\\\\\\\", "d", "{", "4", "}'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'\\\\\\\\", "d", "{", "10", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tol", "l\\u", "free_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "8", "(", "00", "|", "6", "6", "|", "7", "7", "|", "88", ")\\\\\\\\", "d", "{", "7", "}'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'\\\\\\\\", "d", "{", "10", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "premium", "\\u", "rate_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "900", "\\\\\\\\", "d", "{", "7", "}'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'\\\\\\\\", "d", "{", "10", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shared", "\\u", "cost_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "persona", "l\\u", "number_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "voi", "p_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pager_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uan", "_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "voice", "mail_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "international", "\\u", "dial", "ling_", "=_", "Phone", "Number", "Desc_", "(_", "national", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ",_", "possib", "le", "\\u", "number", "\\u", "pattern_", "=_", "'", "NA", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "national", "\\u", "prefix_", "=_", "'", "1", "'_", ",_",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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 ]
Except block handles 'BaseException'
ardekantur/pyglet/pyglet/window/xlib/__init__.py
[ { "content": "# ----------------------------------------------------------------------------\n# pyglet\n# Copyright (c) 2006-2008 Alex Holkner\n# All rights reserved.\n# \n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions \n# are met:\n#\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright \n# notice, this list of conditions and the following disclaimer in\n# the documentation and/or other materials provided with the\n# distribution.\n# * Neither the name of pyglet nor the names of its\n# contributors may be used to endorse or promote products\n# derived from this software without specific prior written\n# permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n# ----------------------------------------------------------------------------\n\n__docformat__ = 'restructuredtext'\n__version__ = '$Id$'\n\nfrom ctypes import *\nimport unicodedata\nimport warnings\n\nimport pyglet\nfrom pyglet.window import WindowException, NoSuchDisplayException, \\\n MouseCursorException, MouseCursor, \\\n DefaultMouseCursor, ImageMouseCursor, BaseWindow, _PlatformEventHandler, \\\n _ViewEventHandler\nfrom pyglet.window import key\nfrom pyglet.window import mouse\nfrom pyglet.event import EventDispatcher\n\nfrom pyglet.canvas.xlib import XlibCanvas\n\nfrom pyglet.libs.x11 import xlib\nfrom pyglet.libs.x11 import cursorfont\n\nfrom pyglet.compat import asbytes\n\ntry:\n from pyglet.libs.x11 import xsync\n _have_xsync = True\nexcept:\n _have_xsync = False\n\n\nXA_CARDINAL = 6 # Xatom.h:14\n\n# Do we have the November 2000 UTF8 extension?\n_have_utf8 = hasattr(xlib._lib, 'Xutf8TextListToTextProperty')\n\n# symbol,ctrl -> motion mapping\n_motion_map = {\n (key.UP, False): key.MOTION_UP,\n (key.RIGHT, False): key.MOTION_RIGHT,\n (key.DOWN, False): key.MOTION_DOWN,\n (key.LEFT, False): key.MOTION_LEFT,\n (key.RIGHT, True): key.MOTION_NEXT_WORD,\n (key.LEFT, True): key.MOTION_PREVIOUS_WORD,\n (key.HOME, False): key.MOTION_BEGINNING_OF_LINE,\n (key.END, False): key.MOTION_END_OF_LINE,\n (key.PAGEUP, False): key.MOTION_PREVIOUS_PAGE,\n (key.PAGEDOWN, False): key.MOTION_NEXT_PAGE,\n (key.HOME, True): key.MOTION_BEGINNING_OF_FILE,\n (key.END, True): key.MOTION_END_OF_FILE,\n (key.BACKSPACE, False): key.MOTION_BACKSPACE,\n (key.DELETE, False): key.MOTION_DELETE,\n}\n\n\n\n# Platform event data is single item, so use platform event handler directly.\nXlibEventHandler = _PlatformEventHandler\nViewEventHandler = _ViewEventHandler\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 60, "start_column": 0, "end_line": 60, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pyglet_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2006", "-", "2008", " ", "Alex", " ", "Hol", "kne", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "pyg", "let", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "written_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "docformat", "\\u\\u_", "=_", "'", "restructur", "edt", "ext", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'$", "Id", "$'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ctypes_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unicodedata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyglet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "window_", "import_", "Window", "Exception_", ",_", "No", "Suc", "h", "Display", "Exception_", ",_", "Mouse", "Curs", "or", "Exception_", ",_", "Mouse", "Cursor_", ",_", "Default", "Mouse", "Cursor_", ",_", "Image", "Mouse", "Cursor_", ",_", "Base", "Window_", ",_", "\\u", "Plat", "form", "Event", "Handler_", ",_", "\\u", "View", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "window_", "import_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "window_", "import_", "mouse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "event_", "import_", "Event", "Dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyglet_", "._", "canvas_", "._", "xli", "b_", "import_", "Xl", "ib", "Canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyglet_", "._", "libs_", "._", "x1", "1_", "import_", "xli", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "libs_", "._", "x1", "1_", "import_", "cursor", "font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyglet_", "._", "compat_", "import_", "as", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pyglet_", "._", "libs_", "._", "x1", "1_", "import_", "xs", "ync_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "have", "\\u", "xs", "ync_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "have", "\\u", "xs", "ync_", "=_", "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\\uDEDENT\\u\\u\\u_", "XA", "\\u", "CARD", "INAL", "_", "=_", "6_", "#", " ", "Xa", "tom", ".", "h", ":", "14_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "we", " ", "have", " ", "the", " ", "Nove", "mber", " ", "2000", " ", "UT", "F8", " ", "extensi", "on", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "have", "\\u", "utf8_", "=_", "hasattr_", "(_", "xli", "b_", "._", "\\u", "lib_", ",_", "'", "Xu", "tf", "8", "Text", "List", "To", "Text", "Proper", "ty", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "symbol", ",", "ctrl", " ", "->", " ", "moti", "on", " ", "mapping_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "moti", "on", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "UP_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "UP_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "RIGHT_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "RIGHT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "DOWN_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "DOWN_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "LEFT_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "LEFT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "RIGHT_", ",_", "True_", ")_", ":_", "key_", "._", "MOTION", "\\u", "NEXT", "\\u", "WORD_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "LEFT_", ",_", "True_", ")_", ":_", "key_", "._", "MOTION", "\\u", "PREVI", "OUS", "\\u", "WORD_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "HOME_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "BEGIN", "NING", "\\u", "OF", "\\u", "LINE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "END_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "END", "\\u", "OF", "\\u", "LINE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "PAGE", "UP_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "PREVI", "OUS", "\\u", "PAGE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "PAGE", "DOWN_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "NEXT", "\\u", "PAGE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "HOME_", ",_", "True_", ")_", ":_", "key_", "._", "MOTION", "\\u", "BEGIN", "NING", "\\u", "OF", "\\u", "FILE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "END_", ",_", "True_", ")_", ":_", "key_", "._", "MOTION", "\\u", "END", "\\u", "OF", "\\u", "FILE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "BACK", "SPACE_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "BACK", "SPACE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "DELETE_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "DELETE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Plat", "form", " ", "event", " ", "data", " ", "is", " ", "single", " ", "item", ",", " ", "so", " ", "use", " ", "platform", " ", "event", " ", "handler", " ", "direct", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Xl", "ib", "Event", "Handler_", "=_", "\\u", "Plat", "form", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "View", "Event", "Handler_", "=_", "\\u", "View", "Event", "Handler_", "\\u\\u\\uNEWLINE\\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,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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 ]
Unused import
ithinksw/philo/philo/migrations/0019_to_taggit.py
[ { "content": "# encoding: utf-8\nimport datetime\nfrom south.db import db\nfrom south.v2 import DataMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(DataMigration):\n\n\n\n\n\n\tmodels = {\n\t\t'contenttypes.contenttype': {\n\t\t\t'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n\t\t\t'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n\t\t\t'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n\t\t},\n\t\t'philo.attribute': {\n\t\t\t'Meta': {'unique_together': \"(('key', 'entity_content_type', 'entity_object_id'), ('value_content_type', 'value_object_id'))\", 'object_name': 'Attribute'},\n\t\t\t'entity_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'attribute_entity_set'\", 'to': \"orm['contenttypes.ContentType']\"}),\n\t\t\t'entity_object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),\n\t\t\t'value_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'attribute_value_set'\", 'null': 'True', 'to': \"orm['contenttypes.ContentType']\"}),\n\t\t\t'value_object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'})\n\t\t},\n\t\t'philo.collection': {\n\t\t\t'Meta': {'object_name': 'Collection'},\n\t\t\t'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})\n\t\t},\n\t\t'philo.collectionmember': {\n\t\t\t'Meta': {'object_name': 'CollectionMember'},\n\t\t\t'collection': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'members'\", 'to': \"orm['philo.Collection']\"}),\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'index': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),\n\t\t\t'member_content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\"}),\n\t\t\t'member_object_id': ('django.db.models.fields.PositiveIntegerField', [], {})\n\t\t},\n\t\t'philo.contentlet': {\n\t\t\t'Meta': {'object_name': 'Contentlet'},\n\t\t\t'content': ('philo.models.fields.TemplateField', [], {}),\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),\n\t\t\t'page': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'contentlets'\", 'to': \"orm['philo.Page']\"})\n\t\t},\n\t\t'philo.contentreference': {\n\t\t\t'Meta': {'object_name': 'ContentReference'},\n\t\t\t'content_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),\n\t\t\t'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\"}),\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),\n\t\t\t'page': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'contentreferences'\", 'to': \"orm['philo.Page']\"})\n\t\t},\n\t\t'philo.file': {\n\t\t\t'Meta': {'object_name': 'File'},\n\t\t\t'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'mimetype': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),\n\t\t\t'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})\n\t\t},\n\t\t'philo.foreignkeyvalue': {\n\t\t\t'Meta': {'object_name': 'ForeignKeyValue'},\n\t\t\t'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\", 'null': 'True', 'blank': 'True'}),\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'})\n\t\t},\n\t\t'philo.jsonvalue': {\n\t\t\t'Meta': {'object_name': 'JSONValue'},\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'value': ('philo.models.fields.JSONField', [], {'default': \"'null'\", 'db_index': 'True'})\n\t\t},\n\t\t'philo.manytomanyvalue': {\n\t\t\t'Meta': {'object_name': 'ManyToManyValue'},\n\t\t\t'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\", 'null': 'True', 'blank': 'True'}),\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'values': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': \"orm['philo.ForeignKeyValue']\", 'null': 'True', 'blank': 'True'})\n\t\t},\n\t\t'philo.node': {\n\t\t\t'Meta': {'unique_together': \"(('parent', 'slug'),)\", 'object_name': 'Node'},\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n\t\t\t'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n\t\t\t'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'children'\", 'null': 'True', 'to': \"orm['philo.Node']\"}),\n\t\t\t'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n\t\t\t'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}),\n\t\t\t'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n\t\t\t'view_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'node_view_set'\", 'null': 'True', 'to': \"orm['contenttypes.ContentType']\"}),\n\t\t\t'view_object_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'})\n\t\t},\n\t\t'philo.page': {\n\t\t\t'Meta': {'object_name': 'Page'},\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'template': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'pages'\", 'to': \"orm['philo.Template']\"}),\n\t\t\t'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})\n\t\t},\n\t\t'philo.redirect': {\n\t\t\t'Meta': {'object_name': 'Redirect'},\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'reversing_parameters': ('philo.models.fields.JSONField', [], {'blank': 'True'}),\n\t\t\t'status_code': ('django.db.models.fields.IntegerField', [], {'default': '302'}),\n\t\t\t'target_node': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'philo_redirect_related'\", 'null': 'True', 'to': \"orm['philo.Node']\"}),\n\t\t\t'url_or_subpath': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'})\n\t\t},\n\t\t'philo.tag': {\n\t\t\t'Meta': {'ordering': \"('name',)\", 'object_name': 'Tag'},\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n\t\t\t'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'})\n\t\t},\n\t\t'philo.template': {\n\t\t\t'Meta': {'unique_together': \"(('parent', 'slug'),)\", 'object_name': 'Template'},\n\t\t\t'code': ('philo.models.fields.TemplateField', [], {}),\n\t\t\t'documentation': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n\t\t\t'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n\t\t\t'mimetype': ('django.db.models.fields.CharField', [], {'default': \"'text/html'\", 'max_length': '255'}),\n\t\t\t'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),\n\t\t\t'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'children'\", 'null': 'True', 'to': \"orm['philo.Template']\"}),\n\t\t\t'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),\n\t\t\t'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}),\n\t\t\t'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})\n\t\t},\n\t\t'taggit.tag': {\n\t\t\t'Meta': {'object_name': 'Tag'},\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n\t\t\t'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})\n\t\t},\n\t\t'taggit.taggeditem': {\n\t\t\t'Meta': {'object_name': 'TaggedItem'},\n\t\t\t'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'taggit_taggeditem_tagged_items'\", 'to': \"orm['contenttypes.ContentType']\"}),\n\t\t\t'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n\t\t\t'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),\n\t\t\t'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'taggit_taggeditem_items'\", 'to': \"orm['taggit.Tag']\"})\n\t\t}\n\t}\n\n\tcomplete_apps = ['taggit', 'philo']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 }, { "content": "\tdef forwards(self, orm):\n\t\t\"Write your forwards methods here.\"\n\t\t# If any tags are longer than 100, this will result in some data loss.\n\t\tPhiloTag = orm['philo.Tag']\n\t\tTag = orm['taggit.Tag']\n\t\t\n\t\tfor tag in PhiloTag.objects.all():\n\t\t\tTag.objects.get_or_create(name=tag.name, slug=tag.slug)", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'DataMigration', ')', ':', '___EOS___']", "index": 8 }, { "content": "\tdef backwards(self, orm):\n\t\t\"Write your backwards methods here.\"\n\t\tpass", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'DataMigration', ')', ':', '___EOS___']", "index": 18 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from south.db import db", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 23 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Data", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "attribute", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "key", "',", " ", "'", "entity", "\\u", "content", "\\u", "type", "',", " ", "'", "entity", "\\u", "object\\u", "id", "')", ",", " ", "('", "value", "\\u", "content", "\\u", "type", "',", " ", "'", "value", "\\u", "object\\u", "id", "'))", "\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Attribute", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entity", "\\u", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "attribute", "\\u", "entity", "\\u", "set", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entity", "\\u", "object\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "\\u", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "attribute", "\\u", "value", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "\\u", "object\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "collection", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Collecti", "on", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "collection", "member", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Collecti", "on", "Mem", "ber", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "collection", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "member", "s", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Collecti", "on", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "index", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "member", "\\u", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "member", "\\u", "object\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "content", "let", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "tle", "t", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "'_", ":_", "(_", "'", "phil", "o", ".", "model", "s", ".", "fields", ".", "Templa", "te", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "content", "lets", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Page", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "content", "reference", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Reference", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "page", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "content", "reference", "s", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Page", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "file", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "File", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "files", ".", "File", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "foreign", "keyval", "ue", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Fore", "ign", "Key", "Value", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "json", "value", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "JSO", "NV", "alu", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "(_", "'", "phil", "o", ".", "model", "s", ".", "fields", ".", "JSO", "NF", "iel", "d", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "null", "'\"_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "many", "toma", "ny", "value", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Many", "To", "Many", "Value", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "values", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Fore", "ign", "Key", "Value", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "node", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "parent", "',", " ", "'", "slug", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Node", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lft", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "child", "ren", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Node", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rg", "ht", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tree", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "\\u", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "node", "\\u", "view", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "\\u", "object\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "page", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Page", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "template", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "page", "s", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Templa", "te", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "redirec", "t", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Redirect", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reversi", "ng", "\\u", "parameter", "s", "'_", ":_", "(_", "'", "phil", "o", ".", "model", "s", ".", "fields", ".", "JSO", "NF", "iel", "d", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "302", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "target", "\\u", "node", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "phil", "o", "\\u", "redirec", "t", "\\u", "relate", "d", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Node", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "\\u", "or", "\\u", "subpa", "th", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "200", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "tag", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Ta", "g", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phil", "o", ".", "template", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "parent", "',", " ", "'", "slug", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Templa", "te", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "(_", "'", "phil", "o", ".", "model", "s", ".", "fields", ".", "Templa", "te", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "documentation", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lft", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "text", "/", "html", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "child", "ren", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "phil", "o", ".", "Templa", "te", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rg", "ht", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tree", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tagg", "it", ".", "tag", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Ta", "g", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "slug", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tagg", "it", ".", "tagg", "edit", "em", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Tagg", "ed", "Item", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "tagg", "it", "\\u", "tagg", "edit", "em", "\\u", "tagg", "ed", "\\u", "items", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tag", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "tagg", "it", "\\u", "tagg", "edit", "em", "\\u", "items", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "tagg", "it", ".", "Ta", "g", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "tagg", "it", "'_", ",_", "'", "phil", "o", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"", "Write", " ", "your", " ", "forward", "s", " ", "method", "s", " ", "here", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "any", " ", "tags", " ", "are", " ", "long", "er", " ", "than", " ", "100", ",", " ", "this", " ", "will", " ", "result", " ", "in", " ", "some", " ", "data", " ", "loss", "._", "\\u\\u\\uNL\\u\\u\\u_", "Phil", "o", "Tag_", "=_", "orm_", "[_", "'", "phil", "o", ".", "Ta", "g", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Tag_", "=_", "orm_", "[_", "'", "tagg", "it", ".", "Ta", "g", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "tag_", "in_", "Phil", "o", "Tag_", "._", "objects_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "Tag_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "name_", "=_", "tag_", "._", "name_", ",_", "slug_", "=_", "tag_", "._", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Data", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "\"", "Write", " ", "your", " ", "back", "ward", "s", " ", "method", "s", " ", "here", ".\"_", "\\u\\u\\uNEWLINE\\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, 0, 1, 2, 0, 1, 1, 1, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
mrknow/filmkodi/plugin.video.specto/resources/lib/libraries/libtools.py
[ { "content": " def range(self, url):\n control.idle()\n\n yes = control.yesnoDialog(control.lang(30425).encode('utf-8'), '', '')\n if not yes: return\n\n if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):\n control.infoDialog(control.lang(30421).encode('utf-8'), time=10000000)\n self.infoDialog = True\n\n from resources.lib.indexers import movies\n items = movies.movies().get(url, idx=False)\n if items == None: items = []\n\n for i in items:\n try:\n if xbmc.abortRequested == True: return sys.exit()\n self.add(i['name'], i['title'], i['year'], i['imdb'], i['tmdb'], range=True)\n except:\n pass\n\n if self.infoDialog == True:\n control.infoDialog(control.lang(30423).encode('utf-8'), time=1)\n\n if self.library_setting == 'true' and not control.condVisibility('Library.IsScanningVideo'):\n control.execute('UpdateLibrary(video)')", "metadata": "root.libmovies.range", "header": "['class', 'libmovies', ':', '___EOS___']", "index": 79 }, { "content": " def range(self, url):\n control.idle()\n\n yes = control.yesnoDialog(control.lang(30425).encode('utf-8'), '', '')\n if not yes: return\n\n if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):\n control.infoDialog(control.lang(30421).encode('utf-8'), time=10000000)\n self.infoDialog = True\n\n from resources.lib.indexers import tvshows\n items = tvshows.tvshows().get(url, idx=False)\n if items == None: items = []\n\n for i in items:\n try:\n if xbmc.abortRequested == True: return sys.exit()\n self.add(i['title'], i['year'], i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], range=True)\n except:\n pass\n\n if self.infoDialog == True:\n control.infoDialog(control.lang(30423).encode('utf-8'), time=1)\n\n if self.library_setting == 'true' and not control.condVisibility('Library.IsScanningVideo'):\n control.execute('UpdateLibrary(video)')", "metadata": "root.libtvshows.range", "header": "['class', 'libtvshows', ':', '___EOS___']", "index": 219 }, { "content": " def update(self, query=None, info='true'):\n if not query == None: control.idle()\n\n try:\n items = []\n season, episode = [], []\n show = [os.path.join(self.library_folder, i) for i in control.listDir(self.library_folder)[0]]\n for s in show:\n try: season += [os.path.join(s, i) for i in control.listDir(s)[0]]\n except: pass\n for s in season:\n try: episode.append([os.path.join(s, i) for i in control.listDir(s)[1] if i.endswith('.strm')][-1])\n except: pass\n\n for file in episode:\n try:\n file = control.openFile(file)\n read = file.read()\n read = read.encode('utf-8')\n file.close()\n\n if not read.startswith(sys.argv[0]): raise Exception()\n\n params = dict(urlparse.parse_qsl(read.replace('?','')))\n\n try: tvshowtitle = params['tvshowtitle']\n except: tvshowtitle = None\n try: tvshowtitle = params['show']\n except: pass\n if tvshowtitle == None or tvshowtitle == '': raise Exception()\n\n year, imdb, tvdb = params['year'], params['imdb'], params['tvdb']\n\n imdb = 'tt' + re.sub('[^0-9]', '', str(imdb))\n\n try: tmdb = params['tmdb']\n except: tmdb = '0'\n\n try: tvrage = params['tvrage']\n except: tvrage = '0'\n\n items.append({'tvshowtitle': tvshowtitle, 'year': year, 'imdb': imdb, 'tmdb': tmdb, 'tvdb': tvdb, 'tvrage': tvrage})\n except:\n pass\n\n items = [i for x, i in enumerate(items) if i not in items[x + 1:]]\n if len(items) == 0: raise Exception()\n except:\n return\n\n try:\n lib = control.jsonrpc('{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.GetTVShows\", \"params\": {\"properties\" : [\"imdbnumber\", \"title\", \"year\"]}, \"id\": 1}')\n lib = unicode(lib, 'utf-8', errors='ignore')\n lib = json.loads(lib)['result']['tvshows']\n except:\n return\n\n if info == 'true' and not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):\n control.infoDialog(control.lang(30422).encode('utf-8'), time=10000000)\n self.infoDialog = True\n\n try:\n control.makeFile(control.dataPath)\n dbcon = database.connect(control.libcacheFile)\n dbcur = dbcon.cursor()\n dbcur.execute(\"CREATE TABLE IF NOT EXISTS tvshows (\"\"id TEXT, \"\"items TEXT, \"\"UNIQUE(id)\"\");\")\n except:\n return\n try:\n from resources.lib.indexers import episodes\n except:\n return\n\n for item in items:\n it = None\n\n if xbmc.abortRequested == True: return sys.exit()\n\n try:\n dbcur.execute(\"SELECT * FROM tvshows WHERE id = '%s'\" % item['tvdb'])\n fetch = dbcur.fetchone()\n it = eval(fetch[1].encode('utf-8'))\n except:\n pass\n\n try:\n if not it == None: raise Exception()\n\n it = episodes.episodes().get(item['tvshowtitle'], item['year'], item['imdb'], item['tmdb'], item['tvdb'], item['tvrage'], idx=False)\n\n status = it[0]['status'].lower()\n\n it = [{'name': i['name'], 'title': i['title'], 'year': i['year'], 'imdb': i['imdb'], 'tmdb': i['tmdb'], 'tvdb': i['tvdb'], 'tvrage': i['tvrage'], 'season': i['season'], 'episode': i['episode'], 'tvshowtitle': i['tvshowtitle'], 'alter': i['alter'], 'date': i['premiered']} for i in it]\n\n if status == 'continuing': raise Exception()\n dbcur.execute(\"INSERT INTO tvshows Values (?, ?)\", (item['tvdb'], repr(it)))\n dbcon.commit()\n except:\n pass\n\n try:\n id = [item['imdb'], item['tvdb']]\n if not item['tmdb'] == '0': id += [item['tmdb']]\n\n ep = [x['title'].encode('utf-8') for x in lib if str(x['imdbnumber']) in id or (x['title'].encode('utf-8') == item['tvshowtitle'] and str(x['year']) == item['year'])][0]\n ep = control.jsonrpc('{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.GetEpisodes\", \"params\": {\"filter\":{\"and\": [{\"field\": \"tvshow\", \"operator\": \"is\", \"value\": \"%s\"}]}, \"properties\": [\"season\", \"episode\"]}, \"id\": 1}' % ep)\n ep = unicode(ep, 'utf-8', errors='ignore')\n ep = json.loads(ep)['result']['episodes'][-1]\n\n num = [x for x,y in enumerate(it) if str(y['season']) == str(ep['season']) and str(y['episode']) == str(ep['episode'])][-1]\n it = [y for x,y in enumerate(it) if x > num]\n if len(it) == 0: continue\n except:\n continue\n\n for i in it:\n try:\n if xbmc.abortRequested == True: return sys.exit()\n\n if int(self.date) <= int(re.sub('[^0-9]', '', str(i['date']))):\n from resources.lib.sources import sources\n src = sources().checkSources(i['name'], i['title'], i['year'], i['imdb'], i['tmdb'], i['tvdb'], i['tvrage'], i['season'], i['episode'], i['tvshowtitle'], i['alter'], i['date'])\n if src == False: raise Exception()\n\n libtvshows().strmFile(i)\n except:\n pass\n\n if self.infoDialog == True:\n control.infoDialog(control.lang(30423).encode('utf-8'), time=1)\n\n if self.library_setting == 'true' and not control.condVisibility('Library.IsScanningVideo'):\n control.execute('UpdateLibrary(video)')", "metadata": "root.libepisodes.update", "header": "['class', 'libepisodes', ':', '___EOS___']", "index": 316 }, { "content": " def service(self):\n try:\n control.makeFile(control.dataPath)\n dbcon = database.connect(control.libcacheFile)\n dbcur = dbcon.cursor()\n dbcur.execute(\"CREATE TABLE IF NOT EXISTS service (\"\"setting TEXT, \"\"value TEXT, \"\"UNIQUE(setting)\"\");\")\n dbcur.execute(\"SELECT * FROM service WHERE setting = 'last_run'\")\n fetch = dbcur.fetchone()\n if fetch == None:\n serviceProperty = \"1970-01-01 23:59:00.000000\"\n dbcur.execute(\"INSERT INTO service Values (?, ?)\", ('last_run', serviceProperty))\n dbcon.commit()\n else:\n serviceProperty = str(fetch[1])\n dbcon.close()\n except:\n try: return dbcon.close()\n except: return\n\n try: control.window.setProperty(self.property, serviceProperty)\n except: return\n\n while (not xbmc.abortRequested):\n try:\n serviceProperty = control.window.getProperty(self.property)\n\n t1 = datetime.timedelta(hours=6)\n t2 = datetime.datetime.strptime(serviceProperty, '%Y-%m-%d %H:%M:%S.%f')\n t3 = datetime.datetime.now()\n\n check = abs(t3 - t2) > t1\n if check == False: raise Exception()\n\n if (control.player.isPlaying() or control.condVisibility('Library.IsScanningVideo')): raise Exception()\n\n serviceProperty = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')\n\n control.window.setProperty(self.property, serviceProperty)\n\n try:\n dbcon = database.connect(control.libcacheFile)\n dbcur = dbcon.cursor()\n dbcur.execute(\"CREATE TABLE IF NOT EXISTS service (\"\"setting TEXT, \"\"value TEXT, \"\"UNIQUE(setting)\"\");\")\n dbcur.execute(\"DELETE FROM service WHERE setting = 'last_run'\")\n dbcur.execute(\"INSERT INTO service Values (?, ?)\", ('last_run', serviceProperty))\n dbcon.commit()\n dbcon.close()\n except:\n try: dbcon.close()\n except: pass\n\n if not control.setting('service_update') == 'true': raise Exception()\n info = control.setting('service_notification') or 'true'\n self.update(None, info=info)\n except:\n pass\n\n control.sleep(10000)", "metadata": "root.libepisodes.service", "header": "['class', 'libepisodes', ':', '___EOS___']", "index": 451 } ]
[ { "span": "items == None:", "start_line": 91, "start_column": 11, "end_line": 91, "end_column": 24 }, { "span": "items == None:", "start_line": 231, "start_column": 11, "end_line": 231, "end_column": 24 }, { "span": "query == None:", "start_line": 317, "start_column": 15, "end_line": 317, "end_column": 28 }, { "span": "tvshowtitle == None ", "start_line": 345, "start_column": 23, "end_line": 345, "end_column": 42 }, { "span": "it == None:", "start_line": 402, "start_column": 23, "end_line": 402, "end_column": 33 }, { "span": "fetch == None:", "start_line": 459, "start_column": 15, "end_line": 459, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "libm", "ovi", "es_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "range_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "idle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yes_", "=_", "control_", "._", "yesno", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "25_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "''_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "yes_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "control_", "._", "cond", "Visibility_", "(_", "'", "Window", ".", "Is", "Vis", "ibl", "e", "(", "info", "dialog", ")'_", ")_", "and_", "not_", "control_", "._", "cond", "Visibility_", "(_", "'", "Player", ".", "Has", "Vid", "eo", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "info", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "21_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "time_", "=_", "10000000", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "info", "Dialog_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "resources_", "._", "lib_", "._", "indexer", "s_", "import_", "movies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items_", "=_", "movies_", "._", "movies_", "(_", ")_", "._", "get_", "(_", "url_", ",_", "idx_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "items_", "==_", "None_", ":_", "items_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "items_", ":_", "\\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_", "xbmc_", "._", "abort", "Requeste", "d_", "==_", "True_", ":_", "return_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add_", "(_", "i_", "[_", "'", "name", "'_", "]_", ",_", "i_", "[_", "'", "title", "'_", "]_", ",_", "i_", "[_", "'", "year", "'_", "]_", ",_", "i_", "[_", "'", "imd", "b", "'_", "]_", ",_", "i_", "[_", "'", "tmdb", "'_", "]_", ",_", "range_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "info", "Dialog_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "info", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "23_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "time_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "librar", "y", "\\u", "setting_", "==_", "'", "true", "'_", "and_", "not_", "control_", "._", "cond", "Visibility_", "(_", "'", "Libr", "ary", ".", "Is", "Scann", "ing", "Vid", "eo", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "execute_", "(_", "'", "Update", "Libr", "ary", "(", "video", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "libt", "vs", "how", "s_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "range_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "idle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "yes_", "=_", "control_", "._", "yesno", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "25_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "''_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "yes_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "control_", "._", "cond", "Visibility_", "(_", "'", "Window", ".", "Is", "Vis", "ibl", "e", "(", "info", "dialog", ")'_", ")_", "and_", "not_", "control_", "._", "cond", "Visibility_", "(_", "'", "Player", ".", "Has", "Vid", "eo", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "info", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "21_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "time_", "=_", "10000000", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "info", "Dialog_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "resources_", "._", "lib_", "._", "indexer", "s_", "import_", "tvshow", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items_", "=_", "tvshow", "s_", "._", "tvshow", "s_", "(_", ")_", "._", "get_", "(_", "url_", ",_", "idx_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "items_", "==_", "None_", ":_", "items_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "items_", ":_", "\\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_", "xbmc_", "._", "abort", "Requeste", "d_", "==_", "True_", ":_", "return_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add_", "(_", "i_", "[_", "'", "title", "'_", "]_", ",_", "i_", "[_", "'", "year", "'_", "]_", ",_", "i_", "[_", "'", "imd", "b", "'_", "]_", ",_", "i_", "[_", "'", "tmdb", "'_", "]_", ",_", "i_", "[_", "'", "tvdb", "'_", "]_", ",_", "i_", "[_", "'", "tv", "rage", "'_", "]_", ",_", "range_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "info", "Dialog_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "info", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "23_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "time_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "librar", "y", "\\u", "setting_", "==_", "'", "true", "'_", "and_", "not_", "control_", "._", "cond", "Visibility_", "(_", "'", "Libr", "ary", ".", "Is", "Scann", "ing", "Vid", "eo", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "execute_", "(_", "'", "Update", "Libr", "ary", "(", "video", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "libe", "pis", "odes_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "query_", "=_", "None_", ",_", "info_", "=_", "'", "true", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "query_", "==_", "None_", ":_", "control_", "._", "idle_", "(_", ")_", "\\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 ", " _", "items_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "season_", ",_", "episode_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show_", "=_", "[_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "librar", "y", "\\u", "folder_", ",_", "i_", ")_", "for_", "i_", "in_", "control_", "._", "list", "Dir_", "(_", "self_", "._", "librar", "y", "\\u", "folder_", ")_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "show_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "season_", "+=_", "[_", "os_", "._", "path_", "._", "join_", "(_", "s_", ",_", "i_", ")_", "for_", "i_", "in_", "control_", "._", "list", "Dir_", "(_", "s_", ")_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "s_", "in_", "season_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "episode_", "._", "append_", "(_", "[_", "os_", "._", "path_", "._", "join_", "(_", "s_", ",_", "i_", ")_", "for_", "i_", "in_", "control_", "._", "list", "Dir_", "(_", "s_", ")_", "[_", "1_", "]_", "if_", "i_", "._", "endswith_", "(_", "'.", "strm", "'_", ")_", "]_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "file_", "in_", "episode_", ":_", "\\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 ", " ", "_", "file_", "=_", "control_", "._", "open", "File_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read_", "=_", "file_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read_", "=_", "read_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "read_", "._", "startswith_", "(_", "sys_", "._", "argv_", "[_", "0_", "]_", ")_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "dict_", "(_", "urlparse_", "._", "parse", "\\u", "qs", "l_", "(_", "read_", "._", "replace_", "(_", "'?'_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "tvshow", "title_", "=_", "params_", "[_", "'", "tvshow", "title", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "tvshow", "title_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "tvshow", "title_", "=_", "params_", "[_", "'", "show", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tvshow", "title_", "==_", "None_", "or_", "tvshow", "title_", "==_", "''_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "year_", ",_", "imdb_", ",_", "tvdb", "_", "=_", "params_", "[_", "'", "year", "'_", "]_", ",_", "params_", "[_", "'", "imd", "b", "'_", "]_", ",_", "params_", "[_", "'", "tvdb", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "imdb_", "=_", "'", "tt", "'_", "+_", "re_", "._", "sub_", "(_", "'[", "^", "0", "-", "9", "]'_", ",_", "''_", ",_", "str_", "(_", "imdb_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "tmdb", "_", "=_", "params_", "[_", "'", "tmdb", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "tmdb", "_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "tv", "rage_", "=_", "params_", "[_", "'", "tv", "rage", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "tv", "rage_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "items_", "._", "append_", "(_", "{_", "'", "tvshow", "title", "'_", ":_", "tvshow", "title_", ",_", "'", "year", "'_", ":_", "year_", ",_", "'", "imd", "b", "'_", ":_", "imdb_", ",_", "'", "tmdb", "'_", ":_", "tmdb", "_", ",_", "'", "tvdb", "'_", ":_", "tvdb", "_", ",_", "'", "tv", "rage", "'_", ":_", "tv", "rage_", "}_", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "items_", "=_", "[_", "i_", "for_", "x_", ",_", "i_", "in_", "enumerate_", "(_", "items_", ")_", "if_", "i_", "not_", "in_", "items_", "[_", "x_", "+_", "1_", ":_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "items_", ")_", "==_", "0_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "lib_", "=_", "control_", "._", "jsonrpc", "_", "(_", "'{", "\"", "jsonrpc", "\":", " ", "\"", "2.0", "\",", " ", "\"", "method", "\":", " ", "\"", "Vid", "eo", "Libr", "ary", ".", "Get", "TV", "Show", "s", "\",", " ", "\"", "params", "\":", " ", "{", "\"", "proper", "ties", "\"", " ", ":", " ", "[\"", "imd", "bn", "umber", "\",", " ", "\"", "title", "\",", " ", "\"", "year", "\"]}", ",", " ", "\"", "id", "\":", " ", "1", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib_", "=_", "unicode_", "(_", "lib_", ",_", "'", "utf", "-", "8", "'_", ",_", "errors_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib_", "=_", "json_", "._", "loads_", "(_", "lib_", ")_", "[_", "'", "result", "'_", "]_", "[_", "'", "tvshow", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "info_", "==_", "'", "true", "'_", "and_", "not_", "control_", "._", "cond", "Visibility_", "(_", "'", "Window", ".", "Is", "Vis", "ibl", "e", "(", "info", "dialog", ")'_", ")_", "and_", "not_", "control_", "._", "cond", "Visibility_", "(_", "'", "Player", ".", "Has", "Vid", "eo", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "info", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "22_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "time_", "=_", "10000000", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "info", "Dialog_", "=_", "True_", "\\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 ", " _", "control_", "._", "make", "File_", "(_", "control_", "._", "data", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "=_", "database_", "._", "connect_", "(_", "control_", "._", "libc", "ache", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "=_", "dbco", "n_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "tvshow", "s", " ", "(\"_", "\"", "id", " ", "TEXT", ",", " ", "\"_", "\"", "items", " ", "TEXT", ",", " ", "\"_", "\"", "UNI", "QUE", "(", "id", ")\"_", "\");", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "resources_", "._", "lib_", "._", "indexer", "s_", "import_", "episodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "item_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "it_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "xbmc_", "._", "abort", "Requeste", "d_", "==_", "True_", ":_", "return_", "sys_", "._", "exit_", "(_", ")_", "\\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 ", " _", "dbc", "ur_", "._", "execute_", "(_", "\"", "SELECT", " ", "*", " ", "FROM", " ", "tvshow", "s", " ", "WHE", "RE", " ", "id", " ", "=", " ", "'%", "s", "'\"_", "%_", "item_", "[_", "'", "tvdb", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetch_", "=_", "dbc", "ur_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "it_", "=_", "eval_", "(_", "fetch_", "[_", "1_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "it_", "==_", "None_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "it_", "=_", "episodes_", "._", "episodes_", "(_", ")_", "._", "get_", "(_", "item_", "[_", "'", "tvshow", "title", "'_", "]_", ",_", "item_", "[_", "'", "year", "'_", "]_", ",_", "item_", "[_", "'", "imd", "b", "'_", "]_", ",_", "item_", "[_", "'", "tmdb", "'_", "]_", ",_", "item_", "[_", "'", "tvdb", "'_", "]_", ",_", "item_", "[_", "'", "tv", "rage", "'_", "]_", ",_", "idx_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "it_", "[_", "0_", "]_", "[_", "'", "status", "'_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "it_", "=_", "[_", "{_", "'", "name", "'_", ":_", "i_", "[_", "'", "name", "'_", "]_", ",_", "'", "title", "'_", ":_", "i_", "[_", "'", "title", "'_", "]_", ",_", "'", "year", "'_", ":_", "i_", "[_", "'", "year", "'_", "]_", ",_", "'", "imd", "b", "'_", ":_", "i_", "[_", "'", "imd", "b", "'_", "]_", ",_", "'", "tmdb", "'_", ":_", "i_", "[_", "'", "tmdb", "'_", "]_", ",_", "'", "tvdb", "'_", ":_", "i_", "[_", "'", "tvdb", "'_", "]_", ",_", "'", "tv", "rage", "'_", ":_", "i_", "[_", "'", "tv", "rage", "'_", "]_", ",_", "'", "season", "'_", ":_", "i_", "[_", "'", "season", "'_", "]_", ",_", "'", "episode", "'_", ":_", "i_", "[_", "'", "episode", "'_", "]_", ",_", "'", "tvshow", "title", "'_", ":_", "i_", "[_", "'", "tvshow", "title", "'_", "]_", ",_", "'", "alter", "'_", ":_", "i_", "[_", "'", "alter", "'_", "]_", ",_", "'", "date", "'_", ":_", "i_", "[_", "'", "premi", "ere", "d", "'_", "]_", "}_", "for_", "i_", "in_", "it_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "status_", "==_", "'", "continui", "ng", "'_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "INSERT", " ", "INT", "O", " ", "tvshow", "s", " ", "Value", "s", " ", "(?", ",", " ", "?)\"_", ",_", "(_", "item_", "[_", "'", "tvdb", "'_", "]_", ",_", "repr_", "(_", "it_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "._", "commit_", "(_", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "[_", "item_", "[_", "'", "imd", "b", "'_", "]_", ",_", "item_", "[_", "'", "tvdb", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "item_", "[_", "'", "tmdb", "'_", "]_", "==_", "'", "0", "'_", ":_", "id_", "+=_", "[_", "item_", "[_", "'", "tmdb", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ep_", "=_", "[_", "x_", "[_", "'", "title", "'_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "for_", "x_", "in_", "lib_", "if_", "str_", "(_", "x_", "[_", "'", "imd", "bn", "umber", "'_", "]_", ")_", "in_", "id_", "or_", "(_", "x_", "[_", "'", "title", "'_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "==_", "item_", "[_", "'", "tvshow", "title", "'_", "]_", "and_", "str_", "(_", "x_", "[_", "'", "year", "'_", "]_", ")_", "==_", "item_", "[_", "'", "year", "'_", "]_", ")_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ep_", "=_", "control_", "._", "jsonrpc", "_", "(_", "'{", "\"", "jsonrpc", "\":", " ", "\"", "2.0", "\",", " ", "\"", "method", "\":", " ", "\"", "Vid", "eo", "Libr", "ary", ".", "Get", "Episod", "es", "\",", " ", "\"", "params", "\":", " ", "{", "\"", "filter", "\":{", "\"", "and", "\":", " ", "[{", "\"", "field", "\":", " ", "\"", "tvshow", "\",", " ", "\"", "opera", "tor", "\":", " ", "\"", "is", "\",", " ", "\"", "value", "\":", " ", "\"%", "s", "\"}]", "},", " ", "\"", "proper", "ties", "\":", " ", "[\"", "season", "\",", " ", "\"", "episode", "\"]}", ",", " ", "\"", "id", "\":", " ", "1", "}'_", "%_", "ep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ep_", "=_", "unicode_", "(_", "ep_", ",_", "'", "utf", "-", "8", "'_", ",_", "errors_", "=_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ep_", "=_", "json_", "._", "loads_", "(_", "ep_", ")_", "[_", "'", "result", "'_", "]_", "[_", "'", "episode", "s", "'_", "]_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num_", "=_", "[_", "x_", "for_", "x_", ",_", "y_", "in_", "enumerate_", "(_", "it_", ")_", "if_", "str_", "(_", "y_", "[_", "'", "season", "'_", "]_", ")_", "==_", "str_", "(_", "ep_", "[_", "'", "season", "'_", "]_", ")_", "and_", "str_", "(_", "y_", "[_", "'", "episode", "'_", "]_", ")_", "==_", "str_", "(_", "ep_", "[_", "'", "episode", "'_", "]_", ")_", "]_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "it_", "=_", "[_", "y_", "for_", "x_", ",_", "y_", "in_", "enumerate_", "(_", "it_", ")_", "if_", "x_", ">_", "num_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "it_", ")_", "==_", "0_", ":_", "continue_", "\\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 ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "it_", ":_", "\\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_", "xbmc_", "._", "abort", "Requeste", "d_", "==_", "True_", ":_", "return_", "sys_", "._", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "int_", "(_", "self_", "._", "date_", ")_", "<=_", "int_", "(_", "re_", "._", "sub_", "(_", "'[", "^", "0", "-", "9", "]'_", ",_", "''_", ",_", "str_", "(_", "i_", "[_", "'", "date", "'_", "]_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "from_", "resources_", "._", "lib_", "._", "sources_", "import_", "sources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "sources_", "(_", ")_", "._", "check", "Sources_", "(_", "i_", "[_", "'", "name", "'_", "]_", ",_", "i_", "[_", "'", "title", "'_", "]_", ",_", "i_", "[_", "'", "year", "'_", "]_", ",_", "i_", "[_", "'", "imd", "b", "'_", "]_", ",_", "i_", "[_", "'", "tmdb", "'_", "]_", ",_", "i_", "[_", "'", "tvdb", "'_", "]_", ",_", "i_", "[_", "'", "tv", "rage", "'_", "]_", ",_", "i_", "[_", "'", "season", "'_", "]_", ",_", "i_", "[_", "'", "episode", "'_", "]_", ",_", "i_", "[_", "'", "tvshow", "title", "'_", "]_", ",_", "i_", "[_", "'", "alter", "'_", "]_", ",_", "i_", "[_", "'", "date", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "src_", "==_", "False_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "libt", "vs", "how", "s_", "(_", ")_", "._", "strm", "File_", "(_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "info", "Dialog_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "info", "Dialog_", "(_", "control_", "._", "lang_", "(_", "304", "23_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "time_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "librar", "y", "\\u", "setting_", "==_", "'", "true", "'_", "and_", "not_", "control_", "._", "cond", "Visibility_", "(_", "'", "Libr", "ary", ".", "Is", "Scann", "ing", "Vid", "eo", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "execute_", "(_", "'", "Update", "Libr", "ary", "(", "video", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "libe", "pis", "odes_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "service_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "control_", "._", "make", "File_", "(_", "control_", "._", "data", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "=_", "database_", "._", "connect_", "(_", "control_", "._", "libc", "ache", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "=_", "dbco", "n_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "service", " ", "(\"_", "\"", "setti", "ng", " ", "TEXT", ",", " ", "\"_", "\"", "value", " ", "TEXT", ",", " ", "\"_", "\"", "UNI", "QUE", "(", "setti", "ng", ")\"_", "\");", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "SELECT", " ", "*", " ", "FROM", " ", "service", " ", "WHE", "RE", " ", "setti", "ng", " ", "=", " ", "'", "last", "\\u", "run", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fetch_", "=_", "dbc", "ur_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fetch_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "Property_", "=_", "\"", "197", "0", "-0", "1", "-0", "1", " ", "23", ":", "5", "9", ":", "00", ".0000", "00", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "INSERT", " ", "INT", "O", " ", "service", " ", "Value", "s", " ", "(?", ",", " ", "?)\"_", ",_", "(_", "'", "last", "\\u", "run", "'_", ",_", "service", "Property_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "service", "Property_", "=_", "str_", "(_", "fetch_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dbco", "n_", "._", "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 ", " _", "try_", ":_", "return_", "dbco", "n_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "control_", "._", "window_", "._", "set", "Property_", "(_", "self_", "._", "property_", ",_", "service", "Property_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "not_", "xbmc_", "._", "abort", "Requeste", "d_", ")_", ":_", "\\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 ", " _", "service", "Property_", "=_", "control_", "._", "window_", "._", "get", "Property_", "(_", "self_", "._", "property_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1_", "=_", "datetime_", "._", "timedelta_", "(_", "hours_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t2_", "=_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "service", "Property_", ",_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", ".", "%", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "check_", "=_", "abs_", "(_", "t3_", "-_", "t2_", ")_", ">_", "t1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "check_", "==_", "False_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "control_", "._", "player_", "._", "is", "Play", "ing_", "(_", ")_", "or_", "control_", "._", "cond", "Visibility_", "(_", "'", "Libr", "ary", ".", "Is", "Scann", "ing", "Vid", "eo", "'_", ")_", ")_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service", "Property_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "._", "strftime_", "(_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", ".", "%", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "control_", "._", "window_", "._", "set", "Property_", "(_", "self_", "._", "property_", ",_", "service", "Property_", ")_", "\\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 ", " ", "_", "dbco", "n_", "=_", "database_", "._", "connect_", "(_", "control_", "._", "libc", "ache", "File_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "=_", "dbco", "n_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "service", " ", "(\"_", "\"", "setti", "ng", " ", "TEXT", ",", " ", "\"_", "\"", "value", " ", "TEXT", ",", " ", "\"_", "\"", "UNI", "QUE", "(", "setti", "ng", ")\"_", "\");", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "DELET", "E", " ", "FROM", " ", "service", " ", "WHE", "RE", " ", "setti", "ng", " ", "=", " ", "'", "last", "\\u", "run", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "INSERT", " ", "INT", "O", " ", "service", " ", "Value", "s", " ", "(?", ",", " ", "?)\"_", ",_", "(_", "'", "last", "\\u", "run", "'_", ",_", "service", "Property_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbco", "n_", "._", "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 ", " ", "_", "try_", ":_", "dbco", "n_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "control_", "._", "setting_", "(_", "'", "service", "\\u", "update", "'_", ")_", "==_", "'", "true", "'_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "=_", "control_", "._", "setting_", "(_", "'", "service", "\\u", "notification", "'_", ")_", "or_", "'", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._",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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 ]
Variable defined multiple times
ligershark/Kulture/Completions.py
[ { "content": " def on_query_completions(self, view, prefix, locations):\n pos = locations[0]\n scopes = view.scope_name(pos).split()\n if \"source.json\" not in scopes:\n return []\n else:\n doc = view.substr(sublime.Region(0,view.size()))\n\n whitespaces = 0;\n for index, char in enumerate(doc[0:pos]):\n if char == '\\n' or char == '\\r' or char == ' ' or char == '\\t':\n whitespaces += 1\n\n doc = doc.replace('\\n', '').replace('\\r','').replace(' ', '').replace('\\t', '')\n pos = pos - whitespaces\n\n depth = -1\n tokens = []\n token_regex = re.compile(r'\"([-a-zA-Z0-9+]+)\":{')\n\n for index, char in enumerate(doc):\n if char == '{':\n depth += 1\n token_regex = r'\"([-a-zA-Z0-9+]+)\":{$'\n match = re.search(token_regex, doc[0:index+1])\n try:\n tokens.append(match.group(1))\n except AttributeError as e:\n pass\n if char == '}':\n depth -= 1\n try:\n tokens.pop()\n except IndexError as e:\n pass\n if index==pos:\n if (depth == 1 and tokens[0] == 'dependencies'):\n # Version number\n version_regex = r'(?:,|{|\\[])\"([-a-zA-Z0-9.*]+)\":\"[-a-zA-Z0-9.*]*$'\n try:\n package_name = re.search(version_regex, doc[0:index]).group(1)\n return (self.result[package_name], AC_OPTS)\n except AttributeError as e:\n pass\n except KeyError as e:\n # TODO: Not in cache. Make HTTP request to feth completions on that package\n return AC_OPTS\n # Package name\n return (self.cache, AC_OPTS)\n elif depth == 0:\n # In future, get completions dynamically from http://schemastore.org/schemas/json/project\n # Replace word completions with snippets\n return ([('version', 'version\" : \"$1\"'),\n ('dependencies', 'dependencies\" : {\\n\\t\"$1\": \"$2\"\\n}'),\n ('commands', 'commands\" : {\\n\\t\"$1\": \"$2\"\\n}'),\n ('configurations', 'configurations\" : {\\n\\t\"$1\": {}\\n}'),\n ('compilationOptions', 'compilationOptions'),\n ('frameworks', 'frameworks\" : {\\n\\t\"$1\": \"$2\"\\n}'),\n ('description', 'description\" : \"$1\"'),\n ('authors', 'authors\" : [\\n\\t\"$1\"\\n]'),\n ('code', 'code\" : {\\n\\t\"$1\": \"$2\"\\n}'),\n ('shared', 'shared\" : {\\n\\t\"$1\": \"$2\"\\n}'),\n ('exclude', 'exclude\" : {\\n\\t\"$1\": \"$2\"\\n}'),\n ('preprocess', 'preprocess\" : {\\n\\t\"$1\": \"$2\"\\n}'),\n ('resources', 'resources')\n ], AC_OPTS)\n else:\n break\n\n return AC_OPTS", "metadata": "root.KKultureCompletion.on_query_completions", "header": "['class', 'KKultureCompletion', '(', 'sublime_plugin', '.', 'EventListener', ')', ':', '___EOS___']", "index": 42 } ]
[ { "span": "token_regex ", "start_line": 60, "start_column": 12, "end_line": 60, "end_column": 23 } ]
[ { "span": "token_regex ", "start_line": 65, "start_column": 20, "end_line": 65, "end_column": 31 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "KK", "ult", "ure", "Completi", "on_", "(_", "sublim", "e\\u", "plugin_", "._", "Event", "Listener_", ")_", ":_", "\\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_", "on", "\\u", "query", "\\u", "completions_", "(_", "self_", ",_", "view_", ",_", "prefix_", ",_", "locations_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "=_", "locations_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scopes_", "=_", "view_", "._", "scope", "\\u", "name_", "(_", "pos_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "source", ".", "json", "\"_", "not_", "in_", "scopes_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "view_", "._", "substr_", "(_", "sublime_", "._", "Region_", "(_", "0_", ",_", "view_", "._", "size_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "whitespace", "s_", "=_", "0_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "index_", ",_", "char_", "in_", "enumerate_", "(_", "doc_", "[_", "0_", ":_", "pos_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "char_", "==_", "'\\\\", "n", "'_", "or_", "char_", "==_", "'\\\\", "r", "'_", "or_", "char_", "==_", "'", " ", "'_", "or_", "char_", "==_", "'\\\\", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "whitespace", "s_", "+=_", "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_", "doc_", "=_", "doc_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "''_", ")_", "._", "replace_", "(_", "'\\\\", "r", "'_", ",_", "''_", ")_", "._", "replace_", "(_", "'", " ", "'_", ",_", "''_", ")_", "._", "replace_", "(_", "'\\\\", "t", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "pos_", "-_", "whitespace", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "depth_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tokens_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token", "\\u", "regex_", "=_", "re_", "._", "compile_", "(_", "r", "'\"", "([", "-", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "+]", "+)", "\":{", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "index_", ",_", "char_", "in_", "enumerate_", "(_", "doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "char_", "==_", "'{'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "depth_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token", "\\u", "regex_", "=_", "r", "'\"", "([", "-", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "+]", "+)", "\":{", "$'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "re_", "._", "search_", "(_", "token", "\\u", "regex_", ",_", "doc_", "[_", "0_", ":_", "index_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tokens_", "._", "append_", "(_", "match_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "char_", "==_", "'}'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "depth_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tokens_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "index_", "==_", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "(_", "depth_", "==_", "1_", "and_", "tokens_", "[_", "0_", "]_", "==_", "'", "dependen", "cies", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Version", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "version", "\\u", "regex_", "=_", "r", "'(?:", ",", "|", "{", "|\\\\", "[]", ")\"", "([", "-", "a", "-", "z", "A", "-", "Z", "0", "-", "9", ".*", "]+)\"", ":\"", "[-", "a", "-", "z", "A", "-", "Z", "0", "-", "9", ".*", "]*", "$'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "package", "\\u", "name_", "=_", "re_", "._", "search_", "(_", "version", "\\u", "regex_", ",_", "doc_", "[_", "0_", ":_", "index_", "]_", ")_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "self_", "._", "result_", "[_", "package", "\\u", "name_", "]_", ",_", "AC", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Not", " ", "in", " ", "cache", ".", " ", "Make", " ", "HTTP", " ", "request", " ", "to", " ", "fe", "th", " ", "completion", "s", " ", "on", " ", "tha", "t", " ", "package_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "AC", "\\u", "OPTS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Packa", "ge", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "self_", "._", "cache_", ",_", "AC", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "depth_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "future", ",", " ", "get", " ", "completion", "s", " ", "dynami", "call", "y", " ", "from", " ", "http", "://", "schema", "store", ".", "org", "/", "schema", "s", "/", "json", "/", "project_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", " ", "word", " ", "completion", "s", " ", "with", " ", "snippets_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "(_", "[_", "(_", "'", "version", "'_", ",_", "'", "version", "\"", " ", ":", " ", "\"$", "1", "\"'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "dependen", "cies", "'_", ",_", "'", "dependen", "cies", "\"", " ", ":", " ", "{\\\\", "n", "\\\\", "t", "\"$", "1", "\":", " ", "\"$", "2", "\"\\\\", "n", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "command", "s", "'_", ",_", "'", "command", "s", "\"", " ", ":", " ", "{\\\\", "n", "\\\\", "t", "\"$", "1", "\":", " ", "\"$", "2", "\"\\\\", "n", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "configura", "tion", "s", "'_", ",_", "'", "configura", "tion", "s", "\"", " ", ":", " ", "{\\\\", "n", "\\\\", "t", "\"$", "1", "\":", " ", "{}", "\\\\", "n", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "compilation", "Optio", "ns", "'_", ",_", "'", "compilation", "Optio", "ns", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "frameworks", "'_", ",_", "'", "frameworks", "\"", " ", ":", " ", "{\\\\", "n", "\\\\", "t", "\"$", "1", "\":", " ", "\"$", "2", "\"\\\\", "n", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "description", "'_", ",_", "'", "description", "\"", " ", ":", " ", "\"$", "1", "\"'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "author", "s", "'_", ",_", "'", "author", "s", "\"", " ", ":", " ", "[\\\\", "n", "\\\\", "t", "\"$", "1", "\"\\\\", "n", "]'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "code", "'_", ",_", "'", "code", "\"", " ", ":", " ", "{\\\\", "n", "\\\\", "t", "\"$", "1", "\":", " ", "\"$", "2", "\"\\\\", "n", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "shared", "'_", ",_", "'", "shared", "\"", " ", ":", " ", "{\\\\", "n", "\\\\", "t", "\"$", "1", "\":", " ", "\"$", "2", "\"\\\\", "n", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "exclu", "de", "'_", ",_", "'", "exclu", "de", "\"", " ", ":", " ", "{\\\\", "n", "\\\\", "t", "\"$", "1", "\":", " ", "\"$", "2", "\"\\\\", "n", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "preproc", "ess", "'_", ",_", "'", "preproc", "ess", "\"", " ", ":", " ", "{\\\\", "n", "\\\\", "t", "\"$", "1", "\":", " ", "\"$", "2", "\"\\\\", "n", "}'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "resource", "s", "'_", ",_", "'", "resource", "s", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "AC", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "AC", "\\u", "OPTS_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Missing call to `__init__` during object initialization
michaelhelmick/django-balancer/balancer/routers.py
[ { "content": " def __init__(self):\n from django.conf import settings\n if isinstance(settings.DATABASE_POOL, dict):\n self.pool = settings.DATABASE_POOL.keys()\n else:\n self.pool = list(settings.DATABASE_POOL)", "metadata": "root.BasePoolRouter.__init__", "header": "['class', 'BasePoolRouter', '(', 'object', ')', ':', '___EOS___']", "index": 13 }, { "content": "class WeightedRandomRouter(RandomRouter):\n \"\"\"\n A router that randomly selects from a weighted pool of databases, useful\n for replication configurations where all nodes act as masters.\n \"\"\"\n\n", "metadata": "root.WeightedRandomRouter", "header": "['module', '___EOS___']", "index": 48 }, { "content": " def __init__(self):\n from django.conf import settings\n self.pool = settings.DATABASE_POOL.keys()\n self.totals = []\n\n weights = settings.DATABASE_POOL.values()\n running_total = 0\n\n for w in weights:\n running_total += w\n self.totals.append(running_total)", "metadata": "root.WeightedRandomRouter.__init__", "header": "['class', 'WeightedRandomRouter', '(', 'RandomRouter', ')', ':', '___EOS___']", "index": 54 } ]
[ { "span": "class WeightedRandomRouter(RandomRouter):", "start_line": 48, "start_column": 0, "end_line": 48, "end_column": 41 } ]
[ { "span": "def __init__(self):", "start_line": 13, "start_column": 4, "end_line": 13, "end_column": 23 }, { "span": "def __init__(self):", "start_line": 54, "start_column": 4, "end_line": 54, "end_column": 23 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Base", "Poo", "l", "Router_", "(_", "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 ", " _", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "settings_", "._", "DATA", "BASE", "\\u", "POOL", "_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pool_", "=_", "settings_", "._", "DATA", "BASE", "\\u", "POOL", "_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pool_", "=_", "list_", "(_", "settings_", "._", "DATA", "BASE", "\\u", "POOL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Weig", "hte", "d", "Random", "Router_", "(_", "Random", "Router_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "router", " ", "tha", "t", " ", "random", "ly", " ", "select", "s", " ", "from", " ", "a", " ", "weight", "ed", " ", "pool", " ", "of", " ", "databa", "ses", ",", " ", "usef", "ul", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "replication", " ", "configura", "tion", "s", " ", "where", " ", "all", " ", "nodes", " ", "act", " ", "as", " ", "master", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Weig", "hte", "d", "Random", "Router_", "(_", "Random", "Router_", ")_", ":_", "\\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 ", " _", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pool_", "=_", "settings_", "._", "DATA", "BASE", "\\u", "POOL", "_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "totals_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "weights_", "=_", "settings_", "._", "DATA", "BASE", "\\u", "POOL", "_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "runn", "ing", "\\u", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "w_", "in_", "weights_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "runn", "ing", "\\u", "total_", "+=_", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "totals_", "._", "append_", "(_", "runn", "ing", "\\u", "total_", ")_", "\\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, 3, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 3, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
MediaMath/qasino/lib/sqlite_backend.py
[ { "content": " def open_new_db(self, filename, static_filename):\n self.filename = filename\n self.static_filename = static_filename\n\n ##adbapi.noisy = True # and add log.startLogging(sys.stdout) somewhere\n\n # since we're using apsw which is not technically DBAPI compliant \n # I've created this wrapper class to make it act like one.\n adbapi.connectionFactory = apsw_connection.ApswConnection\n\n # if there is a static db ...\n def attach_static_db(conn):\n if static_filename != None and os.path.exists(static_filename):\n cur = conn.cursor()\n try:\n result = cur.execute( \"ATTACH DATABASE '%s' AS static;\" % static_filename)\n except Exception as e:\n logging.info(\"SqlConnections: ERROR Failed to attach static db '%s': %s\", static_filename, str(e))\n\n # Open a connection pool for writing (one thread)...\n\n self.writer_dbpool = adbapi.ConnectionPool('apsw_connection', filename, \n cp_openfun=attach_static_db,\n cp_min=1, cp_max=1)\n \n self.writer_dbpool.connectionFactory = apsw_connection.ApswConnection\n\n # ...and one for reading (multiple threads).\n\n self.reader_dbpool = adbapi.ConnectionPool('apsw_connection', filename, \n cp_openfun=attach_static_db)\n\n self.reader_dbpool.connectionFactory = apsw_connection.ApswConnection\n\n\n # Preload list of tables already in db.\n\n self.reader_dbpool.runInteraction(self.preload_tables_list)", "metadata": "root.SqlConnections.open_new_db", "header": "['class', 'SqlConnections', '(', 'object', ')', ':', '___EOS___']", "index": 55 }, { "content": " def do_select(self, txn, sql):\n\n self.stats['sql_received'] = self.stats.get('sql_received', 0) + 1\n\n try: \n retval = txn.execute(sql)\n\n except Exception as e:\n\n self.stats['sql_errors'] = self.stats.get('sql_errors', 0) + 1\n\n return { \"retval\": 1, \"error_message\" : str(e) }\n\n # Find the max column with for each column.\n\n max_widths = {}\n\n # Get the column names.\n\n column_names = []\n\n try:\n for column_index, column_name in enumerate(txn.getdescription()):\n\n if not max_widths.has_key(str(column_index)) or max_widths[str(column_index)] < len(column_name[0]):\n max_widths[str(column_index)] = len(column_name[0])\n \n column_names.append(column_name[0])\n\n except apsw.ExecutionCompleteError as e:\n # Ugh, getdescription fails if the query succeeds but returns no rows! This is the message:\n # \"Can't get description for statements that have completed execution\"\n\n # For now return a zero row empty table:\n\n data = { \"column_names\" : [ \"query returned zero rows\" ], \"rows\" : [ ] }\n\n return { \"retval\" : 0, \"error_message\" : '', \"data\" : data, \"max_widths\" : { \"0\" : 24 } }\n\n # Save the data here:\n\n saved_rows = []\n nr_rows = 0\n\n # For each row.\n\n # Under certain circustances (like 'select 1; abc') we'll get an exception in fetchall!\n try:\n for row in txn.fetchall():\n\n saved_row = []\n\n # For each column.\n\n for column_index, cell in enumerate(row):\n\n # Convert all to strings and compute the length.\n\n cell = unicode_safe_str(cell)\n\n length = len(cell)\n\n if not max_widths.has_key(str(column_index)) or max_widths[str(column_index)] < length:\n max_widths[str(column_index)] = length\n\n # Save the cell to the row for output later.\n\n saved_row.append(cell)\n\n # Save the row to the rows for output later.\n\n saved_rows.append(saved_row)\n\n except ValueError as e:\n\n self.stats['sql_errors'] = self.stats.get('sql_errors', 0) + 1\n\n return { \"retval\": 1, \"error_message\" : str(e) }\n\n\n self.stats['sql_completed'] = self.stats.get('sql_completed', 0) + 1\n\n data = { \"column_names\" : column_names,\n \"rows\" : saved_rows }\n\n return { \"retval\" : 0, \"error_message\" : '', \"data\" : data, \"max_widths\" : max_widths }", "metadata": "root.SqlConnections.do_select", "header": "['class', 'SqlConnections', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": " def add_table_data(self, txn, table, identity):\n \"\"\" \n Add a table to the backend if it doesn't exist and insert the data.\n This is executed using adbapi in a thread pool.\n \"\"\"\n\n start_time = time.time()\n\n # For when we hit lock contention - only retry so many times.\n\n table.init_retry(5)\n\n tablename = table.get_tablename()\n\n if tablename is None:\n logging.info(\"SqlConnections: Unknown tablename from '%s'\", identity)\n return\n\n update = table.get_property('update')\n static = table.get_property('static')\n persist = table.get_property('persist')\n\n # Check if we need to save the table in case of persistence.\n\n self.data_manager.check_save_table(table, identity)\n\n # Now check if we've already added the table.\n\n try:\n if not update and not static and self.connections[identity][\"tables\"][tablename] > 0:\n logging.info(\"SqlConnections: '%s' has already sent an update or is persisted for table '%s'\", identity, tablename)\n return\n except KeyError:\n # Ignore\n pass\n\n try:\n # Wrap the create, alter tables and inserts or updates in\n # a transaction... All or none please.\n\n txn.execute(\"BEGIN;\")\n\n # Use this to detect if the table already exists - we\n # could just not do this and use the create table to\n # detect if a table is already there or not but a error on\n # the create table would mean having to restart the\n # transaction and require some weird retry logic..\n\n create_sql = \"CREATE TABLE IF NOT EXISTS '%s' ( \\n\" % tablename\n\n columns = []\n \n for column_name, column_type in table.zip_columns():\n columns.append( \"'%s' %s DEFAULT NULL\" % (column_name, column_type) )\n\n create_sql += \",\\n\".join( columns )\n\n create_sql += \")\"\n\n try:\n result = self.do_sql(txn, create_sql)\n except Exception as e:\n errorstr = str(e)\n\n # Is this a \"table already exists\" error? Then its a race condition between checking if a table exists and actually creating it.\n # This should never happen now - we are using CREATE IF NOT EXISTS ...\n if \"already exists\" in errorstr:\n # Don't need to log this as it is fairly common.\n ##logging.info(\"SqlConnections: Warning: Create table race condition '%s' for %s: '%s' ... retrying\", tablename, identity, errorstr)\n raise CreateTableException(\"Create table race condition '%s' for %s: '%s'\" % (tablename, identity, errorstr,))\n \n else:\n # Otherwise some kind of sql error, pass the exception up\n raise e\n\n\n # Merge the schemas of what might be already there and our update.\n schema = self.get_schema(txn, tablename)\n\n self.data_manager.table_merger.merge_table(txn, table, schema, self)\n\n # Now update the table.\n # Truncate and re-insert if this is static.\n # Call do_update if this is an update type.\n # Otherwise we insert.\n\n if static:\n txn.execute(\"DELETE FROM '%s';\" % tablename)\n rowcount = self.do_insert_table(txn, table)\n\n else:\n if update:\n rowcount = self.do_update_table(txn, table, identity)\n else:\n rowcount = self.do_insert_table(txn, table)\n\n txn.execute(\"COMMIT;\")\n\n except apsw.BusyError as e:\n # This should only happen if we exceed the busy timeout.\n logging.info(\"SqlConnections: Warning: Lock contention for adding table '%s': %s for %s\", tablename, str(e), identity)\n\n try:\n txn.execute(\"ROLLBACK;\")\n except:\n pass\n\n # Should we try again?\n if table.test_retry():\n logging.info(\"SqlConnections: ERROR: Retries failed for table '%s'\", tablename)\n return 0\n\n # Place this request back on the event queue for a retry.\n self.async_add_table_data(table, identity)\n\n return 0\n\n except CreateTableException as e:\n # Message when raised\n\n try:\n txn.execute(\"ROLLBACK;\")\n except:\n pass\n\n # Should we try again?\n if table.test_retry():\n logging.info(\"SqlConnections: ERROR: Retries failed for table '%s'\", tablename)\n return 0\n\n # Place this request back on the event queue for a retry.\n self.async_add_table_data(table, identity)\n\n return 0\n\n except Exception as e:\n logging.info(\"SqlConnections: ERROR: Failed to add table '%s': %s\", tablename, e)\n\n try:\n txn.execute(\"ROLLBACK;\")\n except:\n pass\n\n return 0\n\n now = time.time()\n\n nr_rows = table.get_nr_rows()\n\n properties_str = ''\n if static: properties_str += ' static'\n if update: properties_str += ' update'\n if persist: properties_str += ' persist'\n\n logging.info(\"SqlConnections: New data%s for table '%s' %d rows from '%s' (%.02f seconds)\", \n properties_str, tablename, rowcount, identity, now - start_time)\n\n # Update some informational stats used for making the tables\n # and connections tables.\n\n self.update_table_stats(tablename, rowcount, identity=identity,\n sum=not update and not static, now=now)\n \n return 1", "metadata": "root.SqlConnections.add_table_data", "header": "['class', 'SqlConnections', '(', 'object', ')', ':', '___EOS___']", "index": 546 } ]
[ { "span": "result ", "start_line": 70, "start_column": 20, "end_line": 70, "end_column": 26 }, { "span": "retval ", "start_line": 147, "start_column": 12, "end_line": 147, "end_column": 18 }, { "span": "nr_rows ", "start_line": 184, "start_column": 8, "end_line": 184, "end_column": 15 }, { "span": "result ", "start_line": 606, "start_column": 16, "end_line": 606, "end_column": 22 }, { "span": "nr_rows ", "start_line": 693, "start_column": 8, "end_line": 693, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sq", "l", "Connections_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open", "\\u", "new", "\\u", "db_", "(_", "self_", ",_", "filename_", ",_", "static", "\\u", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filename_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "static", "\\u", "filename_", "=_", "static", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "adb", "api", ".", "noisy", " ", "=", " ", "Tru", "e", " ", " ", "#", " ", "and", " ", "add", " ", "log", ".", "start", "Log", "ging", "(", "sys", ".", "stdout", ")", " ", "some", "where_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "we", "'", "re", " ", "usi", "ng", " ", "aps", "w", " ", "whi", "ch", " ", "is", " ", "not", " ", "technical", "ly", " ", "DBA", "PI", " ", "compliant", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", "'", "ve", " ", "created", " ", "this", " ", "wrapp", "er", " ", "class", " ", "to", " ", "make", " ", "it", " ", "act", " ", "like", " ", "one", "._", "\\u\\u\\uNL\\u\\u\\u_", "adb", "api_", "._", "connecti", "on", "Factory_", "=_", "aps", "w", "\\u", "connection_", "._", "Ap", "sw", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "is", " ", "a", " ", "static", " ", "db", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "def_", "attach", "\\u", "static", "\\u", "db_", "(_", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "static", "\\u", "filename_", "!=_", "None_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "static", "\\u", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur_", "=_", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "cur_", "._", "execute_", "(_", "\"", "ATTACH", " ", "DATA", "BASE", " ", "'%", "s", "'", " ", "AS", " ", "static", ";\"_", "%_", "static", "\\u", "filename_", ")_", "\\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 ", " ", "_", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "ERROR", " ", "Fail", "ed", " ", "to", " ", "attach", " ", "static", " ", "db", " ", "'%", "s", "':", " ", "%", "s", "\"_", ",_", "static", "\\u", "filename_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "a", " ", "connecti", "on", " ", "pool", " ", "for", " ", "writ", "ing", " ", "(", "one", " ", "thread", ").", "..", "_", "\\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_", "self_", "._", "writer", "\\u", "dbp", "ool_", "=_", "adb", "api_", "._", "Connect", "ion", "Pool_", "(_", "'", "aps", "w", "\\u", "connecti", "on", "'_", ",_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cp", "\\u", "openf", "un_", "=_", "attach", "\\u", "static", "\\u", "db_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cp", "\\u", "min_", "=_", "1_", ",_", "cp", "\\u", "max_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "writer", "\\u", "dbp", "ool_", "._", "connecti", "on", "Factory_", "=_", "aps", "w", "\\u", "connection_", "._", "Ap", "sw", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", "and", " ", "one", " ", "for", " ", "readi", "ng", " ", "(", "multiple", " ", "thread", "s", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "reader", "\\u", "dbp", "ool_", "=_", "adb", "api_", "._", "Connect", "ion", "Pool_", "(_", "'", "aps", "w", "\\u", "connecti", "on", "'_", ",_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cp", "\\u", "openf", "un_", "=_", "attach", "\\u", "static", "\\u", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "reader", "\\u", "dbp", "ool_", "._", "connecti", "on", "Factory_", "=_", "aps", "w", "\\u", "connection_", "._", "Ap", "sw", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pre", "load", " ", "list", " ", "of", " ", "tables", " ", "alr", "ead", "y", " ", "in", " ", "db", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "reader", "\\u", "dbp", "ool_", "._", "run", "Interaction", "_", "(_", "self_", "._", "prelo", "ad", "\\u", "tables", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sq", "l", "Connections_", "(_", "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_", "do", "\\u", "select_", "(_", "self_", ",_", "txn_", ",_", "sql_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stats_", "[_", "'", "sql", "\\u", "receive", "d", "'_", "]_", "=_", "self_", "._", "stats_", "._", "get_", "(_", "'", "sql", "\\u", "receive", "d", "'_", ",_", "0_", ")_", "+_", "1_", "\\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 ", " _", "retval_", "=_", "txn_", "._", "execute_", "(_", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stats_", "[_", "'", "sql", "\\u", "error", "s", "'_", "]_", "=_", "self_", "._", "stats_", "._", "get_", "(_", "'", "sql", "\\u", "error", "s", "'_", ",_", "0_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\"", "ret", "val", "\"_", ":_", "1_", ",_", "\"", "error", "\\u", "message", "\"_", ":_", "str_", "(_", "e_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "the", " ", "max", " ", "column", " ", "with", " ", "for", " ", "each", " ", "column", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "max", "\\u", "widths_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "column", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "column", "\\u", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "column", "\\u", "index_", ",_", "column", "\\u", "name_", "in_", "enumerate_", "(_", "txn_", "._", "getde", "script", "ion_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "max", "\\u", "widths_", "._", "has", "\\u", "key_", "(_", "str_", "(_", "column", "\\u", "index_", ")_", ")_", "or_", "max", "\\u", "widths_", "[_", "str_", "(_", "column", "\\u", "index_", ")_", "]_", "<_", "len_", "(_", "column", "\\u", "name_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "max", "\\u", "widths_", "[_", "str_", "(_", "column", "\\u", "index_", ")_", "]_", "=_", "len_", "(_", "column", "\\u", "name_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "column", "\\u", "names_", "._", "append_", "(_", "column", "\\u", "name_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "aps", "w_", "._", "Execut", "ion", "Complete", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ug", "h", ",", " ", "getde", "script", "ion", " ", "fail", "s", " ", "if", " ", "the", " ", "query", " ", "succeeds", " ", "but", " ", "return", "s", " ", "no", " ", "rows", "!", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "message", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\"", "Can", "'", "t", " ", "get", " ", "description", " ", "for", " ", "statem", "ents", " ", "tha", "t", " ", "have", " ", "complete", "d", " ", "executi", "on", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "now", " ", "return", " ", "a", " ", "zero", " ", "row", " ", "empty", " ", "table", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "\"", "column", "\\u", "names", "\"_", ":_", "[_", "\"", "query", " ", "return", "ed", " ", "zero", " ", "rows", "\"_", "]_", ",_", "\"", "rows", "\"_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\"", "ret", "val", "\"_", ":_", "0_", ",_", "\"", "error", "\\u", "message", "\"_", ":_", "''_", ",_", "\"", "data", "\"_", ":_", "data_", ",_", "\"", "max", "\\u", "widths", "\"_", ":_", "{_", "\"", "0", "\"_", ":_", "24_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "the", " ", "data", " ", "here", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "saved", "\\u", "rows_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nr", "\\u", "rows_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "each", " ", "row", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Under", " ", "cert", "ain", " ", "circu", "stance", "s", " ", "(", "like", " ", "'", "select", " ", "1", ";", " ", "abc", "')", " ", "we", "'", "ll", " ", "get", " ", "an", " ", "exception", " ", "in", " ", "fetch", "all", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "row_", "in_", "txn_", "._", "fetchall_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "saved", "\\u", "row_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "each", " ", "column", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "column", "\\u", "index_", ",_", "cell_", "in_", "enumerate_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "all", " ", "to", " ", "string", "s", " ", "and", " ", "compute", " ", "the", " ", "length", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cell_", "=_", "unicode", "\\u", "safe", "\\u", "str_", "(_", "cell_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "length_", "=_", "len_", "(_", "cell_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "max", "\\u", "widths_", "._", "has", "\\u", "key_", "(_", "str_", "(_", "column", "\\u", "index_", ")_", ")_", "or_", "max", "\\u", "widths_", "[_", "str_", "(_", "column", "\\u", "index_", ")_", "]_", "<_", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "max", "\\u", "widths_", "[_", "str_", "(_", "column", "\\u", "index_", ")_", "]_", "=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "the", " ", "cell", " ", "to", " ", "the", " ", "row", " ", "for", " ", "output", " ", "late", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "saved", "\\u", "row_", "._", "append_", "(_", "cell_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "the", " ", "row", " ", "to", " ", "the", " ", "rows", " ", "for", " ", "output", " ", "late", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "saved", "\\u", "rows_", "._", "append_", "(_", "saved", "\\u", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stats_", "[_", "'", "sql", "\\u", "error", "s", "'_", "]_", "=_", "self_", "._", "stats_", "._", "get_", "(_", "'", "sql", "\\u", "error", "s", "'_", ",_", "0_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\"", "ret", "val", "\"_", ":_", "1_", ",_", "\"", "error", "\\u", "message", "\"_", ":_", "str_", "(_", "e_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "stats_", "[_", "'", "sql", "\\u", "complete", "d", "'_", "]_", "=_", "self_", "._", "stats_", "._", "get_", "(_", "'", "sql", "\\u", "complete", "d", "'_", ",_", "0_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\"", "column", "\\u", "names", "\"_", ":_", "column", "\\u", "names_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rows", "\"_", ":_", "saved", "\\u", "rows_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\"", "ret", "val", "\"_", ":_", "0_", ",_", "\"", "error", "\\u", "message", "\"_", ":_", "''_", ",_", "\"", "data", "\"_", ":_", "data_", ",_", "\"", "max", "\\u", "widths", "\"_", ":_", "max", "\\u", "widths_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sq", "l", "Connections_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "table", "\\u", "data_", "(_", "self_", ",_", "txn_", ",_", "table_", ",_", "identity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "a", " ", "table", " ", "to", " ", "the", " ", "back", "end", " ", "if", " ", "it", " ", "doe", "sn", "'", "t", " ", "exist", " ", "and", " ", "insert", " ", "the", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "executed", " ", "usi", "ng", " ", "adb", "api", " ", "in", " ", "a", " ", "thread", " ", "pool", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "whe", "n", " ", "we", " ", "hit", " ", "lock", " ", "content", "ion", " ", "-", " ", "only", " ", "retr", "y", " ", "so", " ", "many", " ", "times", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "._", "init", "\\u", "retry_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tablename_", "=_", "table_", "._", "get", "\\u", "tablename_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tablename_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "Un", "know", "n", " ", "tablename", " ", "from", " ", "'%", "s", "'\"_", ",_", "identity_", ")_", "\\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_", "update_", "=_", "table_", "._", "get", "\\u", "property_", "(_", "'", "update", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "static_", "=_", "table_", "._", "get", "\\u", "property_", "(_", "'", "static", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "persist_", "=_", "table_", "._", "get", "\\u", "property_", "(_", "'", "persist", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "we", " ", "need", " ", "to", " ", "save", " ", "the", " ", "table", " ", "in", " ", "case", " ", "of", " ", "persiste", "nce", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "data\\u", "manager_", "._", "check", "\\u", "save", "\\u", "table_", "(_", "table_", ",_", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "check", " ", "if", " ", "we", "'", "ve", " ", "alr", "ead", "y", " ", "adde", "d", " ", "the", " ", "table", "._", "\\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 ", " _", "if_", "not_", "update_", "and_", "not_", "static_", "and_", "self_", "._", "connections_", "[_", "identity_", "]_", "[_", "\"", "tables", "\"_", "]_", "[_", "tablename_", "]_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "'%", "s", "'", " ", "has", " ", "alr", "ead", "y", " ", "sent", " ", "an", " ", "update", " ", "or", " ", "is", " ", "persiste", "d", " ", "for", " ", "table", " ", "'%", "s", "'\"_", ",_", "identity_", ",_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wra", "p", " ", "the", " ", "create", ",", " ", "alter", " ", "tables", " ", "and", " ", "inserts", " ", "or", " ", "update", "s", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "transaction", "...", " ", "All", " ", "or", " ", "none", " ", "plea", "se", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txn_", "._", "execute_", "(_", "\"", "BEGIN", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "this", " ", "to", " ", "detect", " ", "if", " ", "the", " ", "table", " ", "alr", "ead", "y", " ", "exist", "s", " ", "-", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coul", "d", " ", "just", " ", "not", " ", "do", " ", "this", " ", "and", " ", "use", " ", "the", " ", "create", " ", "table", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "detect", " ", "if", " ", "a", " ", "table", " ", "is", " ", "alr", "ead", "y", " ", "there", " ", "or", " ", "not", " ", "but", " ", "a", " ", "error", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "create", " ", "table", " ", "wou", "ld", " ", "mean", " ", "hav", "ing", " ", "to", " ", "restart", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transaction", " ", "and", " ", "require", " ", "some", " ", "weird", " ", "retr", "y", " ", "logic", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "sql_", "=_", "\"", "CREATE", " ", "TAB", "LE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "'%", "s", "'", " ", "(", " ", "\\\\", "n", "\"_", "%_", "tablename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "columns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "column", "\\u", "name_", ",_", "column", "\\u", "type_", "in_", "table_", "._", "zip", "\\u", "columns_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "columns_", "._", "append_", "(_", "\"'", "%", "s", "'", " ", "%", "s", " ", "DEF", "AUL", "T", " ", "NULL", "\"_", "%_", "(_", "column", "\\u", "name_", ",_", "column", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "create", "\\u", "sql_", "+=_", "\",", "\\\\", "n", "\"_", "._", "join_", "(_", "columns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "sql_", "+=_", "\")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "do", "\\u", "sql_", "(_", "txn_", ",_", "create", "\\u", "sql_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "str_", "=_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Is", " ", "this", " ", "a", " ", "\"", "table", " ", "alr", "ead", "y", " ", "exist", "s", "\"", " ", "error", "?", " ", " ", "The", "n", " ", "its", " ", "a", " ", "race", " ", "condition", " ", "bet", "ween", " ", "checking", " ", "if", " ", "a", " ", "table", " ", "exist", "s", " ", "and", " ", "actual", "ly", " ", "creati", "ng", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "neve", "r", " ", "happ", "en", " ", "now", " ", "-", " ", "we", " ", "are", " ", "usi", "ng", " ", "CREATE", " ", "IF", " ", "NOT", " ", "EXIST", "S", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "alr", "ead", "y", " ", "exist", "s", "\"_", "in_", "error", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "need", " ", "to", " ", "log", " ", "this", " ", "as", " ", "it", " ", "is", " ", "fair", "ly", " ", "common", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "logg", "ing", ".", "info", "(\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "Warn", "ing", ":", " ", "Creat", "e", " ", "table", " ", "race", " ", "condition", " ", "'%", "s", "'", " ", "for", " ", "%", "s", ":", " ", "'%", "s", "'", " ", "...", " ", "retrying", "\",", " ", "tablename", ",", " ", "identi", "ty", ",", " ", "error", "str", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Creat", "e", "Table", "Exception_", "(_", "\"", "Creat", "e", " ", "table", " ", "race", " ", "condition", " ", "'%", "s", "'", " ", "for", " ", "%", "s", ":", " ", "'%", "s", "'\"_", "%_", "(_", "tablename_", ",_", "identity_", ",_", "error", "str_", ",_", ")_", ")_", "\\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_", "#", " ", "Ot", "her", "wis", "e", " ", "some", " ", "kind", " ", "of", " ", "sql", " ", "error", ",", " ", "pass", " ", "the", " ", "exception", " ", "up_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Merge", " ", "the", " ", "schema", "s", " ", "of", " ", "what", " ", "mig", "ht", " ", "be", " ", "alr", "ead", "y", " ", "there", " ", "and", " ", "our", " ", "update", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "schema_", "=_", "self_", "._", "get", "\\u", "schema_", "(_", "txn_", ",_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "data\\u", "manager_", "._", "table", "\\u", "merger", "_", "._", "merge", "\\u", "table_", "(_", "txn_", ",_", "table_", ",_", "schema_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "update", " ", "the", " ", "table", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Truncate", " ", "and", " ", "re", "-", "insert", " ", "if", " ", "this", " ", "is", " ", "static", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", " ", "do", "\\u", "update", " ", "if", " ", "this", " ", "is", " ", "an", " ", "update", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", " ", "we", " ", "insert", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "static_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txn_", "._", "execute_", "(_", "\"", "DELET", "E", " ", "FROM", " ", "'%", "s", "';", "\"_", "%_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rowcount_", "=_", "self_", "._", "do", "\\u", "insert", "\\u", "table_", "(_", "txn_", ",_", "table_", ")_", "\\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 ", " _", "if_", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rowcount_", "=_", "self_", "._", "do", "\\u", "update", "\\u", "table_", "(_", "txn_", ",_", "table_", ",_", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "rowcount_", "=_", "self_", "._", "do", "\\u", "insert", "\\u", "table_", "(_", "txn_", ",_", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "txn_", "._", "execute_", "(_", "\"", "COMMIT", ";\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "aps", "w_", "._", "Busy", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "shou", "ld", " ", "only", " ", "happ", "en", " ", "if", " ", "we", " ", "exceed", " ", "the", " ", "bus", "y", " ", "timeo", "ut", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "Warn", "ing", ":", " ", "Lock", " ", "content", "ion", " ", "for", " ", "addin", "g", " ", "table", " ", "'%", "s", "':", " ", "%", "s", " ", "for", " ", "%", "s", "\"_", ",_", "tablename_", ",_", "str_", "(_", "e_", ")_", ",_", "identity_", ")_", "\\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 ", " _", "txn_", "._", "execute_", "(_", "\"", "ROLL", "BACK", ";\"_", ")_", "\\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\\uNL\\u\\u\\u_", "#", " ", "Sho", "ul", "d", " ", "we", " ", "try", " ", "again", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "table_", "._", "test\\u", "retry_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "ERROR", ":", " ", "Retri", "es", " ", "fail", "ed", " ", "for", " ", "table", " ", "'%", "s", "'\"_", ",_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Place", " ", "this", " ", "request", " ", "back", " ", "on", " ", "the", " ", "event", " ", "queue", " ", "for", " ", "a", " ", "retr", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "async", "\\u", "add", "\\u", "table", "\\u", "data_", "(_", "table_", ",_", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Creat", "e", "Table", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Messag", "e", " ", "whe", "n", " ", "raised_", "\\u\\u\\uNL\\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 ", " _", "txn_", "._", "execute_", "(_", "\"", "ROLL", "BACK", ";\"_", ")_", "\\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\\uNL\\u\\u\\u_", "#", " ", "Sho", "ul", "d", " ", "we", " ", "try", " ", "again", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "table_", "._", "test\\u", "retry_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "ERROR", ":", " ", "Retri", "es", " ", "fail", "ed", " ", "for", " ", "table", " ", "'%", "s", "'\"_", ",_", "tablename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Place", " ", "this", " ", "request", " ", "back", " ", "on", " ", "the", " ", "event", " ", "queue", " ", "for", " ", "a", " ", "retr", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "async", "\\u", "add", "\\u", "table", "\\u", "data_", "(_", "table_", ",_", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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 ", " _", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "ERROR", ":", " ", "Fail", "ed", " ", "to", " ", "add", " ", "table", " ", "'%", "s", "':", " ", "%", "s", "\"_", ",_", "tablename_", ",_", "e_", ")_", "\\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 ", " _", "txn_", "._", "execute_", "(_", "\"", "ROLL", "BACK", ";\"_", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nr", "\\u", "rows_", "=_", "table_", "._", "get", "\\u", "nr", "\\u", "rows_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proper", "ties", "\\u", "str_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "static_", ":_", "proper", "ties", "\\u", "str_", "+=_", "'", " ", "static", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "update_", ":_", "proper", "ties", "\\u", "str_", "+=_", "'", " ", "update", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "persist_", ":_", "proper", "ties", "\\u", "str_", "+=_", "'", " ", "persist", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "\"", "Sq", "l", "Connect", "ion", "s", ":", " ", "New", " ", "data", "%", "s", " ", "for", " ", "table", " ", "'%", "s", "'", " ", "%", "d", " ", "rows", " ", "from", " ", "'%", "s", "'", " ", "(%", ".02", "f", " ", "second", "s", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "proper", "ties", "\\u", "str_", ",_", "tablename_", ",_", "rowcount_", ",_", "identity_", ",_", "now_", "-_", "start", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "some", " ", "informati", "onal", " ", "stats", " ", "used", " ", "for", " ", "mak", "ing", " ", "the", " ", "tables_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "connections", " ", "tables", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update", "\\u", "table", "\\u", "stats_", "(_", "tablename_", ",_", "rowcount_", ",_", "identity_", "=_", "identity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sum_", "=_", "not_", "update_", "and_", "not_", "static_", ",_", "now_", "=_", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
colemana/PyPDF2/PyPDF2/merger.py
[ { "content": " def merge(self, position, fileobj, bookmark=None, pages=None, import_bookmarks=True):\n \"\"\"\n >>> merge(position, file, bookmark=None, pages=None, import_bookmarks=True)\n \n Merges the pages from the source document specified by \"file\" into the output\n file at the page number specified by \"position\".\n \n Optionally, you may specify a bookmark to be applied at the beginning of the \n included file by supplying the text of the bookmark in the \"bookmark\" parameter.\n \n You may prevent the source document's bookmarks from being imported by\n specifying \"import_bookmarks\" as False.\n \n You may also use the \"pages\" parameter to merge only the specified range of \n pages from the source document into the output document.\n \"\"\"\n \n my_file = False\n if type(fileobj) in (str, unicode):\n fileobj = file(fileobj, 'rb')\n my_file = True\n \n if type(fileobj) == PdfFileReader:\n pdfr = fileobj\n fileobj = pdfr.file\n else:\n pdfr = PdfFileReader(fileobj)\n \n # Find the range of pages to merge\n if pages == None:\n pages = (0, pdfr.getNumPages())\n elif type(pages) in (int, float, str, unicode):\n raise TypeError('\"pages\" must be a tuple of (start, end)')\n \n srcpages = []\n \n if bookmark:\n bookmark = Bookmark(TextStringObject(bookmark), NumberObject(self.id_count), NameObject('/Fit'))\n \n outline = []\n if import_bookmarks:\n outline = pdfr.getOutlines()\n outline = self._trim_outline(pdfr, outline, pages)\n \n if bookmark:\n self.bookmarks += [bookmark, outline]\n else:\n self.bookmarks += outline\n \n dests = pdfr.namedDestinations\n dests = self._trim_dests(pdfr, dests, pages)\n self.named_dests += dests\n \n # Gather all the pages that are going to be merged\n for i in range(*pages):\n pg = pdfr.getPage(i)\n \n id = self.id_count\n self.id_count += 1\n \n mp = _MergedPage(pg, pdfr, id)\n \n srcpages.append(mp)\n\n self._associate_dests_to_pages(srcpages)\n self._associate_bookmarks_to_pages(srcpages)\n \n \n # Slice to insert the pages at the specified position\n self.pages[position:position] = srcpages\n \n # Keep track of our input files so we can close them later\n self.inputs.append((fileobj, pdfr, my_file))", "metadata": "root.PdfFileMerger.merge", "header": "['class', 'PdfFileMerger', '(', 'object', ')', ':', '___EOS___']", "index": 64 }, { "content": " def _write_bookmarks(self, bookmarks=None, parent=None):\n \n if bookmarks == None:\n bookmarks = self.bookmarks\n \n\n last_added = None\n for b in bookmarks:\n if type(b) == list:\n self._write_bookmarks(b, last_added)\n continue\n \n pageno = None\n pdf = None\n if b.has_key('/Page'):\n for i, p in enumerate(self.pages):\n if p.id == b['/Page']:\n b[NameObject('/Page')] = p.out_pagedata\n pageno = i\n pdf = p.src\n if pageno != None:\n last_added = self.output.addBookmarkDestination(b, parent)", "metadata": "root.PdfFileMerger._write_bookmarks", "header": "['class', 'PdfFileMerger', '(', 'object', ')', ':', '___EOS___']", "index": 248 }, { "content": " def _associate_bookmarks_to_pages(self, pages, bookmarks=None):\n if bookmarks == None:\n bookmarks = self.bookmarks\n\n for b in bookmarks:\n if type(b) == list:\n self._associate_bookmarks_to_pages(pages, b)\n continue\n \n pageno = None\n bp = b['/Page']\n \n if type(bp) == NumberObject:\n continue\n \n for p in pages:\n if bp.getObject() == p.pagedata.getObject():\n pageno = p.id\n \n if pageno != None:\n b[NameObject('/Page')] = NumberObject(pageno)\n else:\n raise ValueError, \"Unresolved bookmark '%s'\" % (b['/Title'],)", "metadata": "root.PdfFileMerger._associate_bookmarks_to_pages", "header": "['class', 'PdfFileMerger', '(', 'object', ')', ':', '___EOS___']", "index": 289 }, { "content": " def findBookmark(self, bookmark, root=None):\n \tif root == None:\n \t\troot = self.bookmarks\n \t\n \tfor i, b in enumerate(root):\n \t\tif type(b) == list:\n \t\t\tres = self.findBookmark(bookmark, b)\n \t\t\tif res:\n \t\t\t\treturn [i] + res\n \t\tif b == bookmark or b['/Title'] == bookmark:\n \t\t\treturn [i]\n \n \treturn None", "metadata": "root.PdfFileMerger.findBookmark", "header": "['class', 'PdfFileMerger', '(', 'object', ')', ':', '___EOS___']", "index": 313 }, { "content": " def addBookmark(self, title, pagenum, parent=None):\n \"\"\"\n Add a bookmark to the pdf, using the specified title and pointing at \n the specified page number. A parent can be specified to make this a\n nested bookmark below the parent.\n \"\"\"\n\n if parent == None:\n \tiloc = [len(self.bookmarks)-1]\n elif type(parent) == list:\n \tiloc = parent\n else:\n \tiloc = self.findBookmark(parent)\n \n dest = Bookmark(TextStringObject(title), NumberObject(pagenum), NameObject('/FitH'), NumberObject(826))\n \n if parent == None:\n \tself.bookmarks.append(dest)\n else:\n \tbmparent = self.bookmarks\n \tfor i in iloc[:-1]:\n \t\tbmparent = bmparent[i]\n \tnpos = iloc[-1]+1\n \tif npos < len(bmparent) and type(bmparent[npos]) == list:\n \t\tbmparent[npos].append(dest)\n \telse:\n \t\tbmparent.insert(npos, [dest])", "metadata": "root.PdfFileMerger.addBookmark", "header": "['class', 'PdfFileMerger', '(', 'object', ')', ':', '___EOS___']", "index": 327 } ]
[ { "span": "pages == None:", "start_line": 93, "start_column": 11, "end_line": 93, "end_column": 24 }, { "span": "bookmarks == None:", "start_line": 250, "start_column": 11, "end_line": 250, "end_column": 28 }, { "span": "bookmarks == None:", "start_line": 290, "start_column": 11, "end_line": 290, "end_column": 28 }, { "span": "root == None:", "start_line": 314, "start_column": 8, "end_line": 314, "end_column": 20 }, { "span": "parent == None:", "start_line": 334, "start_column": 11, "end_line": 334, "end_column": 25 }, { "span": "parent == None:", "start_line": 343, "start_column": 11, "end_line": 343, "end_column": 25 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Pd", "f", "File", "Merge", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge_", "(_", "self_", ",_", "position_", ",_", "fileobj_", ",_", "bookmark_", "=_", "None_", ",_", "pages_", "=_", "None_", ",_", "import", "\\u", "bookmarks_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "merge", "(", "position", ",", " ", "file", ",", " ", "bookmark", "=", "Non", "e", ",", " ", "page", "s", "=", "Non", "e", ",", " ", "import", "\\u", "bookmark", "s", "=", "Tru", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Merge", "s", " ", "the", " ", "page", "s", " ", "from", " ", "the", " ", "source", " ", "document", " ", "specified", " ", "by", " ", "\"", "file", "\"", " ", "int", "o", " ", "the", " ", "output", "\\", "10", ";", " ", " ", " ", " ", "file", " ", "at", " ", "the", " ", "page", " ", "number", " ", "specified", " ", "by", " ", "\"", "position", "\".\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Optio", "nal", "ly", ",", " ", "you", " ", "may", " ", "speci", "fy", " ", "a", " ", "bookmark", " ", "to", " ", "be", " ", "applied", " ", "at", " ", "the", " ", "beginn", "ing", " ", "of", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "include", "d", " ", "file", " ", "by", " ", "supply", "ing", " ", "the", " ", "text", " ", "of", " ", "the", " ", "bookmark", " ", "in", " ", "the", " ", "\"", "bookmark", "\"", " ", "parameter", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "may", " ", "prevent", " ", "the", " ", "source", " ", "document", "'", "s", " ", "bookmark", "s", " ", "from", " ", "bei", "ng", " ", "import", "ed", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "speci", "fy", "ing", " ", "\"", "import", "\\u", "bookmark", "s", "\"", " ", "as", " ", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "may", " ", "als", "o", " ", "use", " ", "the", " ", "\"", "page", "s", "\"", " ", "parameter", " ", "to", " ", "merge", " ", "only", " ", "the", " ", "specified", " ", "range", " ", "of", " ", "\\", "10", ";", " ", " ", " ", " ", "page", "s", " ", "from", " ", "the", " ", "source", " ", "document", " ", "int", "o", " ", "the", " ", "output", " ", "document", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "my", "\\u", "file_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "fileobj_", ")_", "in_", "(_", "str_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fileobj_", "=_", "file_", "(_", "fileobj_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "my", "\\u", "file_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "fileobj_", ")_", "==_", "Pd", "f", "File", "Reader_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pdf", "r_", "=_", "fileobj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fileobj_", "=_", "pdf", "r_", "._", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pdf", "r_", "=_", "Pd", "f", "File", "Reader_", "(_", "fileobj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "the", " ", "range", " ", "of", " ", "page", "s", " ", "to", " ", "merge_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pages_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pages_", "=_", "(_", "0_", ",_", "pdf", "r_", "._", "get", "Num", "Pages_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "pages_", ")_", "in_", "(_", "int_", ",_", "float_", ",_", "str_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'\"", "page", "s", "\"", " ", "must", " ", "be", " ", "a", " ", "tuple", " ", "of", " ", "(", "start", ",", " ", "end", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "srcp", "ages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bookmark_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bookmark_", "=_", "Bookmark", "_", "(_", "Text", "String", "Object_", "(_", "bookmark_", ")_", ",_", "Number", "Object_", "(_", "self_", "._", "id", "\\u", "count_", ")_", ",_", "Name", "Object_", "(_", "'/", "Fit", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outline_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "import", "\\u", "bookmarks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outline_", "=_", "pdf", "r_", "._", "get", "Outline", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outline_", "=_", "self_", "._", "\\u", "trim", "\\u", "outline_", "(_", "pdf", "r_", ",_", "outline_", ",_", "pages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bookmark_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bookmarks_", "+=_", "[_", "bookmark_", ",_", "outline_", "]_", "\\u\\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_", "._", "bookmarks_", "+=_", "outline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest", "s_", "=_", "pdf", "r_", "._", "named", "Dest", "ination", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dest", "s_", "=_", "self_", "._", "\\u", "trim", "\\u", "dest", "s_", "(_", "pdf", "r_", ",_", "dest", "s_", ",_", "pages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "named", "\\u", "dest", "s_", "+=_", "dest", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gather", " ", "all", " ", "the", " ", "page", "s", " ", "tha", "t", " ", "are", " ", "goi", "ng", " ", "to", " ", "be", " ", "merged_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "*_", "pages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pg_", "=_", "pdf", "r_", "._", "get", "Page_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id_", "=_", "self_", "._", "id", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "id", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mp_", "=_", "\\u", "Merged", "Page_", "(_", "pg_", ",_", "pdf", "r_", ",_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "srcp", "ages_", "._", "append_", "(_", "mp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "associate", "\\u", "dest", "s", "\\u", "to", "\\u", "pages_", "(_", "srcp", "ages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "associate", "\\u", "bookmark", "s", "\\u", "to", "\\u", "pages_", "(_", "srcp", "ages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Slice", " ", "to", " ", "insert", " ", "the", " ", "page", "s", " ", "at", " ", "the", " ", "specified", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pages_", "[_", "position_", ":_", "position_", "]_", "=_", "srcp", "ages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Keep", " ", "track", " ", "of", " ", "our", " ", "input", " ", "files", " ", "so", " ", "we", " ", "can", " ", "close", " ", "them", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "inputs_", "._", "append_", "(_", "(_", "fileobj_", ",_", "pdf", "r_", ",_", "my", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pd", "f", "File", "Merge", "r_", "(_", "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", "write", "\\u", "bookmarks_", "(_", "self_", ",_", "bookmarks_", "=_", "None_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bookmarks_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bookmarks_", "=_", "self_", "._", "bookmarks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "added_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "b_", "in_", "bookmarks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "b_", ")_", "==_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "write", "\\u", "bookmarks_", "(_", "b_", ",_", "last", "\\u", "added_", ")_", "\\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_", "pagen", "o_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdf_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "b_", "._", "has", "\\u", "key_", "(_", "'/", "Page", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "p_", "in_", "enumerate_", "(_", "self_", "._", "pages_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "p_", "._", "id_", "==_", "b_", "[_", "'/", "Page", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "b_", "[_", "Name", "Object_", "(_", "'/", "Page", "'_", ")_", "]_", "=_", "p_", "._", "out", "\\u", "paged", "ata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pagen", "o_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pdf_", "=_", "p_", "._", "src_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pagen", "o_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "last", "\\u", "added_", "=_", "self_", "._", "output_", "._", "add", "Bookmark", "Destination_", "(_", "b_", ",_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pd", "f", "File", "Merge", "r_", "(_", "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", "associate", "\\u", "bookmark", "s", "\\u", "to", "\\u", "pages_", "(_", "self_", ",_", "pages_", ",_", "bookmarks_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bookmarks_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bookmarks_", "=_", "self_", "._", "bookmarks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "b_", "in_", "bookmarks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "b_", ")_", "==_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "associate", "\\u", "bookmark", "s", "\\u", "to", "\\u", "pages_", "(_", "pages_", ",_", "b_", ")_", "\\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_", "pagen", "o_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bp_", "=_", "b_", "[_", "'/", "Page", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type_", "(_", "bp_", ")_", "==_", "Number", "Object_", ":_", "\\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_", "for_", "p_", "in_", "pages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bp_", "._", "get", "Object_", "(_", ")_", "==_", "p_", "._", "paged", "ata_", "._", "get", "Object_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pagen", "o_", "=_", "p_", "._", "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_", "if_", "pagen", "o_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "[_", "Name", "Object_", "(_", "'/", "Page", "'_", ")_", "]_", "=_", "Number", "Object_", "(_", "pagen", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", ",_", "\"", "Unre", "solved", " ", "bookmark", " ", "'%", "s", "'\"_", "%_", "(_", "b_", "[_", "'/", "Tit", "le", "'_", "]_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pd", "f", "File", "Merge", "r_", "(_", "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_", "find", "Bookmark", "_", "(_", "self_", ",_", "bookmark_", ",_", "root_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t_", "if_", "root_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "\t_", "root_", "=_", "self_", "._", "bookmarks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "b_", "in_", "enumerate_", "(_", "root_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "\t_", "if_", "type_", "(_", "b_", ")_", "==_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "\t\t_", "res_", "=_", "self_", "._", "find", "Bookmark", "_", "(_", "bookmark_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "\t\t\t_", "return_", "[_", "i_", "]_", "+_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "b_", "==_", "bookmark_", "or_", "b_", "[_", "'/", "Tit", "le", "'_", "]_", "==_", "bookmark_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "\t\t_", "return_", "[_", "i_", "]_", "\\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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pd", "f", "File", "Merge", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Bookmark", "_", "(_", "self_", ",_", "title_", ",_", "pagen", "um_", ",_", "parent_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", " ", "a", " ", "bookmark", " ", "to", " ", "the", " ", "pdf", ",", " ", "usi", "ng", " ", "the", " ", "specified", " ", "title", " ", "and", " ", "pointi", "ng", " ", "at", " ", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "specified", " ", "page", " ", "number", ".", " ", "A", " ", "parent", " ", "can", " ", "be", " ", "specified", " ", "to", " ", "make", " ", "this", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "nest", "ed", " ", "bookmark", " ", "belo", "w", " ", "the", " ", "parent", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "parent_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "_", "iloc_", "=_", "[_", "len_", "(_", "self_", "._", "bookmarks_", ")_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "parent_", ")_", "==_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "_", "iloc_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "_", "iloc_", "=_", "self_", "._", "find", "Bookmark", "_", "(_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest_", "=_", "Bookmark", "_", "(_", "Text", "String", "Object_", "(_", "title_", ")_", ",_", "Number", "Object_", "(_", "pagen", "um_", ")_", ",_", "Name", "Object_", "(_", "'/", "Fit", "H", "'_", ")_", ",_", "Number", "Object_", "(_", "826", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "parent_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "_", "self_", "._", "bookmarks_", "._", "append_", "(_", "dest_", ")_", "\\u\\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", "_", "bm", "parent_", "=_", "self_", "._", "bookmarks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "iloc_", "[_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "\t_", "bm", "parent_", "=_", "bm", "parent_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "npo", "s_", "=_", "iloc_", "[_", "-_", "1_", "]_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "npo", "s_", "<_", "len_", "(_", "bm", "parent_", ")_", "and_", "type_", "(_", "bm", "parent_", "[_", "npo", "s_", "]_", ")_", "==_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " \t", "\t_", "bm", "parent_", "[_", "npo", "s_", "]_", "._", "append_", "(_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDE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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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
CiscoSystems/avos/openstack_dashboard/dashboards/admin/routers/tests.py
[ { "content": " @test.create_stubs({api.neutron: ('router_list', 'network_list',\n 'port_list', 'router_delete',),\n api.keystone: ('tenant_list',)})\n def test_router_delete(self):\n router = self.routers.first()\n tenants = self.tenants.list()\n api.neutron.router_list(\n IsA(http.HttpRequest),\n search_opts=None).AndReturn(self.routers.list())\n api.keystone.tenant_list(IsA(http.HttpRequest))\\\n .AndReturn([tenants, False])\n self._mock_external_network_list()\n api.neutron.router_list(\n IsA(http.HttpRequest),\n search_opts=None).AndReturn(self.routers.list())\n api.keystone.tenant_list(IsA(http.HttpRequest))\\\n .AndReturn([tenants, False])\n self._mock_external_network_list()\n api.neutron.port_list(IsA(http.HttpRequest),\n device_id=router.id, device_owner=IgnoreArg())\\\n .AndReturn([])\n api.neutron.router_delete(IsA(http.HttpRequest), router.id)\n api.neutron.router_list(\n IsA(http.HttpRequest),\n search_opts=None).AndReturn(self.routers.list())\n api.keystone.tenant_list(IsA(http.HttpRequest))\\\n .AndReturn([tenants, False])\n self._mock_external_network_list()\n self.mox.ReplayAll()\n\n res = self.client.get(self.INDEX_URL)\n\n formData = {'action': 'Routers__delete__' + router.id}\n res = self.client.post(self.INDEX_URL, formData, follow=True)\n self.assertNoFormErrors(res)\n self.assertMessageCount(response=res, success=1)\n self.assertIn('Deleted Router: ' + router.name, res.content)", "metadata": "root.RouterTests.test_router_delete", "header": "['class', 'RouterTests', '(', 'test', '.', 'BaseAdminViewTests', ',', 'r_test', '.', 'RouterTests', ')', ':', '___EOS___']", "index": 84 }, { "content": " @test.create_stubs({api.neutron: ('router_list', 'network_list',\n 'port_list', 'router_remove_interface',\n 'router_delete',),\n api.keystone: ('tenant_list',)})\n def test_router_with_interface_delete(self):\n router = self.routers.first()\n ports = self.ports.list()\n tenants = self.tenants.list()\n api.neutron.router_list(\n IsA(http.HttpRequest),\n search_opts=None).AndReturn(self.routers.list())\n api.keystone.tenant_list(IsA(http.HttpRequest))\\\n .AndReturn([tenants, False])\n self._mock_external_network_list()\n api.neutron.router_list(\n IsA(http.HttpRequest),\n search_opts=None).AndReturn(self.routers.list())\n api.keystone.tenant_list(IsA(http.HttpRequest))\\\n .AndReturn([tenants, False])\n self._mock_external_network_list()\n api.neutron.port_list(IsA(http.HttpRequest),\n device_id=router.id, device_owner=IgnoreArg())\\\n .AndReturn(ports)\n for port in ports:\n api.neutron.router_remove_interface(IsA(http.HttpRequest),\n router.id, port_id=port.id)\n api.neutron.router_delete(IsA(http.HttpRequest), router.id)\n api.neutron.router_list(\n IsA(http.HttpRequest),\n search_opts=None).AndReturn(self.routers.list())\n api.keystone.tenant_list(IsA(http.HttpRequest))\\\n .AndReturn([tenants, False])\n self._mock_external_network_list()\n self.mox.ReplayAll()\n\n res = self.client.get(self.INDEX_URL)\n\n formData = {'action': 'Routers__delete__' + router.id}\n res = self.client.post(self.INDEX_URL, formData, follow=True)\n self.assertNoFormErrors(res)\n self.assertMessageCount(response=res, success=1)\n self.assertIn('Deleted Router: ' + router.name, res.content)", "metadata": "root.RouterTests.test_router_with_interface_delete", "header": "['class', 'RouterTests', '(', 'test', '.', 'BaseAdminViewTests', ',', 'r_test', '.', 'RouterTests', ')', ':', '___EOS___']", "index": 122 } ]
[ { "span": "res ", "start_line": 114, "start_column": 8, "end_line": 114, "end_column": 11 }, { "span": "res ", "start_line": 157, "start_column": 8, "end_line": 157, "end_column": 11 } ]
[ { "span": "res ", "start_line": 117, "start_column": 8, "end_line": 117, "end_column": 11 }, { "span": "res ", "start_line": 160, "start_column": 8, "end_line": 160, "end_column": 11 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Route", "r", "Tests_", "(_", "test_", "._", "Base", "Admi", "n", "View", "Tests_", ",_", "r", "\\u", "test_", "._", "Route", "r", "Tests_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "api_", "._", "neutron_", ":_", "(_", "'", "router", "\\u", "list", "'_", ",_", "'", "network", "\\u", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "\\u", "list", "'_", ",_", "'", "router", "\\u", "delete", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "api_", "._", "keystone_", ":_", "(_", "'", "tenan", "t", "\\u", "list", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "router", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "router_", "=_", "self_", "._", "routers_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tenants_", "=_", "self_", "._", "tenants_", "._", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "neutron_", "._", "router", "\\u", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "None_", ")_", "._", "And", "Return_", "(_", "self_", "._", "routers_", "._", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "keystone_", "._", "tenan", "t", "\\u", "list_", "(_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ")_", "._", "And", "Return_", "(_", "[_", "tenants_", ",_", "False_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mock", "\\u", "external", "\\u", "network", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "neutron_", "._", "router", "\\u", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "None_", ")_", "._", "And", "Return_", "(_", "self_", "._", "routers_", "._", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "keystone_", "._", "tenan", "t", "\\u", "list_", "(_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ")_", "._", "And", "Return_", "(_", "[_", "tenants_", ",_", "False_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mock", "\\u", "external", "\\u", "network", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "neutron_", "._", "port", "\\u", "list_", "(_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", "=_", "router_", "._", "id_", ",_", "device", "\\u", "owner_", "=_", "Ignor", "e", "Arg_", "(_", ")_", ")_", "._", "And", "Return_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "neutron_", "._", "router", "\\u", "delete_", "(_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ",_", "router_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "neutron_", "._", "router", "\\u", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "None_", ")_", "._", "And", "Return_", "(_", "self_", "._", "routers_", "._", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "keystone_", "._", "tenan", "t", "\\u", "list_", "(_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ")_", "._", "And", "Return_", "(_", "[_", "tenants_", ",_", "False_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mock", "\\u", "external", "\\u", "network", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "self_", "._", "INDE", "X", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form", "Data_", "=_", "{_", "'", "action", "'_", ":_", "'", "Route", "rs", "\\u\\u", "delete", "\\u\\u'_", "+_", "router_", "._", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "post_", "(_", "self_", "._", "INDE", "X", "\\u", "URL_", ",_", "form", "Data_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "No", "Form", "Errors_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Messag", "e", "Count_", "(_", "response_", "=_", "res_", ",_", "success_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "Delete", "d", " ", "Route", "r", ":", " ", "'_", "+_", "router_", "._", "name_", ",_", "res_", "._", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Route", "r", "Tests_", "(_", "test_", "._", "Base", "Admi", "n", "View", "Tests_", ",_", "r", "\\u", "test_", "._", "Route", "r", "Tests_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "test_", "._", "create", "\\u", "stubs_", "(_", "{_", "api_", "._", "neutron_", ":_", "(_", "'", "router", "\\u", "list", "'_", ",_", "'", "network", "\\u", "list", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "\\u", "list", "'_", ",_", "'", "router", "\\u", "remove", "\\u", "interface", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "router", "\\u", "delete", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "api_", "._", "keystone_", ":_", "(_", "'", "tenan", "t", "\\u", "list", "'_", ",_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "router", "\\u", "with", "\\u", "interface", "\\u", "delete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "router_", "=_", "self_", "._", "routers_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ports_", "=_", "self_", "._", "ports_", "._", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tenants_", "=_", "self_", "._", "tenants_", "._", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "neutron_", "._", "router", "\\u", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "None_", ")_", "._", "And", "Return_", "(_", "self_", "._", "routers_", "._", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "keystone_", "._", "tenan", "t", "\\u", "list_", "(_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ")_", "._", "And", "Return_", "(_", "[_", "tenants_", ",_", "False_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mock", "\\u", "external", "\\u", "network", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "neutron_", "._", "router", "\\u", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "None_", ")_", "._", "And", "Return_", "(_", "self_", "._", "routers_", "._", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "keystone_", "._", "tenan", "t", "\\u", "list_", "(_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ")_", "._", "And", "Return_", "(_", "[_", "tenants_", ",_", "False_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mock", "\\u", "external", "\\u", "network", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "neutron_", "._", "port", "\\u", "list_", "(_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "device", "\\u", "id_", "=_", "router_", "._", "id_", ",_", "device", "\\u", "owner_", "=_", "Ignor", "e", "Arg_", "(_", ")_", ")_", "._", "And", "Return_", "(_", "ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "port_", "in_", "ports_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api_", "._", "neutron_", "._", "router", "\\u", "remove", "\\u", "interface_", "(_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "router_", "._", "id_", ",_", "port", "\\u", "id_", "=_", "port_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "api_", "._", "neutron_", "._", "router", "\\u", "delete_", "(_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ",_", "router_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "neutron_", "._", "router", "\\u", "list_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "opts_", "=_", "None_", ")_", "._", "And", "Return_", "(_", "self_", "._", "routers_", "._", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api_", "._", "keystone_", "._", "tenan", "t", "\\u", "list_", "(_", "Is", "A_", "(_", "http_", "._", "Http", "Request_", ")_", ")_", "._", "And", "Return_", "(_", "[_", "tenants_", ",_", "False_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mock", "\\u", "external", "\\u", "network", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mox_", "._", "Repl", "ay", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "get_", "(_", "self_", "._", "INDE", "X", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form", "Data_", "=_", "{_", "'", "action", "'_", ":_", "'", "Route", "rs", "\\u\\u", "delete", "\\u\\u'_", "+_", "router_", "._", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "client_", "._", "post_", "(_", "self_", "._", "INDE", "X", "\\u", "URL_", ",_", "form", "Data_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "No", "Form", "Errors_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Messag", "e", "Count_", "(_", "response_", "=_", "res_", ",_", "success_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "Delete", "d", " ", "Route", "r", ":", " ", "'_", "+_", "router_", "._", "name_", ",_", "res_", "._", "content_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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etools.py
[ { "content": "def get_gists(uname, ask = False, basedir = ''):\n print\n print \"Cloning gists from %s...\" % uname\n print\n gists = urllib.urlopen(\"https://api.github.com/users/%s/gists\" % uname)\n wingfn = 'gists.wpr'\n if basedir:\n prep_directory(basedir)\n for item in json.loads(gists.readlines()[0]):\n name= '-'.join(item['files'].keys()[-1].split('.'))\n if basedir:\n fpath = '/'.join([basedir, name])\n else:\n fpath = name\n if os.path.exists(fpath): #already cloned\n continue\n desc = item['description']\n idn = item['id']\n url = item['html_url']\n cmd = \"git clone [email protected]:%s.git %s\" % (idn, fpath)\n process(cmd, name, fpath, ask, desc, url,typ=\"gist\")\n print", "metadata": "root.get_gists", "header": "['module', '___EOS___']", "index": 65 } ]
[ { "span": "wingfn ", "start_line": 70, "start_column": 4, "end_line": 70, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "gist", "s_", "(_", "uname_", ",_", "ask_", "=_", "False_", ",_", "basedir_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Clo", "ning", " ", "gist", "s", " ", "from", " ", "%", "s", "...\"_", "%_", "uname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gist", "s_", "=_", "urllib_", "._", "urlopen_", "(_", "\"", "https", "://", "api", ".", "git", "hub", ".", "com", "/", "users", "/", "%", "s", "/", "gist", "s", "\"_", "%_", "uname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wing", "fn_", "=_", "'", "gist", "s", ".", "wp", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "basedir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prep", "\\u", "directory_", "(_", "basedir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "item_", "in_", "json_", "._", "loads_", "(_", "gist", "s_", "._", "readlines_", "(_", ")_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'-'_", "._", "join_", "(_", "item_", "[_", "'", "files", "'_", "]_", "._", "keys_", "(_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'.'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "basedir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fpath_", "=_", "'/'_", "._", "join_", "(_", "[_", "basedir_", ",_", "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 ", " _", "fpath_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "fpath_", ")_", ":_", "#", "alr", "ead", "y", " ", "cloned", "_", "\\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_", "desc_", "=_", "item_", "[_", "'", "description", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idn", "_", "=_", "item_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "item_", "[_", "'", "html", "\\u", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "\"", "git", " ", "clone", " ", "git", "@", "gist", ".", "git", "hub", ".", "com", ":", "%", "s", ".", "git", " ", "%", "s", "\"_", "%_", "(_", "idn", "_", ",_", "fpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process_", "(_", "cmd_", ",_", "name_", ",_", "fpath_", ",_", "ask_", ",_", "desc_", ",_", "url_", ",_", "typ_", "=_", "\"", "gist", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ipython/ipython-py3k/docs/autogen_api.py
[ { "content": "#!/usr/bin/env python\n\"\"\"Script to auto-generate our API docs.\n\"\"\"\n# stdlib imports\nimport os\nimport sys\n\n# local imports\nsys.path.append(os.path.abspath('sphinxext'))\nfrom apigen import ApiDocWriter\n\n#*****************************************************************************\nif __name__ == '__main__':\n pjoin = os.path.join\n package = 'IPython'\n outdir = pjoin('source','api','generated')\n docwriter = ApiDocWriter(package,rst_extension='.txt')\n # You have to escape the . here because . is a special char for regexps.\n # You must do make clean if you change this!\n docwriter.package_skip_patterns += [r'\\.fixes$',\n r'\\.external$',\n r'\\.extensions',\n r'\\.kernel\\.config',\n r'\\.attic',\n r'\\.quarantine',\n r'\\.deathrow',\n r'\\.config\\.default',\n r'\\.config\\.profile',\n r'\\.frontend',\n r'\\.gui',\n r'\\.kernel',\n # For now, the zmq code has\n # unconditional top-level code so it's\n # not import safe. This needs fixing\n r'\\.zmq',\n ]\n\n docwriter.module_skip_patterns += [ r'\\.core\\.fakemodule',\n \n # Keeping these disabled is OK\n r'\\.parallel\\.controller\\.mongodb',\n r'\\.lib\\.inputhookwx',\n r'\\.lib\\.inputhookgtk',\n r'\\.cocoa',\n r'\\.ipdoctest',\n r'\\.Gnuplot',\n r'\\.frontend\\.process\\.winprocess',\n r'\\.Shell',\n ]\n \n # If we don't have pexpect, we can't load irunner, so skip any code that\n # depends on it\n try:\n import pexpect\n except ImportError:\n docwriter.module_skip_patterns += [r'\\.lib\\.irunner',\n r'\\.testing\\.mkdoctests']\n # Now, generate the outputs\n docwriter.write_api_docs(outdir)\n docwriter.write_index(outdir, 'gen',\n relative_to = pjoin('source','api')\n )\n print('%d files written' % len(docwriter.written_modules))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import pexpect", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 22 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Script", " ", "to", " ", "auto", "-", "generat", "e", " ", "our", " ", "API", " ", "docs", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "stdlib", " ", "imports_", "\\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_", "#", " ", "local", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "'", "sphinx", "ext", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "api", "gen_", "import_", "Ap", "i", "Doc", "Writer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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 ", " _", "pjoin_", "=_", "os_", "._", "path_", "._", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "package_", "=_", "'", "IP", "yth", "on", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outdir_", "=_", "pjoin_", "(_", "'", "source", "'_", ",_", "'", "api", "'_", ",_", "'", "generat", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc", "writer_", "=_", "Ap", "i", "Doc", "Writer_", "(_", "package_", ",_", "rst", "\\u", "extension_", "=_", "'.", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "You", " ", "have", " ", "to", " ", "escape", " ", "the", " ", ".", " ", "here", " ", "bec", "aus", "e", " ", ".", " ", "is", " ", "a", " ", "special", " ", "char", " ", "for", " ", "regexp", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "must", " ", "do", " ", "make", " ", "clean", " ", "if", " ", "you", " ", "change", " ", "this", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "writer_", "._", "package", "\\u", "skip", "\\u", "patterns_", "+=_", "[_", "r", "'\\\\.", "fixes", "$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "external", "$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "extensi", "ons", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "kernel", "\\\\.", "config", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "atti", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "quar", "antin", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "death", "row", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "config", "\\\\.", "default", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "config", "\\\\.", "profile", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "front", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "gui", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "kernel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "now", ",", " ", "the", " ", "zmq", " ", "code", " ", "has_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "uncon", "dition", "al", " ", "top", "-", "level", " ", "code", " ", "so", " ", "it", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "import", " ", "safe", ".", " ", " ", "Thi", "s", " ", "need", "s", " ", "fix", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "zmq", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "doc", "writer_", "._", "module", "\\u", "skip", "\\u", "patterns_", "+=_", "[_", "r", "'\\\\.", "core", "\\\\.", "fake", "module", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Keep", "ing", " ", "these", " ", "disable", "d", " ", "is", " ", "OK_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "parall", "el", "\\\\.", "controlle", "r", "\\\\.", "mongodb", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "lib", "\\\\.", "input", "hook", "wx", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "lib", "\\\\.", "input", "hook", "gtk", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "coco", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "ipd", "oct", "est", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "Gnu", "plot", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "front", "end", "\\\\.", "process", "\\\\.", "win", "process", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "Shel", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "don", "'", "t", " ", "have", " ", "pex", "pect", ",", " ", "we", " ", "can", "'", "t", " ", "load", " ", "ir", "unne", "r", ",", " ", "so", " ", "skip", " ", "any", " ", "code", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "depend", "s", " ", "on", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pexpect_", "\\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 ", " _", "doc", "writer_", "._", "module", "\\u", "skip", "\\u", "patterns_", "+=_", "[_", "r", "'\\\\.", "lib", "\\\\.", "ir", "unne", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\.", "testi", "ng", "\\\\.", "mkd", "oct", "ests", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "generat", "e", " ", "the", " ", "outputs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "doc", "writer_", "._", "write", "\\u", "api", "\\u", "docs_", "(_", "outdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc", "writer_", "._", "write", "\\u", "index_", "(_", "outdir_", ",_", "'", "gen", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relative", "\\u", "to_", "=_", "pjoin_", "(_", "'", "source", "'_", ",_", "'", "api", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'%", "d", " ", "files", " ", "writt", "en", "'_", "%_", "len_", "(_", "doc", "writer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ardi/RobotBrain/robot_brain/gpio_pin.py
[ { "content": " def set_normalized(self, value):\n if value >= 0.5:\n self.set(1)\n elif value < 0.5:\n self.set(0)", "metadata": "root.GPIOPin.set_normalized", "header": "['class', 'GPIOPin', '(', 'object', ')', ':', '___EOS___']", "index": 34 } ]
[ { "span": "value < 0.5:", "start_line": 37, "start_column": 13, "end_line": 37, "end_column": 24 } ]
[ { "span": "value >= 0.5:", "start_line": 35, "start_column": 11, "end_line": 35, "end_column": 23 } ]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "class_", "GPIO", "Pin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "normalized_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", ">=_", "0.5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "<_", "0.5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Impactstory/total-impact-core/test/unit_tests/providers/test_wikipedia.py
[ { "content": "from test.unit_tests.providers import common\nfrom test.unit_tests.providers.common import ProviderTestCase\nfrom totalimpact.providers.provider import Provider, ProviderContentMalformedError\nfrom test.utils import http\n\nimport os\nimport collections\nfrom nose.tools import assert_equals, raises\n\ndatadir = os.path.join(os.path.split(__file__)[0], \"../../../extras/sample_provider_pages/wikipedia\")\nSAMPLE_EXTRACT_METRICS_PAGE = os.path.join(datadir, \"metrics\")\nSAMPLE_EXTRACT_ALIASES_PAGE = os.path.join(datadir, \"aliases\")\nSAMPLE_EXTRACT_MEMBER_ITEMS_PAGE = os.path.join(datadir, \"members\")\nSAMPLE_EXTRACT_BIBLIO_PAGE = os.path.join(datadir, \"biblio\")\n\nTEST_DOI = \"10.1371/journal.pcbi.1000361\"\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestWikipedia(ProviderTestCase):\n\n provider_name = \"wikipedia\"\n\n testitem_metrics = (\"doi\", TEST_DOI)\n testitem_aliases = (\"doi\", TEST_DOI)\n testitem_biblio = None\n testitem_members = None\n\n\n \n\n \n", "metadata": "root.TestWikipedia", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def setUp(self):\n ProviderTestCase.setUp(self)", "metadata": "root.TestWikipedia.setUp", "header": "['class', 'TestWikipedia', '(', 'ProviderTestCase', ')', ':', '___EOS___']", "index": 26 }, { "content": " def test_is_relevant_alias(self):\n # ensure that it matches an appropriate ids\n assert_equals(self.provider.is_relevant_alias(self.testitem_aliases), True)\n\n ### Is there anything that wikipedia shouldn't match? ", "metadata": "root.TestWikipedia.test_is_relevant_alias", "header": "['class', 'TestWikipedia', '(', 'ProviderTestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_extract_metrics_success(self):\n f = open(SAMPLE_EXTRACT_METRICS_PAGE, \"r\")\n good_page = f.read()\n metrics_dict = self.provider._extract_metrics(good_page)\n assert_equals(metrics_dict[\"wikipedia:mentions\"], 1)", "metadata": "root.TestWikipedia.test_extract_metrics_success", "header": "['class', 'TestWikipedia', '(', 'ProviderTestCase', ')', ':', '___EOS___']", "index": 35 }, { "content": " def test_extract_metrics_empty(self):\n # now give it something with no results\n empty_page = \"\"\"<?xml version=\"1.0\"?>\n <api>\n <query>\n <searchinfo totalhits=\"0\" />\n <search></search>\n </query>\n </api>\n \"\"\"\n res = self.provider._extract_metrics(empty_page)\n assert_equals(res, {})", "metadata": "root.TestWikipedia.test_extract_metrics_empty", "header": "['class', 'TestWikipedia', '(', 'ProviderTestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": " @raises(ProviderContentMalformedError) \n def test_extract_metrics_invalid(self):\n incorrect_doc = \"\"\"this isn't the wikipedia search result page you are looking for\"\"\"\n self.provider._extract_metrics(incorrect_doc)", "metadata": "root.TestWikipedia.test_extract_metrics_invalid", "header": "['class', 'TestWikipedia', '(', 'ProviderTestCase', ')', ':', '___EOS___']", "index": 54 }, { "content": " @http\n def test_metrics(self):\n metrics_dict = self.provider.metrics([self.testitem_metrics])\n expected = {'wikipedia:mentions': (1, 'http://en.wikipedia.org/wiki/Special:Search?search=\"10.1371/journal.pcbi.1000361\"&go=Go')}\n print metrics_dict\n for key in expected:\n assert metrics_dict[key][0] >= expected[key][0], [key, metrics_dict[key], expected[key]]\n assert metrics_dict[key][1] == expected[key][1], [key, metrics_dict[key], expected[key]]", "metadata": "root.TestWikipedia.test_metrics", "header": "['class', 'TestWikipedia', '(', 'ProviderTestCase', ')', ':', '___EOS___']", "index": 59 } ]
[ { "span": "from test.unit_tests.providers import common", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 44 }, { "span": "from totalimpact.providers.provider import Provider, ProviderContentMalformedError", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 82 }, { "span": "import collections", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "test_", "._", "unit", "\\u", "tests_", "._", "providers_", "import_", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test_", "._", "unit", "\\u", "tests_", "._", "providers_", "._", "common_", "import_", "Provider", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "total", "impact", "_", "._", "providers_", "._", "provider_", "import_", "Provider_", ",_", "Provider", "Conten", "t", "Mal", "formed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test_", "._", "utils_", "import_", "http_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "equals_", ",_", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "datadir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "split_", "(_", "\\u\\u", "file\\u\\u_", ")_", "[_", "0_", "]_", ",_", "\"../..", "/../", "extra", "s", "/", "sample", "\\u", "provide", "r", "\\u", "page", "s", "/", "wikip", "edia", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SAMPLE", "\\u", "EXTRACT", "\\u", "METRICS", "\\u", "PAGE_", "=_", "os_", "._", "path_", "._", "join_", "(_", "datadir_", ",_", "\"", "metric", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SAMPLE", "\\u", "EXTRACT", "\\u", "ALIAS", "ES", "\\u", "PAGE_", "=_", "os_", "._", "path_", "._", "join_", "(_", "datadir_", ",_", "\"", "alias", "es", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SAMPLE", "\\u", "EXTRACT", "\\u", "MEMBER", "\\u", "ITEM", "S", "\\u", "PAGE_", "=_", "os_", "._", "path_", "._", "join_", "(_", "datadir_", ",_", "\"", "member", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SAMPLE", "\\u", "EXTRACT", "\\u", "BIB", "LI", "O", "\\u", "PAGE_", "=_", "os_", "._", "path_", "._", "join_", "(_", "datadir_", ",_", "\"", "biblio", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "DOI", "_", "=_", "\"", "10.1", "371", "/", "journal", ".", "pc", "bi", ".1", "0003", "6", "1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Wiki", "pedi", "a_", "(_", "Provider", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "provide", "r", "\\u", "name_", "=_", "\"", "wikip", "edia", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "testi", "tem", "\\u", "metrics_", "=_", "(_", "\"", "doi", "\"_", ",_", "TEST", "\\u", "DOI", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testi", "tem", "\\u", "aliases_", "=_", "(_", "\"", "doi", "\"_", ",_", "TEST", "\\u", "DOI", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testi", "tem", "\\u", "biblio", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "testi", "tem", "\\u", "members_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Wiki", "pedi", "a_", "(_", "Provider", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Provider", "Test", "Case_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Wiki", "pedi", "a_", "(_", "Provider", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "is", "\\u", "rele", "van", "t", "\\u", "alias_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ensure", " ", "tha", "t", " ", "it", " ", "matche", "s", " ", "an", " ", "appropr", "iate", " ", "ids_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "equals_", "(_", "self_", "._", "provider_", "._", "is", "\\u", "rele", "van", "t", "\\u", "alias_", "(_", "self_", "._", "testi", "tem", "\\u", "aliases_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Is", " ", "there", " ", "anyt", "hing", " ", "tha", "t", " ", "wikip", "edia", " ", "shou", "ld", "n", "'", "t", " ", "match", "?", " _", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Wiki", "pedi", "a_", "(_", "Provider", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "extract", "\\u", "metric", "s", "\\u", "success_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "SAMPLE", "\\u", "EXTRACT", "\\u", "METRICS", "\\u", "PAGE_", ",_", "\"", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "good", "\\u", "page_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metric", "s", "\\u", "dict_", "=_", "self_", "._", "provider_", "._", "\\u", "extract", "\\u", "metrics_", "(_", "good", "\\u", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "metric", "s", "\\u", "dict_", "[_", "\"", "wikip", "edia", ":", "mentions", "\"_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Wiki", "pedi", "a_", "(_", "Provider", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "extract", "\\u", "metric", "s", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "give", " ", "it", " ", "somet", "hing", " ", "with", " ", "no", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "empty", "\\u", "page_", "=_", "\"\"\"", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"?", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "api", ">", "\\", "10", ";", " ", " ", "<", "query", ">", "\\", "10", ";", " ", " ", "<", "search", "info", " ", "total", "hits", "=\"", "0", "\"", " ", "/>", "\\", "10", ";", " ", " ", "<", "search", "><", "/", "search", ">", "\\", "10", ";", " ", " ", "</", "query", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "api", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "self_", "._", "provider_", "._", "\\u", "extract", "\\u", "metrics_", "(_", "empty", "\\u", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equals_", "(_", "res_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Wiki", "pedi", "a_", "(_", "Provider", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "raises_", "(_", "Provider", "Conten", "t", "Mal", "formed", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "extract", "\\u", "metric", "s", "\\u", "invalid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "incorrect", "\\u", "doc_", "=_", "\"\"\"", "this", " ", "isn", "'", "t", " ", "the", " ", "wikip", "edia", " ", "search", " ", "result", " ", "page", " ", "you", " ", "are", " ", "look", "ing", " ", "for", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "provider_", "._", "\\u", "extract", "\\u", "metrics_", "(_", "incorrect", "\\u", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Wiki", "pedi", "a_", "(_", "Provider", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "http_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "metrics_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metric", "s", "\\u", "dict_", "=_", "self_", "._", "provider_", "._", "metrics_", "(_", "[_", "self_", "._", "testi", "tem", "\\u", "metrics_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "'", "wikip", "edia", ":", "mentions", "'_", ":_", "(_", "1_", ",_", "'", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "Special", ":", "Sear", "ch", "?", "search", "=\"", "10.1", "371", "/", "journal", ".", "pc", "bi", ".1", "0003", "6", "1", "\"&", "go", "=", "Go", "'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "metric", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "expected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "metric", "s", "\\u", "dict_", "[_", "key_", "]_", "[_", "0_", "]_", ">=_", "expected_", "[_", "key_", "]_", "[_", "0_", "]_", ",_", "[_", "key_", ",_", "metric", "s", "\\u", "dict_", "[_", "key_", "]_", ",_", "expected_", "[_", "key_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "metric", "s", "\\u", "dict_", "[_", "key_", "]_", "[_", "1_", "]_", "==_", "expected_", "[_", "key_", "]_", "[_", "1_", "]_", ",_", "[_", "key_", ",_", "metric", "s", "\\u", "dict_", "[_", "key_", "]_", ",_", "expected_", "[_", "key_", "]_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
jpwatts/django-positions/positions/examples/migration/migrations/0002_insert_test_data.py
[ { "content": "def add_test_data(apps, schema_editor):\n # We can't import the Person model directly as it may be a newer\n # version than this migration expects. We use the historical version.\n MigrationTest = apps.get_model(\"migration\", \"MigrationTest\")\n test_record = MigrationTest.objects.create(name='Test Name', age=99, favorite_color='Red')", "metadata": "root.add_test_data", "header": "['module', '___EOS___']", "index": 7 } ]
[ { "span": "test_record ", "start_line": 11, "start_column": 4, "end_line": 11, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "add", "\\u", "test\\u", "data_", "(_", "apps_", ",_", "schema", "\\u", "editor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "can", "'", "t", " ", "import", " ", "the", " ", "Person", " ", "model", " ", "direct", "ly", " ", "as", " ", "it", " ", "may", " ", "be", " ", "a", " ", "newe", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "version", " ", "than", " ", "this", " ", "migrati", "on", " ", "expect", "s", ".", " ", "We", " ", "use", " ", "the", " ", "historical", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Migrat", "ion", "Test_", "=_", "apps_", "._", "get", "\\u", "model_", "(_", "\"", "migrati", "on", "\"_", ",_", "\"", "Migrat", "ion", "Test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "record_", "=_", "Migrat", "ion", "Test_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "'", "Test", " ", "Name", "'_", ",_", "age_", "=_", "99_", ",_", "favorite", "\\u", "color_", "=_", "'", "Red", "'_", ")_", "\\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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
kivy/kivy/kivy/uix/recyclelayout.py
[ { "content": " def compute_sizes_from_data(self, data, flags):\n if [f for f in flags if not f]:\n # at least one changed data unpredictably\n self.clear_layout()\n opts = self.view_opts = [None for _ in data]\n else:\n opts = self.view_opts\n changed = False\n for flag in flags:\n for k, v in flag.items():\n changed = True\n if k == 'removed':\n del opts[v]\n elif k == 'appended':\n opts.extend([None, ] * (v.stop - v.start))\n elif k == 'inserted':\n opts.insert(v, None)\n elif k == 'modified':\n start, stop, step = v.start, v.stop, v.step\n r = range (start, stop) if step == None else \\\n range(start, stop, step)\n for i in r:\n opts[i] = None\n else:\n raise Exception('Unrecognized data flag {}'.format(k))\n\n if changed:\n self.clear_layout()\n\n assert len(data) == len(opts)\n ph_key = self.key_pos_hint\n ph_def = self.default_pos_hint\n sh_key = self.key_size_hint\n sh_def = self.default_size_hint\n s_key = self.key_size\n s_def = self.default_size\n viewcls_def = self.viewclass\n viewcls_key = self.key_viewclass\n iw, ih = self.initial_size\n\n sh = []\n for i, item in enumerate(data):\n if opts[i] is not None:\n continue\n\n ph = ph_def if ph_key is None else item.get(ph_key, ph_def)\n ph = item.get('pos_hint', ph)\n\n sh = sh_def if sh_key is None else item.get(sh_key, sh_def)\n sh = item.get('size_hint', sh)\n sh = [item.get('size_hint_x', sh[0]),\n item.get('size_hint_y', sh[1])]\n\n s = s_def if s_key is None else item.get(s_key, s_def)\n s = item.get('size', s)\n w, h = s = item.get('width', s[0]), item.get('height', s[1])\n\n viewcls = None\n if viewcls_key is not None:\n viewcls = item.get(viewcls_key)\n if viewcls is not None:\n viewcls = getattr(Factory, viewcls)\n if viewcls is None:\n viewcls = viewcls_def\n\n opts[i] = {\n 'size': [(iw if w is None else w), (ih if h is None else h)],\n 'size_hint': sh, 'pos': None, 'pos_hint': ph,\n 'viewclass': viewcls, 'width_none': w is None,\n 'height_none': h is None}", "metadata": "root.RecycleLayout.compute_sizes_from_data", "header": "['class', 'RecycleLayout', '(', 'RecycleLayoutManagerBehavior', ',', 'Layout', ')', ':', '___EOS___']", "index": 84 } ]
[ { "span": "step == None ", "start_line": 103, "start_column": 51, "end_line": 103, "end_column": 63 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Rec", "ycle", "Layout_", "(_", "Rec", "ycle", "Lay", "out", "Manager", "Behavior_", ",_", "Layout_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute", "\\u", "size", "s", "\\u", "from", "\\u", "data_", "(_", "self_", ",_", "data_", ",_", "flags_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "[_", "f_", "for_", "f_", "in_", "flags_", "if_", "not_", "f_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "at", " ", "leas", "t", " ", "one", " ", "change", "d", " ", "data", " ", "unpr", "edic", "tab", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "self_", "._", "view", "\\u", "opts_", "=_", "[_", "None_", "for_", "\\u_", "in_", "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 ", " _", "opts_", "=_", "self_", "._", "view", "\\u", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "changed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "flag_", "in_", "flags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", ",_", "v_", "in_", "flag_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "changed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "k_", "==_", "'", "remove", "d", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "opts_", "[_", "v_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "k_", "==_", "'", "append", "ed", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "opts_", "._", "extend_", "(_", "[_", "None_", ",_", "]_", "*_", "(_", "v_", "._", "stop_", "-_", "v_", "._", "start_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "k_", "==_", "'", "inserted", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "opts_", "._", "insert_", "(_", "v_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "k_", "==_", "'", "modifi", "ed", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "start_", ",_", "stop_", ",_", "step_", "=_", "v_", "._", "start_", ",_", "v_", "._", "stop_", ",_", "v_", "._", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "range_", "(_", "start_", ",_", "stop_", ")_", "if_", "step_", "==_", "None_", "else_", "range_", "(_", "start_", ",_", "stop_", ",_", "step_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "opts_", "[_", "i_", "]_", "=_", "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 ", " ", " _", "raise_", "Exception_", "(_", "'", "Unre", "cogni", "zed", " ", "data", " ", "flag", " ", "{}'_", "._", "format_", "(_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "changed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "len_", "(_", "opts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ph", "\\u", "key_", "=_", "self_", "._", "key", "\\u", "pos", "\\u", "hint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ph", "\\u", "def_", "=_", "self_", "._", "default", "\\u", "pos", "\\u", "hint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh", "\\u", "key_", "=_", "self_", "._", "key", "\\u", "size", "\\u", "hint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh", "\\u", "def_", "=_", "self_", "._", "default", "\\u", "size", "\\u", "hint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s", "\\u", "key_", "=_", "self_", "._", "key", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s", "\\u", "def_", "=_", "self_", "._", "default", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "cls", "\\u", "def_", "=_", "self_", "._", "view", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "cls", "\\u", "key_", "=_", "self_", "._", "key", "\\u", "view", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iw", "_", ",_", "ih", "_", "=_", "self_", "._", "initial", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sh_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "item_", "in_", "enumerate_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opts_", "[_", "i_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ph_", "=_", "ph", "\\u", "def_", "if_", "ph", "\\u", "key_", "is_", "None_", "else_", "item_", "._", "get_", "(_", "ph", "\\u", "key_", ",_", "ph", "\\u", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ph_", "=_", "item_", "._", "get_", "(_", "'", "pos", "\\u", "hin", "t", "'_", ",_", "ph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sh_", "=_", "sh", "\\u", "def_", "if_", "sh", "\\u", "key_", "is_", "None_", "else_", "item_", "._", "get_", "(_", "sh", "\\u", "key_", ",_", "sh", "\\u", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "=_", "item_", "._", "get_", "(_", "'", "size", "\\u", "hin", "t", "'_", ",_", "sh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sh_", "=_", "[_", "item_", "._", "get_", "(_", "'", "size", "\\u", "hin", "t", "\\u", "x", "'_", ",_", "sh_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item_", "._", "get_", "(_", "'", "size", "\\u", "hin", "t", "\\u", "y", "'_", ",_", "sh_", "[_", "1_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "s", "\\u", "def_", "if_", "s", "\\u", "key_", "is_", "None_", "else_", "item_", "._", "get_", "(_", "s", "\\u", "key_", ",_", "s", "\\u", "def_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "item_", "._", "get_", "(_", "'", "size", "'_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", ",_", "h_", "=_", "s_", "=_", "item_", "._", "get_", "(_", "'", "widt", "h", "'_", ",_", "s_", "[_", "0_", "]_", ")_", ",_", "item_", "._", "get_", "(_", "'", "height", "'_", ",_", "s_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "cls_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "view", "cls", "\\u", "key_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view", "cls_", "=_", "item_", "._", "get_", "(_", "view", "cls", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "view", "cls_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "view", "cls_", "=_", "getattr_", "(_", "Factory_", ",_", "view", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "view", "cls_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view", "cls_", "=_", "view", "cls", "\\u", "def_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "opts_", "[_", "i_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "[_", "(_", "iw", "_", "if_", "w_", "is_", "None_", "else_", "w_", ")_", ",_", "(_", "ih", "_", "if_", "h_", "is_", "None_", "else_", "h_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "\\u", "hin", "t", "'_", ":_", "sh_", ",_", "'", "pos", "'_", ":_", "None_", ",_", "'", "pos", "\\u", "hin", "t", "'_", ":_", "ph_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "view", "class", "'_", ":_", "view", "cls_", ",_", "'", "widt", "h", "\\u", "none", "'_", ":_", "w_", "is_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "height", "\\u", "none", "'_", ":_", "h_", "is_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Except block handles 'BaseException'
francelabs/datafari/debian7/zookeeper/contrib/zkpython/src/test/acl_test.py
[ { "content": " def setUp(self):\n zktestbase.TestBase.setUp(self)\n try:\n zookeeper.delete(self.handle, \"/zk-python-acltest\")\n zookeeper.delete(self.handle, \"/zk-python-aacltest\")\n except:\n pass", "metadata": "root.ACLTest.setUp", "header": "['class', 'ACLTest', '(', 'zktestbase', '.', 'TestBase', ')', ':', '___EOS___']", "index": 26 } ]
[ { "span": "except:", "start_line": 31, "start_column": 6, "end_line": 31, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "ACL", "Test_", "(_", "zk", "testb", "ase_", "._", "Test", "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 ", " _", "zk", "testb", "ase_", "._", "Test", "Base_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zookeeper", "_", "._", "delete_", "(_", "self_", "._", "handle_", ",_", "\"/", "zk", "-", "python", "-", "acl", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zookeeper", "_", "._", "delete_", "(_", "self_", "._", "handle_", ",_", "\"/", "zk", "-", "python", "-", "aac", "lte", "st", "\"_", ")_", "\\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_" ]
[ 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, 0, 1, 1, 2, 2, 2, 2, 2 ]
Unused local variable
cloudera/hue/desktop/core/ext-py/Mako-0.8.1/test/test_loop.py
[ { "content": " def test_nested_loops(self):\n template = Template(\"\"\"% for x in 'ab':\n${x} ${loop.index} <- start in outer loop\n% for y in [0, 1]:\n${y} ${loop.index} <- go to inner loop\n% endfor\n${x} ${loop.index} <- back to outer loop\n% endfor\"\"\")\n code = template.code\n rendered = template.render()\n expected = [\n \"a 0 <- start in outer loop\",\n \"0 0 <- go to inner loop\",\n \"1 1 <- go to inner loop\",\n \"a 0 <- back to outer loop\",\n \"b 1 <- start in outer loop\",\n \"0 0 <- go to inner loop\",\n \"1 1 <- go to inner loop\",\n \"b 1 <- back to outer loop\",\n ]\n for line in expected:\n assert line in rendered, \"The LoopStack allows you to take \"\\\n \"advantage of the loop variable even in embedded loops\"", "metadata": "root.TestLoop.test_nested_loops", "header": "['class', 'TestLoop', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 61 } ]
[ { "span": "code ", "start_line": 69, "start_column": 8, "end_line": 69, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Loop_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "nest", "ed", "\\u", "loops_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "Template_", "(_", "\"\"\"", "%", " ", "for", " ", "x", " ", "in", " ", "'", "ab", "':", "\\", "10", ";", "${", "x", "}", " ", "${", "loop", ".", "index", "}", " ", "<-", " ", "start", " ", "in", " ", "outer", " ", "loop", "\\", "10", ";", "%", " ", "for", " ", "y", " ", "in", " ", "[", "0", ",", " ", "1", "]:", "\\", "10", ";", "${", "y", "}", " ", "${", "loop", ".", "index", "}", " ", "<-", " ", "go", " ", "to", " ", "inner", " ", "loop", "\\", "10", ";", "%", " ", "endf", "or", "\\", "10", ";", "${", "x", "}", " ", "${", "loop", ".", "index", "}", " ", "<-", " ", "back", " ", "to", " ", "outer", " ", "loop", "\\", "10", ";", "%", " ", "endf", "or", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "template_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rendered_", "=_", "template_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "a", " ", "0", " ", "<-", " ", "start", " ", "in", " ", "outer", " ", "loop", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "0", " ", "0", " ", "<-", " ", "go", " ", "to", " ", "inner", " ", "loop", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "1", " ", "1", " ", "<-", " ", "go", " ", "to", " ", "inner", " ", "loop", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "a", " ", "0", " ", "<-", " ", "back", " ", "to", " ", "outer", " ", "loop", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "b", " ", "1", " ", "<-", " ", "start", " ", "in", " ", "outer", " ", "loop", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "0", " ", "0", " ", "<-", " ", "go", " ", "to", " ", "inner", " ", "loop", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "1", " ", "1", " ", "<-", " ", "go", " ", "to", " ", "inner", " ", "loop", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "b", " ", "1", " ", "<-", " ", "back", " ", "to", " ", "outer", " ", "loop", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "expected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "line_", "in_", "rendered_", ",_", "\"", "The", " ", "Loop", "Stack", " ", "allow", "s", " ", "you", " ", "to", " ", "take", " ", "\"_", "\"", "advantage", " ", "of", " ", "the", " ", "loop", " ", "variab", "le", " ", "even", " ", "in", " ", "embedde", "d", " ", "loop", "s", "\"_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ionelmc/django-monkey-team/src/monkey_team/forms.py
[ { "content": "from Crypto.Cipher import AES\n\nfrom django import forms\nfrom django.forms import ValidationError\nfrom .utils import get_decode_key\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class DecodeForm(forms.Form):\n optional_decode_key = forms.CharField(required=False)\n message = forms.CharField(widget=forms.Textarea, required=True)\n\n", "metadata": "root.DecodeForm", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def clean_optional_decode_key(self):\n optional_decode_key = self.cleaned_data['optional_decode_key'].strip()\n if optional_decode_key:\n if len(optional_decode_key) != 64:\n raise ValidationError('Invalid length for decode key !')\n try:\n decode_key = optional_decode_key.decode('hex')\n except TypeError as e:\n raise ValidationError('Cannot convert to binary: %r' % e.msg)\n\n return decode_key", "metadata": "root.DecodeForm.clean_optional_decode_key", "header": "['class', 'DecodeForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 10 }, { "content": " def clean_message(self):\n message = self.cleaned_data['message']\n try:\n message = message.decode('base64')\n except TypeError as e:\n raise ValidationError('Cannot convert to binary: %r' % e.msg)\n\n if len(message) % 16:\n raise ValidationError('Wrong block size for message !')\n\n if len(message) <= 16:\n raise ValidationError('Message too short or missing IV !')\n\n return message", "metadata": "root.DecodeForm.clean_message", "header": "['class', 'DecodeForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 22 } ]
[ { "span": "from Crypto.Cipher import AES", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "Crypto_", "._", "Cipher_", "import_", "AES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "import_", "Validat", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "get", "\\u", "decode", "\\u", "key_", "\\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_", "Decode", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option", "al", "\\u", "decode", "\\u", "key_", "=_", "forms_", "._", "Char", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Textarea_", ",_", "required_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Decode", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clean", "\\u", "option", "al", "\\u", "decode", "\\u", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option", "al", "\\u", "decode", "\\u", "key_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "option", "al", "\\u", "decode", "\\u", "key", "'_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "option", "al", "\\u", "decode", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "option", "al", "\\u", "decode", "\\u", "key_", ")_", "!=_", "64_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "length", " ", "for", " ", "decode", " ", "key", " ", "!'_", ")_", "\\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 ", " _", "decode", "\\u", "key_", "=_", "option", "al", "\\u", "decode", "\\u", "key_", "._", "decode_", "(_", "'", "hex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Cann", "ot", " ", "convert", " ", "to", " ", "binar", "y", ":", " ", "%", "r", "'_", "%_", "e_", "._", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decode", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Decode", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "[_", "'", "message", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "message_", "._", "decode_", "(_", "'", "base64", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Cann", "ot", " ", "convert", " ", "to", " ", "binar", "y", ":", " ", "%", "r", "'_", "%_", "e_", "._", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "message_", ")_", "%_", "16_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Wro", "ng", " ", "block", " ", "size", " ", "for", " ", "message", " ", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "message_", ")_", "<=_", "16_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Messag", "e", " ", "too", " ", "short", " ", "or", " ", "missi", "ng", " ", "IV", " ", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "message_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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\n# Copyright 2011-2016, Nigel Small\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\nfrom py2neo import PRODUCT\nfrom py2neo.database.auth import ServerAddress, keyring\nfrom py2neo.database.status import GraphError, Unauthorized\nfrom py2neo.packages.httpstream import http, ClientError, ServerError, \\\n Resource as _Resource, ResourceTemplate as _ResourceTemplate\nfrom py2neo.packages.httpstream.http import JSONResponse, user_agent\nfrom py2neo.packages.httpstream.numbers import UNAUTHORIZED\nfrom py2neo.packages.httpstream.packages.urimagic import URI\nfrom py2neo.util import raise_from\n\nhttp.default_encoding = \"UTF-8\"\n\n_http_headers = {\n (None, None, None): [\n (\"User-Agent\", user_agent(PRODUCT)),\n (\"X-Stream\", \"true\"),\n ],\n}\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def set_http_header(key, value, scheme=None, host=None, port=None):\n \"\"\" Add an HTTP header for all future requests. If a `host_port` is\n specified, this header will only be included in requests to that\n destination.\n\n :arg key: name of the HTTP header\n :arg value: value of the HTTP header\n :arg scheme:\n :arg host:\n :arg port:\n \"\"\"\n address_key = (scheme, host, port)\n if address_key in _http_headers:\n _http_headers[address_key].append((key, value))\n else:\n _http_headers[address_key] = [(key, value)]", "metadata": "root.set_http_header", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def get_http_headers(scheme, host, port):\n \"\"\"Fetch all HTTP headers relevant to the `host_port` provided.\n\n :arg scheme:\n :arg host:\n :arg port:\n \"\"\"\n uri_headers = {}\n for (s, h, p), headers in _http_headers.items():\n if (s is None or s == scheme) and (h is None or h == host) and (p is None or p == port):\n uri_headers.update(headers)\n for address, auth in keyring.items():\n if auth and address.host == host and address.http_port == port:\n uri_headers[\"Authorization\"] = auth.http_authorization\n return uri_headers", "metadata": "root.get_http_headers", "header": "['module', '___EOS___']", "index": 56 }, { "content": "class Resource(_Resource):\n \"\"\" Base class for all local resources mapped to remote counterparts.\n \"\"\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Resource", "header": "['module', '___EOS___']", "index": 73 }, { "content": " def __init__(self, uri, metadata=None, headers=None):\n uri = URI(uri)\n self._resource = _Resource.__init__(self, uri)\n self._headers = dict(headers or {})\n self.__base = super(Resource, self)\n if metadata is None:\n self.__initial_metadata = None\n else:\n self.__initial_metadata = dict(metadata)\n self.__last_get_response = None\n\n uri = uri.string\n dbms_uri = uri[:uri.find(\"/\", uri.find(\"//\") + 2)] + \"/\"\n if dbms_uri == uri:\n self.__dbms = self\n else:\n from py2neo.database import DBMS\n self.__dbms = DBMS(dbms_uri)\n self.__ref = NotImplemented", "metadata": "root.Resource.__init__", "header": "['class', 'Resource', '(', '_Resource', ')', ':', '___EOS___']", "index": 77 }, { "content": " @property\n def graph(self):\n \"\"\" The parent graph of this resource.\n\n :rtype: :class:`.Graph`\n \"\"\"\n return self.__dbms.graph", "metadata": "root.Resource.graph", "header": "['class', 'Resource', '(', '_Resource', ')', ':', '___EOS___']", "index": 97 }, { "content": " @property\n def headers(self):\n \"\"\" The HTTP headers sent with this resource.\n \"\"\"\n headers = get_http_headers(self.__uri__.scheme, self.__uri__.host, self.__uri__.port)\n headers.update(self._headers)\n return headers", "metadata": "root.Resource.headers", "header": "['class', 'Resource', '(', '_Resource', ')', ':', '___EOS___']", "index": 105 }, { "content": " @property\n def metadata(self):\n \"\"\" Metadata received in the last HTTP response.\n \"\"\"\n if self.__last_get_response is None:\n if self.__initial_metadata is not None:\n return self.__initial_metadata\n self.get()\n return self.__last_get_response.content", "metadata": "root.Resource.metadata", "header": "['class', 'Resource', '(', '_Resource', ')', ':', '___EOS___']", "index": 113 }, { "content": " def resolve(self, reference, strict=True):\n \"\"\" Resolve a URI reference against the URI for this resource,\n returning a new resource represented by the new target URI.\n\n :arg reference: Relative URI to resolve.\n :arg strict: Strict mode flag.\n :rtype: :class:`.Resource`\n \"\"\"\n return Resource(_Resource.resolve(self, reference, strict).uri)", "metadata": "root.Resource.resolve", "header": "['class', 'Resource', '(', '_Resource', ')', ':', '___EOS___']", "index": 123 }, { "content": " @property\n def dbms(self):\n \"\"\" The root service associated with this resource.\n\n :return: :class:`.DBMS`\n \"\"\"\n return self.__dbms", "metadata": "root.Resource.dbms", "header": "['class', 'Resource', '(', '_Resource', ')', ':', '___EOS___']", "index": 133 }, { "content": " def get(self, headers=None, redirect_limit=5, **kwargs):\n \"\"\" Perform an HTTP GET to this resource.\n\n :arg headers: Extra headers to pass in the request.\n :arg redirect_limit: Maximum number of times to follow redirects.\n :arg kwargs: Other arguments to pass to the underlying `httpstream` method.\n :rtype: :class:`httpstream.Response`\n :raises: :class:`py2neo.GraphError`\n \"\"\"\n headers = dict(self.headers, **(headers or {}))\n kwargs.update(cache=True)\n try:\n response = self.__base.get(headers=headers, redirect_limit=redirect_limit, **kwargs)\n except (ClientError, ServerError) as error:\n if error.status_code == UNAUTHORIZED:\n raise Unauthorized(self.uri.string)\n if isinstance(error, JSONResponse):\n content = dict(error.content, request=error.request, response=error)\n else:\n content = {}\n message = content.pop(\"message\", \"HTTP GET returned response %s\" % error.status_code)\n raise_from(GraphError(message, **content), error)\n else:\n self.__last_get_response = response\n return response", "metadata": "root.Resource.get", "header": "['class', 'Resource', '(', '_Resource', ')', ':', '___EOS___']", "index": 141 }, { "content": " def put(self, body=None, headers=None, **kwargs):\n \"\"\" Perform an HTTP PUT to this resource.\n\n :arg body: The payload of this request.\n :arg headers: Extra headers to pass in the request.\n :arg kwargs: Other arguments to pass to the underlying `httpstream` method.\n :rtype: :class:`httpstream.Response`\n :raises: :class:`py2neo.GraphError`\n \"\"\"\n headers = dict(self.headers, **(headers or {}))\n try:\n response = self.__base.put(body, headers, **kwargs)\n except (ClientError, ServerError) as error:\n if error.status_code == UNAUTHORIZED:\n raise Unauthorized(self.uri.string)\n if isinstance(error, JSONResponse):\n content = dict(error.content, request=error.request, response=error)\n else:\n content = {}\n message = content.pop(\"message\", \"HTTP PUT returned response %s\" % error.status_code)\n raise_from(GraphError(message, **content), error)\n else:\n return response", "metadata": "root.Resource.put", "header": "['class', 'Resource', '(', '_Resource', ')', ':', '___EOS___']", "index": 167 }, { "content": " def post(self, body=None, headers=None, **kwargs):\n \"\"\" Perform an HTTP POST to this resource.\n\n :arg body: The payload of this request.\n :arg headers: Extra headers to pass in the request.\n :arg kwargs: Other arguments to pass to the underlying `httpstream` method.\n :rtype: :class:`httpstream.Response`\n :raises: :class:`py2neo.GraphError`\n \"\"\"\n headers = dict(self.headers, **(headers or {}))\n try:\n response = self.__base.post(body, headers, **kwargs)\n except (ClientError, ServerError) as error:\n if error.status_code == UNAUTHORIZED:\n raise Unauthorized(self.uri.string)\n if isinstance(error, JSONResponse):\n content = dict(error.content, request=error.request, response=error)\n else:\n content = {}\n message = content.pop(\"message\", \"HTTP POST returned response %s\" % error.status_code)\n raise_from(GraphError(message, **content), error)\n else:\n return response", "metadata": "root.Resource.post", "header": "['class', 'Resource', '(', '_Resource', ')', ':', '___EOS___']", "index": 191 }, { "content": " def delete(self, headers=None, **kwargs):\n \"\"\" Perform an HTTP DELETE to this resource.\n\n :arg headers: Extra headers to pass in the request.\n :arg kwargs: Other arguments to pass to the underlying `httpstream` method.\n :rtype: :class:`httpstream.Response`\n :raises: :class:`py2neo.GraphError`\n \"\"\"\n headers = dict(self.headers, **(headers or {}))\n try:\n response = self.__base.delete(headers, **kwargs)\n except (ClientError, ServerError) as error:\n if error.status_code == UNAUTHORIZED:\n raise Unauthorized(self.uri.string)\n if isinstance(error, JSONResponse):\n content = dict(error.content, request=error.request, response=error)\n else:\n content = {}\n message = content.pop(\"message\", \"HTTP DELETE returned response %s\" % error.status_code)\n raise_from(GraphError(message, **content), error)\n else:\n return response", "metadata": "root.Resource.delete", "header": "['class', 'Resource', '(', '_Resource', ')', ':', '___EOS___']", "index": 215 }, { "content": "class ResourceTemplate(_ResourceTemplate):\n \"\"\" A factory class for producing :class:`.Resource` objects dynamically\n based on a template URI.\n \"\"\"\n\n #: The class of error raised by failure responses from resources produced by this template.\n error_class = GraphError\n", "metadata": "root.ResourceTemplate", "header": "['module', '___EOS___']", "index": 239 }, { "content": " def expand(self, **values):\n \"\"\" Produce a resource instance by substituting values into the\n stored template URI.\n\n :arg values: A set of named values to plug into the template URI.\n :rtype: :class:`.Resource`\n \"\"\"\n return Resource(self.uri_template.expand(**values))", "metadata": "root.ResourceTemplate.expand", "header": "['class', 'ResourceTemplate', '(', '_ResourceTemplate', ')', ':', '___EOS___']", "index": 247 } ]
[ { "span": "from py2neo.database.auth import ServerAddress, keyring", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 55 } ]
[]
1
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_", "#", " ", "Copy", "right", " ", "2011", "-", "2016", ",", " ", "Ni", "gel", " ", "Small", "_", "\\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_", "from_", "py2", "neo", "_", "import_", "PRODUCT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "py2", "neo", "_", "._", "database_", "._", "auth_", "import_", "Server", "Address_", ",_", "keyring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "py2", "neo", "_", "._", "database_", "._", "status_", "import_", "Graph", "Error_", ",_", "Unauthorized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "py2", "neo", "_", "._", "packages_", "._", "https", "tream_", "import_", "http_", ",_", "Client", "Error_", ",_", "Server", "Error_", ",_", "Resource_", "as_", "\\u", "Resource_", ",_", "Reso", "urc", "e", "Template_", "as_", "\\u", "Reso", "urc", "e", "Template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "py2", "neo", "_", "._", "packages_", "._", "https", "tream_", "._", "http_", "import_", "JSONR", "esp", "ons", "e_", ",_", "user", "\\u", "agent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "py2", "neo", "_", "._", "packages_", "._", "https", "tream_", "._", "numbers_", "import_", "UNA", "UTH", "ORI", "ZED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "py2", "neo", "_", "._", "packages_", "._", "https", "tream_", "._", "packages_", "._", "uri", "magic_", "import_", "URI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "py2", "neo", "_", "._", "util_", "import_", "raise", "\\u", "from_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "http_", "._", "default", "\\u", "encoding_", "=_", "\"", "UT", "F", "-", "8", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "http", "\\u", "headers_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "User", "-", "Agent", "\"_", ",_", "user", "\\u", "agent_", "(_", "PRODUCT", "_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "X", "-", "Stream", "\"_", ",_", "\"", "true", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "set\\u", "http", "\\u", "header_", "(_", "key_", ",_", "value_", ",_", "scheme_", "=_", "None_", ",_", "host_", "=_", "None_", ",_", "port_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Add", " ", "an", " ", "HTTP", " ", "header", " ", "for", " ", "all", " ", "future", " ", "request", "s", ".", " ", "If", " ", "a", " ", "`", "host", "\\u", "port", "`", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "specified", ",", " ", "this", " ", "header", " ", "will", " ", "only", " ", "be", " ", "include", "d", " ", "in", " ", "request", "s", " ", "to", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "destinat", "ion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "key", ":", " ", "name", " ", "of", " ", "the", " ", "HTTP", " ", "header", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "value", ":", " ", "value", " ", "of", " ", "the", " ", "HTTP", " ", "header", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "sche", "me", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "host", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "port", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address", "\\u", "key_", "=_", "(_", "scheme_", ",_", "host_", ",_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "address", "\\u", "key_", "in_", "\\u", "http", "\\u", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "http", "\\u", "headers_", "[_", "address", "\\u", "key_", "]_", "._", "append_", "(_", "(_", "key_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "http", "\\u", "headers_", "[_", "address", "\\u", "key_", "]_", "=_", "[_", "(_", "key_", ",_", "value_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "http", "\\u", "headers_", "(_", "scheme_", ",_", "host_", ",_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fe", "tch", " ", "all", " ", "HTTP", " ", "header", "s", " ", "rele", "van", "t", " ", "to", " ", "the", " ", "`", "host", "\\u", "port", "`", " ", "provided", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "sche", "me", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "host", ":", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "port", ":", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uri", "\\u", "headers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "s_", ",_", "h_", ",_", "p_", ")_", ",_", "headers_", "in_", "\\u", "http", "\\u", "headers_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "s_", "is_", "None_", "or_", "s_", "==_", "scheme_", ")_", "and_", "(_", "h_", "is_", "None_", "or_", "h_", "==_", "host_", ")_", "and_", "(_", "p_", "is_", "None_", "or_", "p_", "==_", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri", "\\u", "headers_", "._", "update_", "(_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "address_", ",_", "auth_", "in_", "keyring_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "auth_", "and_", "address_", "._", "host_", "==_", "host_", "and_", "address_", "._", "http", "\\u", "port_", "==_", "port_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri", "\\u", "headers_", "[_", "\"", "Authoriz", "ation", "\"_", "]_", "=_", "auth_", "._", "http", "\\u", "authorization_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "uri", "\\u", "headers_", "\\u\\u\\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_", "Resource_", "(_", "\\u", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Base", " ", "class", " ", "for", " ", "all", " ", "local", " ", "resource", "s", " ", "mapp", "ed", " ", "to", " ", "remote", " ", "counter", "part", "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_", "[SEP]_", "class_", "Resource_", "(_", "\\u", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "uri_", ",_", "metadata_", "=_", "None_", ",_", "headers_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri_", "=_", "URI_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "resource_", "=_", "\\u", "Resource_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "headers_", "=_", "dict_", "(_", "headers_", "or_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "base_", "=_", "super_", "(_", "Resource_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "metadata_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "initial", "\\u", "metadata_", "=_", "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 ", " _", "self_", "._", "\\u\\u", "initial", "\\u", "metadata_", "=_", "dict_", "(_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "last", "\\u", "get", "\\u", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uri_", "=_", "uri_", "._", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbm", "s", "\\u", "uri_", "=_", "uri_", "[_", ":_", "uri_", "._", "find_", "(_", "\"/\"_", ",_", "uri_", "._", "find_", "(_", "\"//", "\"_", ")_", "+_", "2_", ")_", "]_", "+_", "\"/\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dbm", "s", "\\u", "uri_", "==_", "uri_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "dbm", "s_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "py2", "neo", "_", "._", "database_", "import_", "DB", "MS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "dbm", "s_", "=_", "DB", "MS_", "(_", "dbm", "s", "\\u", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "ref_", "=_", "Not", "Implemented_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resource_", "(_", "\\u", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "graph_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "The", " ", "parent", " ", "graph", " ", "of", " ", "this", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", ".", "Graph", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "dbm", "s_", "._", "graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resource_", "(_", "\\u", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "headers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "The", " ", "HTTP", " ", "header", "s", " ", "sent", " ", "with", " ", "this", " ", "resource", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "get", "\\u", "http", "\\u", "headers_", "(_", "self_", "._", "\\u\\u", "uri", "\\u\\u_", "._", "scheme_", ",_", "self_", "._", "\\u\\u", "uri", "\\u\\u_", "._", "host_", ",_", "self_", "._", "\\u\\u", "uri", "\\u\\u_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "._", "update_", "(_", "self_", "._", "\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resource_", "(_", "\\u", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "metadata_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Meta", "data", " ", "receive", "d", " ", "in", " ", "the", " ", "last", " ", "HTTP", " ", "response", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u\\u", "last", "\\u", "get", "\\u", "response_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u\\u", "initial", "\\u", "metadata_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "initial", "\\u", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "last", "\\u", "get", "\\u", "response_", "._", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resource_", "(_", "\\u", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve_", "(_", "self_", ",_", "reference_", ",_", "strict_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Resolv", "e", " ", "a", " ", "URI", " ", "reference", " ", "against", " ", "the", " ", "URI", " ", "for", " ", "this", " ", "resource", ",", "\\", "10", ";", " ", " ", " ", " ", "return", "ing", " ", "a", " ", "new", " ", "resource", " ", "represent", "ed", " ", "by", " ", "the", " ", "new", " ", "target", " ", "URI", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "reference", ":", " ", "Relative", " ", "URI", " ", "to", " ", "resolve", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "strict", ":", " ", "Stri", "ct", " ", "mode", " ", "flag", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", ".", "Reso", "urc", "e", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Resource_", "(_", "\\u", "Resource_", "._", "resolve_", "(_", "self_", ",_", "reference_", ",_", "strict_", ")_", "._", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resource_", "(_", "\\u", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dbm", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "The", " ", "root", " ", "service", " ", "associate", "d", " ", "with", " ", "this", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", ":", "class", ":`", ".", "DB", "MS", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "dbm", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resource_", "(_", "\\u", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "headers_", "=_", "None_", ",_", "redirec", "t", "\\u", "limit_", "=_", "5_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Perform", " ", "an", " ", "HTTP", " ", "GET", " ", "to", " ", "this", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "header", "s", ":", " ", "Extra", " ", "header", "s", " ", "to", " ", "pass", " ", "in", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "redirec", "t", "\\u", "limit", ":", " ", "Maxim", "um", " ", "number", " ", "of", " ", "times", " ", "to", " ", "follow", " ", "redirec", "ts", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "kwarg", "s", ":", " ", "Ot", "her", " ", "argu", "ment", "s", " ", "to", " ", "pass", " ", "to", " ", "the", " ", "underl", "ying", " ", "`", "https", "tream", "`", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "https", "tream", ".", "Respons", "e", "`", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", ":", "class", ":`", "py2", "neo", ".", "Graph", "Error", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "dict_", "(_", "self_", "._", "headers_", ",_", "**_", "(_", "headers_", "or_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "cache_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "\\u\\u", "base_", "._", "get_", "(_", "headers_", "=_", "headers_", ",_", "redirec", "t", "\\u", "limit_", "=_", "redirec", "t", "\\u", "limit_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Client", "Error_", ",_", "Server", "Error_", ")_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "error_", "._", "status", "\\u", "code_", "==_", "UNA", "UTH", "ORI", "ZED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Unauthorized_", "(_", "self_", "._", "uri_", "._", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "error_", ",_", "JSONR", "esp", "ons", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "dict_", "(_", "error_", "._", "content_", ",_", "request_", "=_", "error_", "._", "request_", ",_", "response_", "=_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "content_", "._", "pop_", "(_", "\"", "message", "\"_", ",_", "\"", "HTTP", " ", "GET", " ", "return", "ed", " ", "response", " ", "%", "s", "\"_", "%_", "error_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise", "\\u", "from_", "(_", "Graph", "Error_", "(_", "message_", ",_", "**_", "content_", ")_", ",_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "last", "\\u", "get", "\\u", "response_", "=_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resource_", "(_", "\\u", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put_", "(_", "self_", ",_", "body_", "=_", "None_", ",_", "headers_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Perform", " ", "an", " ", "HTTP", " ", "PU", "T", " ", "to", " ", "this", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "body", ":", " ", "The", " ", "payload", " ", "of", " ", "this", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "header", "s", ":", " ", "Extra", " ", "header", "s", " ", "to", " ", "pass", " ", "in", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "kwarg", "s", ":", " ", "Ot", "her", " ", "argu", "ment", "s", " ", "to", " ", "pass", " ", "to", " ", "the", " ", "underl", "ying", " ", "`", "https", "tream", "`", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "https", "tream", ".", "Respons", "e", "`", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", ":", "class", ":`", "py2", "neo", ".", "Graph", "Error", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "dict_", "(_", "self_", "._", "headers_", ",_", "**_", "(_", "headers_", "or_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "\\u\\u", "base_", "._", "put_", "(_", "body_", ",_", "headers_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Client", "Error_", ",_", "Server", "Error_", ")_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "error_", "._", "status", "\\u", "code_", "==_", "UNA", "UTH", "ORI", "ZED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Unauthorized_", "(_", "self_", "._", "uri_", "._", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "error_", ",_", "JSONR", "esp", "ons", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "dict_", "(_", "error_", "._", "content_", ",_", "request_", "=_", "error_", "._", "request_", ",_", "response_", "=_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "content_", "._", "pop_", "(_", "\"", "message", "\"_", ",_", "\"", "HTTP", " ", "PU", "T", " ", "return", "ed", " ", "response", " ", "%", "s", "\"_", "%_", "error_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise", "\\u", "from_", "(_", "Graph", "Error_", "(_", "message_", ",_", "**_", "content_", ")_", ",_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resource_", "(_", "\\u", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "body_", "=_", "None_", ",_", "headers_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Perform", " ", "an", " ", "HTTP", " ", "POST", " ", "to", " ", "this", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "body", ":", " ", "The", " ", "payload", " ", "of", " ", "this", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "header", "s", ":", " ", "Extra", " ", "header", "s", " ", "to", " ", "pass", " ", "in", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "kwarg", "s", ":", " ", "Ot", "her", " ", "argu", "ment", "s", " ", "to", " ", "pass", " ", "to", " ", "the", " ", "underl", "ying", " ", "`", "https", "tream", "`", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "https", "tream", ".", "Respons", "e", "`", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", ":", "class", ":`", "py2", "neo", ".", "Graph", "Error", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "dict_", "(_", "self_", "._", "headers_", ",_", "**_", "(_", "headers_", "or_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "\\u\\u", "base_", "._", "post_", "(_", "body_", ",_", "headers_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Client", "Error_", ",_", "Server", "Error_", ")_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "error_", "._", "status", "\\u", "code_", "==_", "UNA", "UTH", "ORI", "ZED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Unauthorized_", "(_", "self_", "._", "uri_", "._", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "error_", ",_", "JSONR", "esp", "ons", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "dict_", "(_", "error_", "._", "content_", ",_", "request_", "=_", "error_", "._", "request_", ",_", "response_", "=_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "content_", "._", "pop_", "(_", "\"", "message", "\"_", ",_", "\"", "HTTP", " ", "POST", " ", "return", "ed", " ", "response", " ", "%", "s", "\"_", "%_", "error_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise", "\\u", "from_", "(_", "Graph", "Error_", "(_", "message_", ",_", "**_", "content_", ")_", ",_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Resource_", "(_", "\\u", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "headers_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Perform", " ", "an", " ", "HTTP", " ", "DELET", "E", " ", "to", " ", "this", " ", "resource", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "header", "s", ":", " ", "Extra", " ", "header", "s", " ", "to", " ", "pass", " ", "in", " ", "the", " ", "request", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "kwarg", "s", ":", " ", "Ot", "her", " ", "argu", "ment", "s", " ", "to", " ", "pass", " ", "to", " ", "the", " ", "underl", "ying", " ", "`", "https", "tream", "`", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "https", "tream", ".", "Respons", "e", "`", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", ":", " ", ":", "class", ":`", "py2", "neo", ".", "Graph", "Error", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "dict_", "(_", "self_", "._", "headers_", ",_", "**_", "(_", "headers_", "or_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "\\u\\u", "base_", "._", "delete_", "(_", "headers_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Client", "Error_", ",_", "Server", "Error_", ")_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "error_", "._", "status", "\\u", "code_", "==_", "UNA", "UTH", "ORI", "ZED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Unauthorized_", "(_", "self_", "._", "uri_", "._", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "error_", ",_", "JSONR", "esp", "ons", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "dict_", "(_", "error_", "._", "content_", ",_", "request_", "=_", "error_", "._", "request_", ",_", "response_", "=_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "content_", "._", "pop_", "(_", "\"", "message", "\"_", ",_", "\"", "HTTP", " ", "DELET", "E", " ", "return", "ed", " ", "response", " ", "%", "s", "\"_", "%_", "error_", "._", "status", "\\u", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise", "\\u", "from_", "(_", "Graph", "Error_", "(_", "message_", ",_", "**_", "content_", ")_", ",_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Reso", "urc", "e", "Template_", "(_", "\\u", "Reso", "urc", "e", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "factor", "y", " ", "class", " ", "for", " ", "produc", "ing", " ", ":", "class", ":`", ".", "Reso", "urc", "e", "`", " ", "object", "s", " ", "dynami", "call", "y", "\\", "10", ";", " ", " ", " ", " ", "based", " ", "on", " ", "a", " ", "template", " ", "URI", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "The", " ", "class", " ", "of", " ", "error", " ", "raise", "d", " ", "by", " ", "fail", "ure", " ", "response", "s", " ", "from", " ", "resource", "s", " ", "produce", "d", " ", "by", " ", "this", " ", "template", "._", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "class_", "=_", "Graph", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Reso", "urc", "e", "Template_", "(_", "\\u", "Reso", "urc", "e", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "expand_", "(_", "self_", ",_", "**_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Produce", " ", "a", " ", "resource", " ", "instance", " ", "by", " ", "subst", "itut", "ing", " ", "values", " ", "int", "o", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "store", "d", " ", "template", " ", "URI", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "arg", " ", "values", ":", " ", "A", " ", "set", " ", "of", " ", "named", " ", "values", " ", "to", " ", "plug", " ", "int", "o", " ", "the", " ", "template", " ", "URI", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", ".", "Reso", "urc", "e", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Resource_", "(_", "self_", "._", "uri", "\\u", "template_", "._", "expand_", "(_", "**_", "values_", ")_", ")_" ]
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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, 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
wnielson/nzbverify/nzbverify/thread.py
[ { "content": "import logging\nimport threading\nimport nntp\nimport nntplib\n\nfrom server import ConnectionClosedException\n\nlog = logging.getLogger(\"thread\")\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def stop_threads(threads):\n \"\"\"\n Stops all threads and disconnects each NNTP connection.\n \"\"\"\n for thread in threads:\n thread.stop = True\n thread.join()", "metadata": "root.stop_threads", "header": "['module', '___EOS___']", "index": 9 }, { "content": "class SegmentCheckerThread(threading.Thread):\n \"\"\"\n Threaded NZB Segment Checker.\n \"\"\"\n", "metadata": "root.SegmentCheckerThread", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __init__(self, id, segments, missing, server):\n self.id = id\n self.segments = segments # Queue.Queue\n self.missing = missing # Queue.Queue\n self.server = server\n self.stop = False # Set to True to stop thread\n\n threading.Thread.__init__(self, name=\"thread-%d\" % id)", "metadata": "root.SegmentCheckerThread.__init__", "header": "['class', 'SegmentCheckerThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 21 }, { "content": " def run(self):\n connection = self.server.create_connection()\n try:\n while True:\n if self.stop:\n connection.quit()\n return\n\n segment = None\n q = None\n\n if self.server.conf.get(\"backup\", False):\n # Backup server - only check for segments that have been\n # explcitly passed to us\n try:\n segment = self.server.segments.get(True, 1)\n q = self.server.segments\n except:\n pass\n\n else:\n # Try to get a segment from the server's segment queue\n try:\n segment = self.server.segments.get(False)\n q = self.server.segments\n except:\n # Try to grab a segment from the global queue\n segment = self.segments.get(False)\n q = self.segments\n\n if not segment:\n continue\n\n try:\n self.server.check_segment(connection, segment, self.segments, self.missing)\n except ConnectionClosedException, e:\n connection = self.server.create_connection()\n except Exception, e:\n log.error(\"Unknown error: %s\" % e)\n\n if q:\n q.task_done()\n\n except Exception, e:\n try:\n connection.quit()\n except:\n pass", "metadata": "root.SegmentCheckerThread.run", "header": "['class', 'SegmentCheckerThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 30 } ]
[ { "span": "import nntp", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 11 }, { "span": "import nntplib", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nn", "tp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nn", "tpl", "ib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "server_", "import_", "Connect", "ion", "Clos", "ed", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "thread", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "stop", "\\u", "threads_", "(_", "threads_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Stops", " ", "all", " ", "thread", "s", " ", "and", " ", "discon", "nect", "s", " ", "each", " ", "NN", "TP", " ", "connecti", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "thread_", "in_", "threads_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "thread_", "._", "stop_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "join_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Segme", "nt", "Check", "er", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thread", "ed", " ", "NZB", " ", "Segme", "nt", " ", "Check", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Segme", "nt", "Check", "er", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "id_", ",_", "segments_", ",_", "missing_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "id_", "=_", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "segments_", "=_", "segments_", "#", " ", "Queue", ".", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "missing_", "=_", "missing_", "#", " ", "Queue", ".", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server_", "=_", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop_", "=_", "False_", "#", " ", "Set", " ", "to", " ", "Tru", "e", " ", "to", " ", "stop", " ", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threading_", "._", "Thread_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "\"", "thread", "-%", "d", "\"_", "%_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Segme", "nt", "Check", "er", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "self_", "._", "server_", "._", "create", "\\u", "connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "stop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "connection_", "._", "quit_", "(_", ")_", "\\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_", "segment_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "server_", "._", "conf_", "._", "get_", "(_", "\"", "backup", "\"_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Back", "up", " ", "server", " ", "-", " ", "only", " ", "check", " ", "for", " ", "segments", " ", "tha", "t", " ", "have", " ", "bee", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expl", "cit", "ly", " ", "pass", "ed", " ", "to", " ", "us_", "\\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 ", " ", " _", "segment_", "=_", "self_", "._", "server_", "._", "segments_", "._", "get_", "(_", "True_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "self_", "._", "server_", "._", "segments_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "get", " ", "a", " ", "segment", " ", "from", " ", "the", " ", "server", "'", "s", " ", "segment", " ", "queue_", "\\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 ", " ", " _", "segment_", "=_", "self_", "._", "server_", "._", "segments_", "._", "get_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "self_", "._", "server_", "._", "segments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "gra", "b", " ", "a", " ", "segment", " ", "from", " ", "the", " ", "global", " ", "queue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "segment_", "=_", "self_", "._", "segments_", "._", "get_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "self_", "._", "segments_", "\\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_", "segment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "server_", "._", "check", "\\u", "segment_", "(_", "connection_", ",_", "segment_", ",_", "self_", "._", "segments_", ",_", "self_", "._", "missing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Connect", "ion", "Clos", "ed", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "connection_", "=_", "self_", "._", "server_", "._", "create", "\\u", "connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "log_", "._", "error_", "(_", "\"", "Un", "know", "n", " ", "error", ":", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "q_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "q_", "._", "task", "\\u", "done_", "(_", ")_", "\\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_", "except_", "Exception_", ",_", "e_", ":_", "\\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 ", " _", "connection_", "._", "quit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
coreemu/core/daemon/core/mobility.py
[ { "content": "#\n# CORE\n# Copyright (c)2011-2012 the Boeing Company.\n# See the LICENSE file included in this distribution.\n#\n# author: Jeff Ahrenholz <[email protected]>\n#\n'''\nmobility.py: mobility helpers for moving nodes and calculating wireless range.\n'''\nimport sys, os, time, string, math, threading\nimport heapq\nfrom core.api import coreapi\nfrom core.conf import ConfigurableManager, Configurable\nfrom core.coreobj import PyCoreNode\nfrom core.misc.utils import check_call\nfrom core.misc.ipaddr import IPAddr\n\n\n\n\n\n\n\n\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MobilityManager(ConfigurableManager):\n ''' Member of session class for handling configuration data for mobility and\n range models.\n '''\n _name = \"MobilityManager\"\n _type = coreapi.CORE_TLV_REG_WIRELESS\n \n\n\n\n \n\n \n \n \n \n \n \n ", "metadata": "root.MobilityManager", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __init__(self, session):\n ConfigurableManager.__init__(self, session)\n self.verbose = self.session.getcfgitembool('verbose', False)\n # configurations for basic range, indexed by WLAN node number, are\n # stored in self.configs\n # mapping from model names to their classes\n self._modelclsmap = {}\n # dummy node objects for tracking position of nodes on other servers\n self.phys = {}\n self.physnets = {}\n self.session.broker.handlers += (self.physnodehandlelink, )\n self.register()", "metadata": "root.MobilityManager.__init__", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 25 }, { "content": " def startup(self, nodenums=None):\n ''' Session is transitioning from instantiation to runtime state.\n Instantiate any mobility models that have been configured for a WLAN.\n '''\n if nodenums is None:\n nodenums = self.configs.keys()\n \n for nodenum in nodenums:\n try:\n n = self.session.obj(nodenum)\n except KeyError:\n self.session.warn(\"Skipping mobility configuration for unknown\"\n \"node %d.\" % nodenum)\n continue\n if nodenum not in self.configs:\n self.session.warn(\"Missing mobility configuration for node \"\n \"%d.\" % nodenum)\n continue\n v = self.configs[nodenum]\n for model in v:\n try:\n cls = self._modelclsmap[model[0]]\n except KeyError:\n self.session.warn(\"Skipping mobility configuration for \"\n \"unknown model '%s'\" % model[0])\n continue\n n.setmodel(cls, model[1])\n if self.session.master:\n self.installphysnodes(n)\n if n.mobility:\n self.session.evq.add_event(0.0, n.mobility.startup)\n return ()", "metadata": "root.MobilityManager.startup", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 38 }, { "content": " def reset(self):\n ''' Reset all configs.\n '''\n self.clearconfig(nodenum=None)", "metadata": "root.MobilityManager.reset", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 72 }, { "content": " def setconfig(self, nodenum, conftype, values):\n ''' Normal setconfig() with check for run-time updates for WLANs.\n '''\n super(MobilityManager, self).setconfig(nodenum, conftype, values)\n if self.session is None:\n return\n if self.session.getstate() == coreapi.CORE_EVENT_RUNTIME_STATE:\n try:\n n = self.session.obj(nodenum)\n except KeyError:\n self.session.warn(\"Skipping mobility configuration for unknown\"\n \"node %d.\" % nodenum)\n n.updatemodel(conftype, values)", "metadata": "root.MobilityManager.setconfig", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 77 }, { "content": " def register(self):\n ''' Register models as configurable object(s) with the Session object.\n '''\n models = [BasicRangeModel, Ns2ScriptedMobility]\n for m in models:\n self.session.addconfobj(m._name, m._type, m.configure_mob)\n self._modelclsmap[m._name] = m", "metadata": "root.MobilityManager.register", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 91 }, { "content": " def handleevent(self, msg):\n ''' Handle an Event Message used to start, stop, or pause \n mobility scripts for a given WlanNode.\n '''\n eventtype = msg.gettlv(coreapi.CORE_TLV_EVENT_TYPE)\n nodenum = msg.gettlv(coreapi.CORE_TLV_EVENT_NODE)\n name = msg.gettlv(coreapi.CORE_TLV_EVENT_NAME)\n try:\n node = self.session.obj(nodenum)\n except KeyError:\n self.session.warn(\"Ignoring event for model '%s', unknown node \" \\\n \"'%s'\" % (name, nodenum))\n return\n \n # name is e.g. \"mobility:ns2script\"\n models = name[9:].split(',')\n for m in models:\n try:\n cls = self._modelclsmap[m]\n except KeyError:\n self.session.warn(\"Ignoring event for unknown model '%s'\" % m)\n continue\n _name = \"waypoint\"\n if cls._type == coreapi.CORE_TLV_REG_WIRELESS:\n model = node.mobility\n elif cls._type == coreapi.CORE_TLV_REG_MOBILITY:\n model = node.mobility\n else:\n continue\n if model is None:\n self.session.warn(\"Ignoring event, %s has no model\" % node.name)\n continue\n if cls._name != model._name:\n self.session.warn(\"Ignoring event for %s wrong model %s,%s\" % \\\n (node.name, cls._name, model._name))\n continue\n \n if eventtype == coreapi.CORE_EVENT_STOP or \\\n eventtype == coreapi.CORE_EVENT_RESTART:\n model.stop(move_initial=True)\n if eventtype == coreapi.CORE_EVENT_START or \\\n eventtype == coreapi.CORE_EVENT_RESTART:\n model.start()\n if eventtype == coreapi.CORE_EVENT_PAUSE:\n model.pause()", "metadata": "root.MobilityManager.handleevent", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 99 }, { "content": " def sendevent(self, model):\n ''' Send an event message on behalf of a mobility model.\n This communicates the current and end (max) times to the GUI.\n '''\n if model.state == model.STATE_STOPPED:\n eventtype = coreapi.CORE_EVENT_STOP\n elif model.state == model.STATE_RUNNING:\n eventtype = coreapi.CORE_EVENT_START\n elif model.state == model.STATE_PAUSED:\n eventtype = coreapi.CORE_EVENT_PAUSE\n data = \"start=%d\" % int(model.lasttime - model.timezero)\n data += \" end=%d\" % int(model.endtime)\n tlvdata = \"\"\n tlvdata += coreapi.CoreEventTlv.pack(coreapi.CORE_TLV_EVENT_NODE,\n model.objid)\n tlvdata += coreapi.CoreEventTlv.pack(coreapi.CORE_TLV_EVENT_TYPE,\n eventtype)\n tlvdata += coreapi.CoreEventTlv.pack(coreapi.CORE_TLV_EVENT_NAME,\n \"mobility:%s\" % model._name)\n tlvdata += coreapi.CoreEventTlv.pack(coreapi.CORE_TLV_EVENT_DATA,\n data)\n tlvdata += coreapi.CoreEventTlv.pack(coreapi.CORE_TLV_EVENT_TIME,\n \"%s\" % time.time())\n msg = coreapi.CoreEventMessage.pack(0, tlvdata)\n try:\n self.session.broadcastraw(None, msg)\n except Exception, e:\n self.warn(\"Error sending Event Message: %s\" % e)", "metadata": "root.MobilityManager.sendevent", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 145 }, { "content": " def updatewlans(self, moved, moved_netifs):\n ''' A mobility script has caused nodes in the 'moved' list to move.\n Update every WlanNode. This saves range calculations if the model\n were to recalculate for each individual node movement.\n '''\n for nodenum in self.configs:\n try:\n n = self.session.obj(nodenum)\n except KeyError:\n continue\n if n.model:\n n.model.update(moved, moved_netifs)", "metadata": "root.MobilityManager.updatewlans", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 174 }, { "content": " def addphys(self, netnum, node):\n ''' Keep track of PhysicalNodes and which network they belong to.\n '''\n nodenum = node.objid\n self.phys[nodenum] = node\n if netnum not in self.physnets:\n self.physnets[netnum] = [nodenum,]\n else:\n self.physnets[netnum].append(nodenum)", "metadata": "root.MobilityManager.addphys", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 187 }, { "content": " def physnodehandlelink(self, msg):\n ''' Broker handler. Snoop Link add messages to get\n node numbers of PhyiscalNodes and their nets.\n Physical nodes exist only on other servers, but a shadow object is\n created here for tracking node position.\n '''\n if msg.msgtype == coreapi.CORE_API_LINK_MSG and \\\n msg.flags & coreapi.CORE_API_ADD_FLAG:\n nn = msg.nodenumbers()\n # first node is always link layer node in Link add message\n if nn[0] not in self.session.broker.nets:\n return\n if nn[1] in self.session.broker.phys:\n # record the fact that this PhysicalNode is linked to a net\n dummy = PyCoreNode(session=self.session, objid=nn[1],\n name=\"n%d\" % nn[1], start=False)\n self.addphys(nn[0], dummy)", "metadata": "root.MobilityManager.physnodehandlelink", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 197 }, { "content": " def physnodeupdateposition(self, msg):\n ''' Snoop node messages belonging to physical nodes. The dummy object\n in self.phys[] records the node position.\n '''\n nodenum = msg.nodenumbers()[0]\n try:\n dummy = self.phys[nodenum]\n nodexpos = msg.gettlv(coreapi.CORE_TLV_NODE_XPOS)\n nodeypos = msg.gettlv(coreapi.CORE_TLV_NODE_YPOS)\n dummy.setposition(nodexpos, nodeypos, None)\n except KeyError:\n pass", "metadata": "root.MobilityManager.physnodeupdateposition", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 215 }, { "content": " def installphysnodes(self, net):\n ''' After installing a mobility model on a net, include any physical\n nodes that we have recorded. Use the GreTap tunnel to the physical node\n as the node's interface.\n '''\n try:\n nodenums = self.physnets[net.objid]\n except KeyError:\n return\n for nodenum in nodenums:\n node = self.phys[nodenum]\n servers = self.session.broker.getserversbynode(nodenum)\n (host, port, sock) = self.session.broker.getserver(servers[0])\n netif = self.session.broker.gettunnel(net.objid, IPAddr.toint(host))\n node.addnetif(netif, 0)\n netif.node = node\n (x,y,z) = netif.node.position.get()\n netif.poshook(netif, x, y, z)", "metadata": "root.MobilityManager.installphysnodes", "header": "['class', 'MobilityManager', '(', 'ConfigurableManager', ')', ':', '___EOS___']", "index": 228 }, { "content": "class WirelessModel(Configurable):\n ''' Base class used by EMANE models and the basic range model. \n Used for managing arbitrary configuration parameters.\n '''\n _type = coreapi.CORE_TLV_REG_WIRELESS\n _bitmap = None\n _positioncallback = None\n\n \n \n ", "metadata": "root.WirelessModel", "header": "['module', '___EOS___']", "index": 248 }, { "content": " def __init__(self, session, objid, verbose = False, values = None):\n Configurable.__init__(self, session, objid)\n self.verbose = verbose\n # 'values' can be retrieved from a ConfigurableManager, or used here\n # during initialization, depending on the model.", "metadata": "root.WirelessModel.__init__", "header": "['class', 'WirelessModel', '(', 'Configurable', ')', ':', '___EOS___']", "index": 256 }, { "content": " def tolinkmsgs(self, flags):\n ''' May be used if the model can populate the GUI with wireless (green)\n link lines.\n '''\n return []", "metadata": "root.WirelessModel.tolinkmsgs", "header": "['class', 'WirelessModel', '(', 'Configurable', ')', ':', '___EOS___']", "index": 262 }, { "content": " def update(self, moved, moved_netifs):\n raise NotImplementedError", "metadata": "root.WirelessModel.update", "header": "['class', 'WirelessModel', '(', 'Configurable', ')', ':', '___EOS___']", "index": 268 }, { "content": " def updateconfig(self, values):\n ''' For run-time updates of model config.\n Returns True when self._positioncallback() and self.setlinkparams()\n should be invoked.\n '''\n return False", "metadata": "root.WirelessModel.updateconfig", "header": "['class', 'WirelessModel', '(', 'Configurable', ')', ':', '___EOS___']", "index": 271 }, { "content": "class BasicRangeModel(WirelessModel):\n ''' Basic Range wireless model, calculates range between nodes and links\n and unlinks nodes based on this distance. This was formerly done from\n the GUI.\n '''\n _name = \"basic_range\"\n\n # configuration parameters are\n # ( 'name', 'type', 'default', 'possible-value-list', 'caption')\n _confmatrix = [\n (\"range\", coreapi.CONF_DATA_TYPE_UINT32, '275',\n '', 'wireless range (pixels)'),\n (\"bandwidth\", coreapi.CONF_DATA_TYPE_UINT32, '54000', \n '', 'bandwidth (bps)'),\n (\"jitter\", coreapi.CONF_DATA_TYPE_FLOAT, '0.0', \n '', 'transmission jitter (usec)'),\n (\"delay\", coreapi.CONF_DATA_TYPE_FLOAT, '5000.0', \n '', 'transmission delay (usec)'),\n (\"error\", coreapi.CONF_DATA_TYPE_FLOAT, '0.0', \n '', 'error rate (%)'),\n ]\n\n # value groupings\n _confgroups = \"Basic Range Parameters:1-%d\" % len(_confmatrix)\n \n\n\n \n\n\n \n _positioncallback = set_position\n\n\n\n\n \n \n \n", "metadata": "root.BasicRangeModel", "header": "['module', '___EOS___']", "index": 279 }, { "content": " def __init__(self, session, objid, verbose = False, values=None):\n ''' Range model is only instantiated during runtime.\n '''\n super(BasicRangeModel, self).__init__(session = session, objid = objid,\n verbose = verbose)\n self.wlan = session.obj(objid)\n self._netifs = {}\n self._netifslock = threading.Lock()\n if values is None:\n values = session.mobility.getconfig(objid, self._name,\n self.getdefaultvalues())[1]\n self.range = float(self.valueof(\"range\", values))\n if self.verbose:\n self.session.info(\"Basic range model configured for WLAN %d using\" \\\n \" range %d\" % (objid, self.range))\n self.valuestolinkparams(values)", "metadata": "root.BasicRangeModel.__init__", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 304 }, { "content": " def valuestolinkparams(self, values):\n self.bw = int(self.valueof(\"bandwidth\", values))\n if self.bw == 0.0:\n self.bw = None\n self.delay = float(self.valueof(\"delay\", values))\n if self.delay == 0.0:\n self.delay = None\n self.loss = float(self.valueof(\"error\", values))\n if self.loss == 0.0:\n self.loss = None\n self.jitter = float(self.valueof(\"jitter\", values))\n if self.jitter == 0.0:\n self.jitter = None", "metadata": "root.BasicRangeModel.valuestolinkparams", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 321 }, { "content": " @classmethod\n def configure_mob(cls, session, msg):\n ''' Handle configuration messages for setting up a model.\n Pass the MobilityManager object as the manager object.\n '''\n return cls.configure(session.mobility, msg)", "metadata": "root.BasicRangeModel.configure_mob", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 335 }, { "content": " def setlinkparams(self):\n ''' Apply link parameters to all interfaces. This is invoked from\n WlanNode.setmodel() after the position callback has been set.\n '''\n with self._netifslock:\n for netif in self._netifs:\n self.wlan.linkconfig(netif, bw=self.bw, delay=self.delay,\n loss=self.loss, duplicate=None,\n jitter=self.jitter)", "metadata": "root.BasicRangeModel.setlinkparams", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 342 }, { "content": " def get_position(self, netif):\n with self._netifslock:\n return self._netifs[netif]", "metadata": "root.BasicRangeModel.get_position", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 352 }, { "content": " def set_position(self, netif, x = None, y = None, z = None):\n ''' A node has moved; given an interface, a new (x,y,z) position has\n been set; calculate the new distance between other nodes and link or\n unlink node pairs based on the configured range.\n '''\n #print \"set_position(%s, x=%s, y=%s, z=%s)\" % (netif.localname, x, y, z)\n self._netifslock.acquire()\n self._netifs[netif] = (x, y, z)\n if x is None or y is None:\n self._netifslock.release()\n return\n for netif2 in self._netifs:\n self.calclink(netif, netif2)\n self._netifslock.release()", "metadata": "root.BasicRangeModel.set_position", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 356 }, { "content": " def update(self, moved, moved_netifs):\n ''' Node positions have changed without recalc. Update positions from\n node.position, then re-calculate links for those that have moved.\n Assumes bidirectional links, with one calculation per node pair, where\n one of the nodes has moved.\n '''\n with self._netifslock:\n while len(moved_netifs):\n netif = moved_netifs.pop()\n (nx, ny, nz) = netif.node.getposition()\n if netif in self._netifs:\n self._netifs[netif] = (nx, ny, nz)\n for netif2 in self._netifs:\n if netif2 in moved_netifs:\n continue\n self.calclink(netif, netif2)", "metadata": "root.BasicRangeModel.update", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 373 }, { "content": " def calclink(self, netif, netif2):\n ''' Helper used by set_position() and update() to\n calculate distance between two interfaces and perform\n linking/unlinking. Sends link/unlink messages and updates the\n WlanNode's linked dict.\n '''\n if netif == netif2:\n return\n try:\n (x, y, z) = self._netifs[netif] \n (x2, y2, z2) = self._netifs[netif2]\n except KeyError:\n return\n if x2 is None or y2 is None:\n return\n \n d = self.calcdistance( (x,y,z), (x2,y2,z2) )\n # ordering is important, to keep the wlan._linked dict organized\n a = min(netif, netif2)\n b = max(netif, netif2)\n try:\n self.wlan._linked_lock.acquire()\n linked = self.wlan.linked(a, b)\n except KeyError:\n return\n finally:\n self.wlan._linked_lock.release()\n if d > self.range:\n if linked:\n self.wlan.unlink(a, b)\n self.sendlinkmsg(a, b, unlink=True)\n else:\n if not linked:\n self.wlan.link(a, b)\n self.sendlinkmsg(a, b)", "metadata": "root.BasicRangeModel.calclink", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 390 }, { "content": " @staticmethod\n def calcdistance(p1, p2):\n ''' Calculate the distance between two three-dimensional points.\n '''\n a = p1[0] - p2[0]\n b = p1[1] - p2[1]\n c = 0\n if p1[2] is not None and p2[2] is not None:\n c = p1[2] - p2[2]\n return math.hypot(math.hypot(a, b), c)", "metadata": "root.BasicRangeModel.calcdistance", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 427 }, { "content": " def updateconfig(self, values):\n ''' Configuration has changed during runtime.\n MobilityManager.setconfig() -> WlanNode.updatemodel() -> \n WirelessModel.updateconfig()\n '''\n self.valuestolinkparams(values)\n self.range = float(self.valueof(\"range\", values)) \n return True", "metadata": "root.BasicRangeModel.updateconfig", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 438 }, { "content": " def linkmsg(self, netif, netif2, flags):\n ''' Create a wireless link/unlink API message.\n '''\n n1 = netif.localname.split('.')[0]\n n2 = netif2.localname.split('.')[0] \n tlvdata = coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_N1NUMBER,\n netif.node.objid)\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_N2NUMBER,\n netif2.node.objid)\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_NETID,\n self.wlan.objid)\n #tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF1NUM,\n # netif.index)\n #tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_IF2NUM,\n # netif2.index)\n tlvdata += coreapi.CoreLinkTlv.pack(coreapi.CORE_TLV_LINK_TYPE,\n coreapi.CORE_LINK_WIRELESS)\n return coreapi.CoreLinkMessage.pack(flags, tlvdata)", "metadata": "root.BasicRangeModel.linkmsg", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 447 }, { "content": " def sendlinkmsg(self, netif, netif2, unlink=False):\n ''' Send a wireless link/unlink API message to the GUI.\n '''\n if unlink:\n flags = coreapi.CORE_API_DEL_FLAG\n else:\n flags = coreapi.CORE_API_ADD_FLAG\n msg = self.linkmsg(netif, netif2, flags)\n self.session.broadcastraw(src=None, data=msg)\n self.session.sdt.updatelink(netif.node.objid, netif2.node.objid, flags,\n wireless=True)", "metadata": "root.BasicRangeModel.sendlinkmsg", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 466 }, { "content": " def tolinkmsgs(self, flags):\n ''' Return a list of wireless link messages for when the GUI reconnects.\n '''\n r = []\n with self.wlan._linked_lock:\n for a in self.wlan._linked:\n for b in self.wlan._linked[a]:\n if self.wlan._linked[a][b]:\n r.append(self.linkmsg(a, b, flags))\n return r", "metadata": "root.BasicRangeModel.tolinkmsgs", "header": "['class', 'BasicRangeModel', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 478 }, { "content": "class WayPointMobility(WirelessModel):\n ''' Abstract class for mobility models that set node waypoints.\n '''\n _name = \"waypoint\"\n _type = coreapi.CORE_TLV_REG_MOBILITY\n \n STATE_STOPPED = 0\n STATE_RUNNING = 1\n STATE_PAUSED = 2\n \n class WayPoint(object):\n def __init__(self, time, nodenum, coords, speed):\n self.time = time\n self.nodenum = nodenum\n self.coords = coords\n self.speed = speed\n \n def __cmp__(self, other):\n tmp = cmp(self.time, other.time)\n if tmp == 0:\n tmp = cmp(self.nodenum, other.nodenum)\n return tmp\n\n \n\n\n \n\n \n \n \n \n\n \n\n \n ", "metadata": "root.WayPointMobility", "header": "['module', '___EOS___']", "index": 489 }, { "content": " def __init__(self, session, objid, verbose = False, values = None):\n super(WayPointMobility, self).__init__(session = session, objid = objid,\n verbose = verbose, values = values)\n self.state = self.STATE_STOPPED\n self.queue = []\n self.queue_copy = []\n self.points = {}\n self.initial = {}\n self.lasttime = None\n self.endtime = None\n self.wlan = session.obj(objid)\n # these are really set in child class via confmatrix\n self.loop = False\n self.refresh_ms = 50\n # flag whether to stop scheduling when queue is empty\n # (ns-3 sets this to False as new waypoints may be added from trace)\n self.empty_queue_stop = True", "metadata": "root.WayPointMobility.__init__", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 512 }, { "content": " def runround(self):\n ''' Advance script time and move nodes.\n '''\n if self.state != self.STATE_RUNNING:\n return \n t = self.lasttime\n self.lasttime = time.time()\n now = self.lasttime - self.timezero\n dt = self.lasttime - t\n #print \"runround(now=%.2f, dt=%.2f)\" % (now, dt)\n \n # keep current waypoints up-to-date\n self.updatepoints(now)\n \n if not len(self.points):\n if len(self.queue):\n # more future waypoints, allow time for self.lasttime update\n nexttime = self.queue[0].time - now\n if nexttime > (0.001 * self.refresh_ms):\n nexttime -= (0.001 * self.refresh_ms)\n self.session.evq.add_event(nexttime, self.runround)\n return\n else:\n # no more waypoints or queued items, loop?\n if not self.empty_queue_stop:\n # keep running every refresh_ms, even with empty queue\n self.session.evq.add_event(0.001 * self.refresh_ms, self.runround)\n return\n if not self.loopwaypoints():\n return self.stop(move_initial=False)\n if not len(self.queue):\n # prevent busy loop\n return\n return self.run()\n \n # only move netifs attached to self.wlan, or all nodenum in script?\n moved = []\n moved_netifs = []\n for netif in self.wlan.netifs():\n node = netif.node\n if self.movenode(node, dt):\n moved.append(node)\n moved_netifs.append(netif)\n \n # calculate all ranges after moving nodes; this saves calculations\n #self.wlan.model.update(moved)\n self.session.mobility.updatewlans(moved, moved_netifs)\n \n # TODO: check session state\n self.session.evq.add_event(0.001 * self.refresh_ms, self.runround)", "metadata": "root.WayPointMobility.runround", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 530 }, { "content": " def run(self):\n self.timezero = time.time()\n self.lasttime = self.timezero - (0.001 * self.refresh_ms)\n self.movenodesinitial()\n self.runround()\n self.session.mobility.sendevent(self)", "metadata": "root.WayPointMobility.run", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 581 }, { "content": " def movenode(self, node, dt):\n ''' Calculate next node location and update its coordinates. \n Returns True if the node's position has changed.\n '''\n if node.objid not in self.points:\n return False\n x1, y1, z1 = node.getposition()\n x2, y2, z2 = self.points[node.objid].coords\n speed = self.points[node.objid].speed\n # instantaneous move (prevents dx/dy == 0.0 below)\n if speed == 0:\n self.setnodeposition(node, x2, y2, z2)\n del self.points[node.objid]\n return True\n # speed can be a velocity vector (ns3 mobility) or speed value\n if isinstance(speed, (float, int)):\n # linear speed value\n alpha = math.atan2(y2 - y1, x2 - x1)\n sx = speed * math.cos(alpha)\n sy = speed * math.sin(alpha)\n else:\n # velocity vector\n sx = speed[0]\n sy = speed[1]\n\n # calculate dt * speed = distance moved\n dx = sx * dt\n dy = sy * dt\n # prevent overshoot\n if abs(dx) > abs(x2 - x1):\n dx = x2 - x1\n if abs(dy) > abs(y2 - y1):\n dy = y2 - y1\n if dx == 0.0 and dy == 0.0:\n if self.endtime < (self.lasttime - self.timezero):\n # the last node to reach the last waypoint determines this\n # script's endtime\n self.endtime = self.lasttime - self.timezero\n del self.points[node.objid]\n return False\n #print \"node %s dx,dy= <%s, %d>\" % (node.name, dx, dy)\n if (x1 + dx) < 0.0:\n dx = 0.0 - x1\n if (y1 + dy) < 0.0:\n dy = 0.0 - y1\n self.setnodeposition(node, x1 + dx, y1 + dy, z1)\n return True", "metadata": "root.WayPointMobility.movenode", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 588 }, { "content": " def movenodesinitial(self):\n ''' Move nodes to their initial positions. Then calculate the ranges.\n '''\n moved = []\n moved_netifs = []\n for netif in self.wlan.netifs():\n node = netif.node\n if node.objid not in self.initial:\n continue\n (x, y, z) = self.initial[node.objid].coords\n self.setnodeposition(node, x, y, z)\n moved.append(node)\n moved_netifs.append(netif)\n #self.wlan.model.update(moved)\n self.session.mobility.updatewlans(moved, moved_netifs)", "metadata": "root.WayPointMobility.movenodesinitial", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 636 }, { "content": " def addwaypoint(self, time, nodenum, x, y, z, speed):\n ''' Waypoints are pushed to a heapq, sorted by time.\n '''\n #print \"addwaypoint: %s %s %s,%s,%s %s\" % (time, nodenum, x, y, z, speed)\n wp = self.WayPoint(time, nodenum, coords=(x,y,z), speed=speed)\n heapq.heappush(self.queue, wp)", "metadata": "root.WayPointMobility.addwaypoint", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 652 }, { "content": " def addinitial(self, nodenum, x, y, z):\n ''' Record initial position in a dict.\n '''\n wp = self.WayPoint(0, nodenum, coords=(x,y,z), speed=0)\n self.initial[nodenum] = wp", "metadata": "root.WayPointMobility.addinitial", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 659 }, { "content": " def updatepoints(self, now):\n ''' Move items from self.queue to self.points when their time has come.\n '''\n while len(self.queue):\n if self.queue[0].time > now:\n break \n wp = heapq.heappop(self.queue)\n self.points[wp.nodenum] = wp", "metadata": "root.WayPointMobility.updatepoints", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 665 }, { "content": " def copywaypoints(self):\n ''' Store backup copy of waypoints for looping and stopping.\n '''\n self.queue_copy = list(self.queue)", "metadata": "root.WayPointMobility.copywaypoints", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 674 }, { "content": " def loopwaypoints(self):\n ''' Restore backup copy of waypoints when looping.\n '''\n self.queue = list(self.queue_copy)\n return self.loop", "metadata": "root.WayPointMobility.loopwaypoints", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 679 }, { "content": " def setnodeposition(self, node, x, y, z):\n ''' Helper to move a node, notify any GUI (connected session handlers),\n without invoking the interface poshook callback that may perform\n range calculation.\n '''\n # this would cause PyCoreNetIf.poshook() callback (range calculation)\n #node.setposition(x, y, z)\n node.position.set(x, y, z)\n msg = node.tonodemsg(flags=0)\n self.session.broadcastraw(None, msg)\n self.session.sdt.updatenode(node.objid, flags=0, x=x, y=y, z=z)", "metadata": "root.WayPointMobility.setnodeposition", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 685 }, { "content": " def setendtime(self):\n ''' Set self.endtime to the time of the last waypoint in the queue of\n waypoints. This is just an estimate. The endtime will later be \n adjusted, after one round of the script has run, to be the time\n that the last moving node has reached its final waypoint.\n '''\n try:\n self.endtime = self.queue[-1].time\n except IndexError:\n self.endtime = 0", "metadata": "root.WayPointMobility.setendtime", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 697 }, { "content": " def start(self):\n ''' Run the script from the beginning or unpause from where it\n was before.\n '''\n laststate = self.state\n self.state = self.STATE_RUNNING\n if laststate == self.STATE_STOPPED or laststate == self.STATE_RUNNING:\n self.loopwaypoints()\n self.timezero = 0\n self.lasttime = 0\n self.run()\n elif laststate == self.STATE_PAUSED:\n now = time.time()\n self.timezero += now - self.lasttime\n self.lasttime = now - (0.001 * self.refresh_ms)\n self.runround()", "metadata": "root.WayPointMobility.start", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 708 }, { "content": " def stop(self, move_initial=True):\n ''' Stop the script and move nodes to initial positions.\n '''\n self.state = self.STATE_STOPPED\n self.loopwaypoints()\n self.timezero = 0\n self.lasttime = 0\n if move_initial:\n self.movenodesinitial()\n self.session.mobility.sendevent(self)", "metadata": "root.WayPointMobility.stop", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 725 }, { "content": " def pause(self):\n ''' Pause the script; pause time is stored to self.lasttime.\n '''\n self.state = self.STATE_PAUSED\n self.lasttime = time.time()", "metadata": "root.WayPointMobility.pause", "header": "['class', 'WayPointMobility', '(', 'WirelessModel', ')', ':', '___EOS___']", "index": 736 }, { "content": "class Ns2ScriptedMobility(WayPointMobility):\n ''' Handles the ns-2 script format, generated by scengen/setdest or\n BonnMotion.\n '''\n _name = \"ns2script\"\n\n _confmatrix = [\n (\"file\", coreapi.CONF_DATA_TYPE_STRING, '',\n '', 'mobility script file'),\n (\"refresh_ms\", coreapi.CONF_DATA_TYPE_UINT32, '50', \n '', 'refresh time (ms)'),\n (\"loop\", coreapi.CONF_DATA_TYPE_BOOL, '1', \n 'On,Off', 'loop'),\n (\"autostart\", coreapi.CONF_DATA_TYPE_STRING, '', \n '', 'auto-start seconds (0.0 for runtime)'),\n (\"map\", coreapi.CONF_DATA_TYPE_STRING, '',\n '', 'node mapping (optional, e.g. 0:1,1:2,2:3)'),\n (\"script_start\", coreapi.CONF_DATA_TYPE_STRING, '',\n '', 'script file to run upon start'),\n (\"script_pause\", coreapi.CONF_DATA_TYPE_STRING, '',\n '', 'script file to run upon pause'),\n (\"script_stop\", coreapi.CONF_DATA_TYPE_STRING, '',\n '', 'script file to run upon stop'),\n ]\n _confgroups = \"ns-2 Mobility Script Parameters:1-%d\" % len(_confmatrix)\n\n\n \n \n \n \n \n\n\n \n \n ", "metadata": "root.Ns2ScriptedMobility", "header": "['module', '___EOS___']", "index": 743 }, { "content": " def __init__(self, session, objid, verbose = False, values = None):\n ''' \n '''\n super(Ns2ScriptedMobility, self).__init__(session = session, objid = objid,\n verbose = verbose, values = values)\n self._netifs = {}\n self._netifslock = threading.Lock()\n if values is None:\n values = session.mobility.getconfig(objid, self._name,\n self.getdefaultvalues())[1]\n self.file = self.valueof(\"file\", values)\n self.refresh_ms = int(self.valueof(\"refresh_ms\", values))\n self.loop = (self.valueof(\"loop\", values).lower() == \"on\")\n self.autostart = self.valueof(\"autostart\", values)\n self.parsemap(self.valueof(\"map\", values))\n self.script_start = self.valueof(\"script_start\", values)\n self.script_pause = self.valueof(\"script_pause\", values)\n self.script_stop = self.valueof(\"script_stop\", values)\n if self.verbose:\n self.session.info(\"ns-2 scripted mobility configured for WLAN %d\" \\\n \" using file: %s\" % (objid, self.file))\n self.readscriptfile()\n self.copywaypoints()\n self.setendtime()", "metadata": "root.Ns2ScriptedMobility.__init__", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 769 }, { "content": " @classmethod\n def configure_mob(cls, session, msg):\n ''' Handle configuration messages for setting up a model.\n Pass the MobilityManager object as the manager object.\n '''\n return cls.configure(session.mobility, msg)", "metadata": "root.Ns2ScriptedMobility.configure_mob", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 794 }, { "content": " def readscriptfile(self):\n ''' Read in mobility script from a file. This adds waypoints to a\n priority queue, sorted by waypoint time. Initial waypoints are\n stored in a separate dict.\n '''\n filename = self.findfile(self.file)\n try:\n f = open(filename, 'r')\n except IOError, e:\n self.session.warn(\"ns-2 scripted mobility failed to load file \" \\\n \" '%s' (%s)\" % (self.file, e))\n return\n if self.verbose:\n self.session.info(\"reading ns-2 script file: %s\" % filename)\n ln = 0\n ix = iy = iz = None\n inodenum = None\n for line in f:\n ln += 1\n if line[:2] != '$n':\n continue\n try:\n if line[:8] == \"$ns_ at \":\n if ix is not None and iy is not None:\n self.addinitial(self.map(inodenum), ix, iy, iz)\n ix = iy = iz = None\n # waypoints:\n # $ns_ at 1.00 \"$node_(6) setdest 500.0 178.0 25.0\"\n parts = line.split()\n time = float(parts[2])\n nodenum = parts[3][1+parts[3].index('('):parts[3].index(')')]\n x = float(parts[5])\n y = float(parts[6])\n z = None\n speed = float(parts[7].strip('\"'))\n self.addwaypoint(time, self.map(nodenum), x, y, z, speed)\n elif line[:7] == \"$node_(\":\n # initial position (time=0, speed=0):\n # $node_(6) set X_ 780.0\n parts = line.split()\n time = 0.0\n nodenum = parts[0][1+parts[0].index('('):parts[0].index(')')]\n if parts[2] == 'X_':\n if ix is not None and iy is not None:\n self.addinitial(self.map(inodenum), ix, iy, iz)\n ix = iy = iz = None\n ix = float(parts[3])\n elif parts[2] == 'Y_':\n iy = float(parts[3])\n elif parts[2] == 'Z_':\n iz = float(parts[3])\n self.addinitial(self.map(nodenum), ix, iy, iz)\n ix = iy = iz = None\n inodenum = nodenum\n else:\n raise ValueError\n except ValueError, e:\n self.session.warn(\"skipping line %d of file %s '%s' (%s)\" % \\\n (ln, self.file, line, e))\n continue\n if ix is not None and iy is not None:\n self.addinitial(self.map(inodenum), ix, iy, iz)", "metadata": "root.Ns2ScriptedMobility.readscriptfile", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 801 }, { "content": " def findfile(self, fn):\n ''' Locate a script file. If the specified file doesn't exist, look in the\n same directory as the scenario file (session.filename), or in the default\n configs directory (~/.core/configs). This allows for sample files without\n absolute pathnames.\n '''\n if os.path.exists(fn):\n return fn\n if self.session.filename is not None:\n d = os.path.dirname(self.session.filename)\n sessfn = os.path.join(d, fn)\n if (os.path.exists(sessfn)):\n return sessfn\n if self.session.user is not None:\n userfn = os.path.join('/home', self.session.user, '.core', 'configs', fn)\n if (os.path.exists(userfn)):\n return userfn\n return fn", "metadata": "root.Ns2ScriptedMobility.findfile", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 864 }, { "content": " def parsemap(self, mapstr):\n ''' Parse a node mapping string, given as a configuration parameter.\n '''\n self.nodemap = {}\n if mapstr.strip() == '':\n return\n for pair in mapstr.split(','):\n parts = pair.split(':')\n try:\n if len(parts) != 2:\n raise ValueError\n self.nodemap[int(parts[0])] = int(parts[1])\n except ValueError:\n self.session.warn(\"ns-2 mobility node map error\")\n return", "metadata": "root.Ns2ScriptedMobility.parsemap", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 883 }, { "content": " def map(self, nodenum):\n ''' Map one node number (from a script file) to another.\n '''\n nodenum = int(nodenum)\n try:\n return self.nodemap[nodenum]\n except KeyError:\n return nodenum", "metadata": "root.Ns2ScriptedMobility.map", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 899 }, { "content": " def startup(self):\n ''' Start running the script if autostart is enabled.\n Move node to initial positions when any autostart time is specified.\n Ignore the script if autostart is an empty string (can still be\n started via GUI controls).\n '''\n if self.autostart == '':\n if self.verbose:\n self.session.info(\"not auto-starting ns-2 script for %s\" % \\\n self.wlan.name)\n return\n try:\n t = float(self.autostart)\n except ValueError:\n self.session.warn(\"Invalid auto-start seconds specified '%s' for \" \\\n \"%s\" % (self.autostart, self.wlan.name))\n return\n self.movenodesinitial()\n if self.verbose:\n self.session.info(\"scheduling ns-2 script for %s autostart at %s\" \\\n % (self.wlan.name, t))\n self.state = self.STATE_RUNNING\n self.session.evq.add_event(t, self.run)", "metadata": "root.Ns2ScriptedMobility.startup", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 908 }, { "content": " def start(self):\n ''' Handle the case when un-paused.\n '''\n laststate = self.state\n super(Ns2ScriptedMobility, self).start()\n if laststate == self.STATE_PAUSED:\n self.statescript(\"unpause\")", "metadata": "root.Ns2ScriptedMobility.start", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 932 }, { "content": " def run(self):\n ''' Start is pressed or autostart is triggered.\n '''\n super(Ns2ScriptedMobility, self).run()\n self.statescript(\"run\")", "metadata": "root.Ns2ScriptedMobility.run", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 940 }, { "content": " def pause(self):\n super(Ns2ScriptedMobility, self).pause()\n self.statescript(\"pause\")", "metadata": "root.Ns2ScriptedMobility.pause", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 946 }, { "content": " def stop(self, move_initial=True):\n super(Ns2ScriptedMobility, self).stop(move_initial=move_initial)\n self.statescript(\"stop\")", "metadata": "root.Ns2ScriptedMobility.stop", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 950 }, { "content": " def statescript(self, typestr):\n filename = None\n if typestr == \"run\" or typestr == \"unpause\":\n filename = self.script_start\n elif typestr == \"pause\":\n filename = self.script_pause\n elif typestr == \"stop\":\n filename = self.script_stop\n if filename is None or filename == '':\n return\n filename = self.findfile(filename)\n try:\n check_call([\"/bin/sh\", filename, typestr], \n cwd=self.session.sessiondir,\n env=self.session.getenviron())\n except Exception, e:\n self.session.warn(\"Error running script '%s' for WLAN state %s: \" \\\n \"%s\" % (filename, typestr, e))", "metadata": "root.Ns2ScriptedMobility.statescript", "header": "['class', 'Ns2ScriptedMobility', '(', 'WayPointMobility', ')', ':', '___EOS___']", "index": 954 } ]
[ { "span": "import sys, os, time, string, math, threading", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CORE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", "2011", "-", "2012", " ", "the", " ", "Bo", "ein", "g", " ", "Compa", "ny", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "LICENSE", " ", "file", " ", "include", "d", " ", "in", " ", "this", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "author", ":", " ", "Je", "ff", " ", "Ah", "ren", "hol", "z", " ", "<", "je", "ff", "rey", ".", "m", ".", "ah", "ren", "hol", "z", "@", "bo", "ein", "g", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "mobi", "lit", "y", ".", "py", ":", " ", "mobi", "lit", "y", " ", "help", "ers", " ", "for", " ", "movin", "g", " ", "nodes", " ", "and", " ", "calculati", "ng", " ", "wireless", " ", "range", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", ",_", "os_", ",_", "time_", ",_", "string_", ",_", "math_", ",_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "heapq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "api_", "import_", "core", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "conf_", "import_", "Configura", "ble", "Manager_", ",_", "Configura", "ble_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "core", "obj_", "import_", "Py", "Core", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "misc_", "._", "utils_", "import_", "check", "\\u", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "misc_", "._", "ipaddr_", "import_", "IPA", "ddr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Mem", "ber", " ", "of", " ", "session", " ", "class", " ", "for", " ", "handling", " ", "configura", "tion", " ", "data", " ", "for", " ", "mobi", "lit", "y", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "range", " ", "model", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "name_", "=_", "\"", "Mob", "ilit", "y", "Manager", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "type_", "=_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "REG", "\\u", "WIRE", "LESS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Configura", "ble", "Manager_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verbose_", "=_", "self_", "._", "session_", "._", "getc", "fg", "item", "bool_", "(_", "'", "verbo", "se", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "configura", "tion", "s", " ", "for", " ", "basic", " ", "range", ",", " ", "indexe", "d", " ", "by", " ", "WL", "AN", " ", "node", " ", "number", ",", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "store", "d", " ", "in", " ", "self", ".", "configs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mapping", " ", "from", " ", "model", " ", "names", " ", "to", " ", "thei", "r", " ", "classes_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "model", "cls", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dummy", " ", "node", " ", "object", "s", " ", "for", " ", "track", "ing", " ", "position", " ", "of", " ", "nodes", " ", "on", " ", "other", " ", "servers_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "phys", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "phys", "nets_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "broker_", "._", "handlers_", "+=_", "(_", "self_", "._", "phys", "node", "handle", "link_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "register_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "startup_", "(_", "self_", ",_", "node", "nums_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Sess", "ion", " ", "is", " ", "transiti", "oni", "ng", " ", "from", " ", "instantiation", " ", "to", " ", "runt", "ime", " ", "state", ".", "\\", "10", ";", " ", " ", " ", " ", "Instantiate", " ", "any", " ", "mobi", "lit", "y", " ", "model", "s", " ", "tha", "t", " ", "have", " ", "bee", "n", " ", "configur", "ed", " ", "for", " ", "a", " ", "WL", "AN", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node", "nums_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "nums_", "=_", "self_", "._", "configs_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node", "num_", "in_", "node", "nums_", ":_", "\\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 ", " _", "n_", "=_", "self_", "._", "session_", "._", "obj_", "(_", "node", "num_", ")_", "\\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 ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "Ski", "ppi", "ng", " ", "mobi", "lit", "y", " ", "configura", "tion", " ", "for", " ", "unknown", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", " ", "%", "d", ".\"_", "%_", "node", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "node", "num_", "not_", "in_", "self_", "._", "configs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "Missing", " ", "mobi", "lit", "y", " ", "configura", "tion", " ", "for", " ", "node", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "d", ".\"_", "%_", "node", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "v_", "=_", "self_", "._", "configs_", "[_", "node", "num_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "model_", "in_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cls_", "=_", "self_", "._", "\\u", "model", "cls", "map_", "[_", "model_", "[_", "0_", "]_", "]_", "\\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 ", " ", "_", "self_", "._", "session_", "._", "warn_", "(_", "\"", "Ski", "ppi", "ng", " ", "mobi", "lit", "y", " ", "configura", "tion", " ", "for", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unknown", " ", "model", " ", "'%", "s", "'\"_", "%_", "model_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "._", "setmo", "del_", "(_", "cls_", ",_", "model_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "master_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "install", "phys", "nodes_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "n_", "._", "mobi", "lity_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "ev", "q_", "._", "add", "\\u", "event_", "(_", "0.0_", ",_", "n_", "._", "mobi", "lity_", "._", "startup_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Reset", " ", "all", " ", "configs", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clear", "config_", "(_", "node", "num_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setc", "onfig_", "(_", "self_", ",_", "node", "num_", ",_", "conf", "type_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Normal", " ", "setc", "onfi", "g", "()", " ", "with", " ", "check", " ", "for", " ", "run", "-", "time", " ", "update", "s", " ", "for", " ", "WL", "AN", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Mob", "ilit", "y", "Manager_", ",_", "self_", ")_", "._", "setc", "onfig_", "(_", "node", "num_", ",_", "conf", "type_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "session_", "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_", "if_", "self_", "._", "session_", "._", "getstate", "_", "(_", ")_", "==_", "core", "api_", "._", "CORE", "\\u", "EVENT", "\\u", "RUNT", "IME", "\\u", "STATE_", ":_", "\\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 ", " _", "n_", "=_", "self_", "._", "session_", "._", "obj_", "(_", "node", "num_", ")_", "\\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 ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "Ski", "ppi", "ng", " ", "mobi", "lit", "y", " ", "configura", "tion", " ", "for", " ", "unknown", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "node", " ", "%", "d", ".\"_", "%_", "node", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "._", "update", "model_", "(_", "conf", "type_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "register_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Register", " ", "model", "s", " ", "as", " ", "configurable", " ", "object", "(", "s", ")", " ", "with", " ", "the", " ", "Sess", "ion", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "models_", "=_", "[_", "Basic", "Range", "Model_", ",_", "Ns", "2", "Script", "ed", "Mob", "ility_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "addc", "onf", "obj_", "(_", "m_", "._", "\\u", "name_", ",_", "m_", "._", "\\u", "type_", ",_", "m_", "._", "configur", "e\\u", "mob", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "model", "cls", "map_", "[_", "m_", "._", "\\u", "name_", "]_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "event_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "an", " ", "Event", " ", "Messag", "e", " ", "used", " ", "to", " ", "start", ",", " ", "stop", ",", " ", "or", " ", "paus", "e", " ", "\\", "10", ";", " ", " ", " ", " ", "mobi", "lit", "y", " ", "scripts", " ", "for", " ", "a", " ", "give", "n", " ", "Wl", "an", "Node", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "type_", "=_", "msg_", "._", "gett", "lv_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "EVENT", "\\u", "TYPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "num_", "=_", "msg_", "._", "gett", "lv_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "EVENT", "\\u", "NODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "msg_", "._", "gett", "lv_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "EVENT", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "self_", "._", "session_", "._", "obj_", "(_", "node", "num_", ")_", "\\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 ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "Ignor", "ing", " ", "event", " ", "for", " ", "model", " ", "'%", "s", "',", " ", "unknown", " ", "node", " ", "\"_", "\"'", "%", "s", "'\"_", "%_", "(_", "name_", ",_", "node", "num_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "name", " ", "is", " ", "e", ".", "g", ".", " ", "\"", "mobi", "lit", "y", ":", "ns", "2s", "cript", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "name_", "[_", "9_", ":_", "]_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "models_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "=_", "self_", "._", "\\u", "model", "cls", "map_", "[_", "m_", "]_", "\\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 ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "Ignor", "ing", " ", "event", " ", "for", " ", "unknown", " ", "model", " ", "'%", "s", "'\"_", "%_", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "name_", "=_", "\"", "waypoint", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cls_", "._", "\\u", "type_", "==_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "REG", "\\u", "WIRE", "LESS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "node_", "._", "mobi", "lity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "cls_", "._", "\\u", "type_", "==_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "REG", "\\u", "MOB", "ILI", "TY_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "node_", "._", "mobi", "lity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "model_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "Ignor", "ing", " ", "event", ",", " ", "%", "s", " ", "has", " ", "no", " ", "model", "\"_", "%_", "node_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cls_", "._", "\\u", "name_", "!=_", "model_", "._", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "Ignor", "ing", " ", "event", " ", "for", " ", "%", "s", " ", "wrong", " ", "model", " ", "%", "s", ",%", "s", "\"_", "%_", "(_", "node_", "._", "name_", ",_", "cls_", "._", "\\u", "name_", ",_", "model_", "._", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event", "type_", "==_", "core", "api_", "._", "CORE", "\\u", "EVENT", "\\u", "STOP_", "or_", "event", "type_", "==_", "core", "api_", "._", "CORE", "\\u", "EVENT", "\\u", "RESTA", "RT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "._", "stop_", "(_", "move", "\\u", "initial_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event", "type_", "==_", "core", "api_", "._", "CORE", "\\u", "EVENT", "\\u", "START_", "or_", "event", "type_", "==_", "core", "api_", "._", "CORE", "\\u", "EVENT", "\\u", "RESTA", "RT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "event", "type_", "==_", "core", "api_", "._", "CORE", "\\u", "EVENT", "\\u", "PAUSE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "._", "pause_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "event_", "(_", "self_", ",_", "model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Sen", "d", " ", "an", " ", "event", " ", "message", " ", "on", " ", "beha", "lf", " ", "of", " ", "a", " ", "mobi", "lit", "y", " ", "model", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "communi", "cate", "s", " ", "the", " ", "current", " ", "and", " ", "end", " ", "(", "max", ")", " ", "times", " ", "to", " ", "the", " ", "GU", "I", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "model_", "._", "state_", "==_", "model_", "._", "STATE", "\\u", "STOPPED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "type_", "=_", "core", "api_", "._", "CORE", "\\u", "EVENT", "\\u", "STOP_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "model_", "._", "state_", "==_", "model_", "._", "STATE", "\\u", "RUNNING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "type_", "=_", "core", "api_", "._", "CORE", "\\u", "EVENT", "\\u", "START_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "model_", "._", "state_", "==_", "model_", "._", "STATE", "\\u", "PAUSE", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "type_", "=_", "core", "api_", "._", "CORE", "\\u", "EVENT", "\\u", "PAUSE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "\"", "start", "=", "%", "d", "\"_", "%_", "int_", "(_", "model_", "._", "last", "time_", "-_", "model_", "._", "time", "zero_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "+=_", "\"", " ", "end", "=", "%", "d", "\"_", "%_", "int_", "(_", "model_", "._", "endtime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Event", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "EVENT", "\\u", "NODE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", "._", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Event", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "EVENT", "\\u", "TYPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "event", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Event", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "EVENT", "\\u", "NAME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mobi", "lit", "y", ":", "%", "s", "\"_", "%_", "model_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Event", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "EVENT", "\\u", "DATA_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Event", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "EVENT", "\\u", "TIME_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", "\"_", "%_", "time_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "core", "api_", "._", "Core", "Event", "Message_", "._", "pack_", "(_", "0_", ",_", "tlv", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "broadcast", "raw_", "(_", "None_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "warn_", "(_", "\"", "Error", " ", "sendin", "g", " ", "Event", " ", "Messag", "e", ":", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "wlan", "s_", "(_", "self_", ",_", "moved_", ",_", "moved", "\\u", "neti", "fs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "A", " ", "mobi", "lit", "y", " ", "script", " ", "has", " ", "caus", "ed", " ", "nodes", " ", "in", " ", "the", " ", "'", "moved", "'", " ", "list", " ", "to", " ", "move", ".", "\\", "10", ";", " ", " ", " ", " ", "Update", " ", "every", " ", "Wl", "an", "Node", ".", " ", "Thi", "s", " ", "save", "s", " ", "range", " ", "calculati", "ons", " ", "if", " ", "the", " ", "model", "\\", "10", ";", " ", " ", " ", " ", "wer", "e", " ", "to", " ", "recalc", "ulate", " ", "for", " ", "each", " ", "individual", " ", "node", " ", "movement", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node", "num_", "in_", "self_", "._", "configs_", ":_", "\\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 ", " _", "n_", "=_", "self_", "._", "session_", "._", "obj_", "(_", "node", "num_", ")_", "\\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 ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "n_", "._", "model_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "._", "model_", "._", "update_", "(_", "moved_", ",_", "moved", "\\u", "neti", "fs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "addp", "hys", "_", "(_", "self_", ",_", "netn", "um_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Keep", " ", "track", " ", "of", " ", "Phys", "ical", "Node", "s", " ", "and", " ", "whi", "ch", " ", "network", " ", "the", "y", " ", "belo", "ng", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "num_", "=_", "node_", "._", "obji", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "phys", "_", "[_", "node", "num_", "]_", "=_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "netn", "um_", "not_", "in_", "self_", "._", "phys", "nets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "phys", "nets_", "[_", "netn", "um_", "]_", "=_", "[_", "node", "num_", ",_", "]_", "\\u\\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_", "._", "phys", "nets_", "[_", "netn", "um_", "]_", "._", "append_", "(_", "node", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "phys", "node", "handle", "link_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Broker", " ", "handler", ".", " ", "Sn", "oop", " ", "Link", " ", "add", " ", "message", "s", " ", "to", " ", "get", "\\", "10", ";", " ", " ", " ", " ", "node", " ", "numbers", " ", "of", " ", "Phy", "isc", "al", "Node", "s", " ", "and", " ", "thei", "r", " ", "nets", ".", "\\", "10", ";", " ", " ", " ", " ", "Phys", "ical", " ", "nodes", " ", "exist", " ", "only", " ", "on", " ", "other", " ", "server", "s", ",", " ", "but", " ", "a", " ", "shadow", " ", "object", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "created", " ", "here", " ", "for", " ", "track", "ing", " ", "node", " ", "position", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "msg_", "._", "msgt", "ype_", "==_", "core", "api_", "._", "CORE", "\\u", "API", "\\u", "LINK", "\\u", "MSG_", "and_", "msg_", "._", "flags_", "&_", "core", "api_", "._", "CORE", "\\u", "API", "\\u", "ADD", "\\u", "FLAG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nn_", "=_", "msg_", "._", "node", "numbers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "first", " ", "node", " ", "is", " ", "alw", "ay", "s", " ", "link", " ", "layer", " ", "node", " ", "in", " ", "Link", " ", "add", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "nn_", "[_", "0_", "]_", "not_", "in_", "self_", "._", "session_", "._", "broker_", "._", "nets_", ":_", "\\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_", "nn_", "[_", "1_", "]_", "in_", "self_", "._", "session_", "._", "broker_", "._", "phys", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "record", " ", "the", " ", "fact", " ", "tha", "t", " ", "this", " ", "Phys", "ical", "Node", " ", "is", " ", "linked", " ", "to", " ", "a", " ", "net_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dummy_", "=_", "Py", "Core", "Node_", "(_", "session_", "=_", "self_", "._", "session_", ",_", "obji", "d_", "=_", "nn_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "n", "%", "d", "\"_", "%_", "nn_", "[_", "1_", "]_", ",_", "start_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "addp", "hys", "_", "(_", "nn_", "[_", "0_", "]_", ",_", "dummy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "phys", "node", "update", "position_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Sn", "oop", " ", "node", " ", "message", "s", " ", "belonging", " ", "to", " ", "physical", " ", "nodes", ".", " ", "The", " ", "dummy", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "self", ".", "phys", "[]", " ", "record", "s", " ", "the", " ", "node", " ", "position", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "num_", "=_", "msg_", "._", "node", "numbers_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dummy_", "=_", "self_", "._", "phys", "_", "[_", "node", "num_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "xpos_", "=_", "msg_", "._", "gett", "lv_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "NODE", "\\u", "XP", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "ypos_", "=_", "msg_", "._", "gett", "lv_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "NODE", "\\u", "YP", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dummy_", "._", "setp", "osition", "_", "(_", "node", "xpos_", ",_", "node", "ypos_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mob", "ilit", "y", "Manager_", "(_", "Configura", "ble", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "install", "phys", "nodes_", "(_", "self_", ",_", "net_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Af", "ter", " ", "install", "ing", " ", "a", " ", "mobi", "lit", "y", " ", "model", " ", "on", " ", "a", " ", "net", ",", " ", "include", " ", "any", " ", "physical", "\\", "10", ";", " ", " ", " ", " ", "nodes", " ", "tha", "t", " ", "we", " ", "have", " ", "recorde", "d", ".", " ", "Us", "e", " ", "the", " ", "Gre", "Tap", " ", "tunnel", " ", "to", " ", "the", " ", "physical", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "the", " ", "node", "'", "s", " ", "interface", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "nums_", "=_", "self_", "._", "phys", "nets_", "[_", "net_", "._", "obji", "d_", "]_", "\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node", "num_", "in_", "node", "nums_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "self_", "._", "phys", "_", "[_", "node", "num_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "servers_", "=_", "self_", "._", "session_", "._", "broker_", "._", "gets", "erver", "sb", "yn", "ode_", "(_", "node", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "host_", ",_", "port_", ",_", "sock_", ")_", "=_", "self_", "._", "session_", "._", "broker_", "._", "gets", "erver_", "(_", "servers_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neti", "f_", "=_", "self_", "._", "session_", "._", "broker_", "._", "gett", "unne", "l_", "(_", "net_", "._", "obji", "d_", ",_", "IPA", "ddr_", "._", "toi", "nt_", "(_", "host_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "addn", "eti", "f_", "(_", "neti", "f_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neti", "f_", "._", "node_", "=_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "=_", "neti", "f_", "._", "node_", "._", "position_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neti", "f_", "._", "pos", "hook_", "(_", "neti", "f_", ",_", "x_", ",_", "y_", ",_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Wire", "less", "Model_", "(_", "Configura", "ble_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Base", " ", "class", " ", "used", " ", "by", " ", "EMA", "NE", " ", "model", "s", " ", "and", " ", "the", " ", "basic", " ", "range", " ", "model", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "Us", "ed", " ", "for", " ", "mana", "ging", " ", "arbitra", "ry", " ", "configura", "tion", " ", "parameter", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "type_", "=_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "REG", "\\u", "WIRE", "LESS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "bitmap_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "position", "callback_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Wire", "less", "Model_", "(_", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ",_", "obji", "d_", ",_", "verbose_", "=_", "False_", ",_", "values_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Configura", "ble_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ",_", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verbose_", "=_", "verbose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "'", "values", "'", " ", "can", " ", "be", " ", "retrieved", " ", "from", " ", "a", " ", "Configura", "ble", "Manager", ",", " ", "or", " ", "used", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dur", "ing", " ", "initialization", ",", " ", "depend", "ing", " ", "on", " ", "the", " ", "model", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Wire", "less", "Model_", "(_", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tol", "ink", "msgs_", "(_", "self_", ",_", "flags_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Ma", "y", " ", "be", " ", "used", " ", "if", " ", "the", " ", "model", " ", "can", " ", "populate", " ", "the", " ", "GU", "I", " ", "with", " ", "wireless", " ", "(", "green", ")", "\\", "10", ";", " ", " ", " ", " ", "link", " ", "lines", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wire", "less", "Model_", "(_", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "moved_", ",_", "moved", "\\u", "neti", "fs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wire", "less", "Model_", "(_", "Configura", "ble_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "config_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "For", " ", "run", "-", "time", " ", "update", "s", " ", "of", " ", "model", " ", "config", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "whe", "n", " ", "self", ".\\u", "position", "callback", "()", " ", "and", " ", "self", ".", "setl", "ink", "params", "()", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "be", " ", "invoke", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\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_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Basic", " ", "Range", " ", "wireless", " ", "model", ",", " ", "calcul", "ates", " ", "range", " ", "bet", "ween", " ", "nodes", " ", "and", " ", "link", "s", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "unlink", "s", " ", "nodes", " ", "based", " ", "on", " ", "this", " ", "distance", ".", " ", "Thi", "s", " ", "was", " ", "former", "ly", " ", "don", "e", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "GU", "I", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "name_", "=_", "\"", "basic", "\\u", "range", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "configura", "tion", " ", "parameter", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "(", " ", "'", "name", "',", " ", "'", "type", "',", " ", "'", "default", "',", " ", "'", "possib", "le", "-", "value", "-", "list", "',", " ", "'", "caption", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "conf", "matrix_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "range", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "UINT", "32_", ",_", "'", "275", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "wireless", " ", "range", " ", "(", "pixel", "s", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "bandwi", "dth", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "UINT", "32_", ",_", "'", "540", "00", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "bandwi", "dth", " ", "(", "bps", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "jitter", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "FLOAT_", ",_", "'", "0.", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "transmission", " ", "jitter", " ", "(", "usec", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "dela", "y", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "FLOAT_", ",_", "'", "5000", ".0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "transmission", " ", "dela", "y", " ", "(", "usec", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "error", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "FLOAT_", ",_", "'", "0.", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "error", " ", "rate", " ", "(%", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "value", " ", "grouping", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "conf", "groups_", "=_", "\"", "Basic", " ", "Range", " ", "Parameter", "s", ":", "1", "-%", "d", "\"_", "%_", "len_", "(_", "\\u", "conf", "matrix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "position", "callback_", "=_", "set\\u", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ",_", "obji", "d_", ",_", "verbose_", "=_", "False_", ",_", "values_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Range", " ", "model", " ", "is", " ", "only", " ", "instantiate", "d", " ", "dur", "ing", " ", "runt", "ime", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Basic", "Range", "Model_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "session_", "=_", "session_", ",_", "obji", "d_", "=_", "obji", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wlan", "_", "=_", "session_", "._", "obj_", "(_", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "neti", "fs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "neti", "fs", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "values_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "session_", "._", "mobi", "lity_", "._", "getcon", "fig_", "(_", "obji", "d_", ",_", "self_", "._", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "getde", "fault", "values_", "(_", ")_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "range_", "=_", "float_", "(_", "self_", "._", "value", "of_", "(_", "\"", "range", "\"_", ",_", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "info_", "(_", "\"", "Basic", " ", "range", " ", "model", " ", "configur", "ed", " ", "for", " ", "WL", "AN", " ", "%", "d", " ", "usi", "ng", "\"_", "\"", " ", "range", " ", "%", "d", "\"_", "%_", "(_", "obji", "d_", ",_", "self_", "._", "range_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "values", "tol", "ink", "params_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "values", "tol", "ink", "params_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bw_", "=_", "int_", "(_", "self_", "._", "value", "of_", "(_", "\"", "bandwi", "dth", "\"_", ",_", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "bw_", "==_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bw_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "delay_", "=_", "float_", "(_", "self_", "._", "value", "of_", "(_", "\"", "dela", "y", "\"_", ",_", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "delay_", "==_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "delay_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "loss_", "=_", "float_", "(_", "self_", "._", "value", "of_", "(_", "\"", "error", "\"_", ",_", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "loss_", "==_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "loss_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "jitter_", "=_", "float_", "(_", "self_", "._", "value", "of_", "(_", "\"", "jitter", "\"_", ",_", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "jitter_", "==_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "jitter_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "configur", "e\\u", "mob", "_", "(_", "cls_", ",_", "session_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "configura", "tion", " ", "message", "s", " ", "for", " ", "setti", "ng", " ", "up", " ", "a", " ", "model", ".", "\\", "10", ";", " ", " ", " ", " ", "Pass", " ", "the", " ", "Mob", "ilit", "y", "Manager", " ", "object", " ", "as", " ", "the", " ", "manage", "r", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "configure_", "(_", "session_", "._", "mobi", "lity_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setl", "ink", "params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Apply", " ", "link", " ", "parameter", "s", " ", "to", " ", "all", " ", "interface", "s", ".", " ", "Thi", "s", " ", "is", " ", "invoke", "d", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "Wl", "an", "Node", ".", "setmo", "del", "()", " ", "after", " ", "the", " ", "position", " ", "callback", " ", "has", " ", "bee", "n", " ", "set", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "\\u", "neti", "fs", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "neti", "f_", "in_", "self_", "._", "\\u", "neti", "fs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wlan", "_", "._", "link", "config_", "(_", "neti", "f_", ",_", "bw_", "=_", "self_", "._", "bw_", ",_", "delay_", "=_", "self_", "._", "delay_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "loss_", "=_", "self_", "._", "loss_", ",_", "duplicate_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "jitter_", "=_", "self_", "._", "jitter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "position_", "(_", "self_", ",_", "neti", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "\\u", "neti", "fs", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "neti", "fs_", "[_", "neti", "f_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "position_", "(_", "self_", ",_", "neti", "f_", ",_", "x_", "=_", "None_", ",_", "y_", "=_", "None_", ",_", "z_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "A", " ", "node", " ", "has", " ", "moved", ";", " ", "give", "n", " ", "an", " ", "interface", ",", " ", "a", " ", "new", " ", "(", "x", ",", "y", ",", "z", ")", " ", "position", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "bee", "n", " ", "set", ";", " ", "calcul", "ate", " ", "the", " ", "new", " ", "distance", " ", "bet", "ween", " ", "other", " ", "nodes", " ", "and", " ", "link", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "unlink", " ", "node", " ", "pair", "s", " ", "based", " ", "on", " ", "the", " ", "configur", "ed", " ", "range", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "set\\u", "position", "(%", "s", ",", " ", "x", "=", "%", "s", ",", " ", "y", "=", "%", "s", ",", " ", "z", "=", "%", "s", ")\"", " ", "%", " ", "(", "neti", "f", ".", "local", "name", ",", " ", "x", ",", " ", "y", ",", " ", "z", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "neti", "fs", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "neti", "fs_", "[_", "neti", "f_", "]_", "=_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "x_", "is_", "None_", "or_", "y_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "neti", "fs", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "neti", "f2_", "in_", "self_", "._", "\\u", "neti", "fs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "calc", "link_", "(_", "neti", "f_", ",_", "neti", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "neti", "fs", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "moved_", ",_", "moved", "\\u", "neti", "fs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Node", " ", "position", "s", " ", "have", " ", "change", "d", " ", "with", "out", " ", "recalc", ".", " ", "Update", " ", "position", "s", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "node", ".", "position", ",", " ", "then", " ", "re", "-", "calcul", "ate", " ", "link", "s", " ", "for", " ", "tho", "se", " ", "tha", "t", " ", "have", " ", "moved", ".", "\\", "10", ";", " ", " ", " ", " ", "Assume", "s", " ", "bidirect", "ional", " ", "link", "s", ",", " ", "with", " ", "one", " ", "calculati", "on", " ", "per", " ", "node", " ", "pair", ",", " ", "where", "\\", "10", ";", " ", " ", " ", " ", "one", " ", "of", " ", "the", " ", "nodes", " ", "has", " ", "moved", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "\\u", "neti", "fs", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "len_", "(_", "moved", "\\u", "neti", "fs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "neti", "f_", "=_", "moved", "\\u", "neti", "fs_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "nx_", ",_", "ny_", ",_", "nz_", ")_", "=_", "neti", "f_", "._", "node_", "._", "getp", "osition", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "neti", "f_", "in_", "self_", "._", "\\u", "neti", "fs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "neti", "fs_", "[_", "neti", "f_", "]_", "=_", "(_", "nx_", ",_", "ny_", ",_", "nz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "neti", "f2_", "in_", "self_", "._", "\\u", "neti", "fs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "neti", "f2_", "in_", "moved", "\\u", "neti", "fs_", ":_", "\\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_", "._", "calc", "link_", "(_", "neti", "f_", ",_", "neti", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calc", "link_", "(_", "self_", ",_", "neti", "f_", ",_", "neti", "f2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Help", "er", " ", "used", " ", "by", " ", "set\\u", "position", "()", " ", "and", " ", "update", "()", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "calcul", "ate", " ", "distance", " ", "bet", "ween", " ", "two", " ", "interface", "s", " ", "and", " ", "perform", "\\", "10", ";", " ", " ", " ", " ", "linking", "/", "unlink", "ing", ".", " ", "Sen", "ds", " ", "link", "/", "unlink", " ", "message", "s", " ", "and", " ", "update", "s", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Wl", "an", "Node", "'", "s", " ", "linked", " ", "dict", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "neti", "f_", "==_", "neti", "f2_", ":_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "=_", "self_", "._", "\\u", "neti", "fs_", "[_", "neti", "f_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "x2_", ",_", "y2_", ",_", "z2_", ")_", "=_", "self_", "._", "\\u", "neti", "fs_", "[_", "neti", "f2_", "]_", "\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "x2_", "is_", "None_", "or_", "y2_", "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_", "d_", "=_", "self_", "._", "calc", "distance_", "(_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", ",_", "(_", "x2_", ",_", "y2_", ",_", "z2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "orderi", "ng", " ", "is", " ", "importa", "nt", ",", " ", "to", " ", "keep", " ", "the", " ", "wlan", ".\\u", "linked", " ", "dict", " ", "organize", "d_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "min_", "(_", "neti", "f_", ",_", "neti", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "max_", "(_", "neti", "f_", ",_", "neti", "f2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wlan", "_", "._", "\\u", "linked", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linked_", "=_", "self_", "._", "wlan", "_", "._", "linked_", "(_", "a_", ",_", "b_", ")_", "\\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_", "\\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_", "._", "wlan", "_", "._", "\\u", "linked", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "d_", ">_", "self_", "._", "range_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "linked_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wlan", "_", "._", "unlink_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "link", "msg_", "(_", "a_", ",_", "b_", ",_", "unlink_", "=_", "True_", ")_", "\\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_", "not_", "linked_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wlan", "_", "._", "link_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "link", "msg_", "(_", "a_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "calc", "distance_", "(_", "p1_", ",_", "p2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Calculat", "e", " ", "the", " ", "distance", " ", "bet", "ween", " ", "two", " ", "three", "-", "dimension", "al", " ", "points", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "p1_", "[_", "0_", "]_", "-_", "p2_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "p1_", "[_", "1_", "]_", "-_", "p2_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p1_", "[_", "2_", "]_", "is_", "not_", "None_", "and_", "p2_", "[_", "2_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "p1_", "[_", "2_", "]_", "-_", "p2_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "math_", "._", "hypot", "_", "(_", "math_", "._", "hypot", "_", "(_", "a_", ",_", "b_", ")_", ",_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "config_", "(_", "self_", ",_", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Configura", "tion", " ", "has", " ", "change", "d", " ", "dur", "ing", " ", "runt", "ime", ".", "\\", "10", ";", " ", " ", " ", " ", "Mob", "ilit", "y", "Manager", ".", "setc", "onfi", "g", "()", " ", "->", " ", "Wl", "an", "Node", ".", "update", "model", "()", " ", "->", " ", "\\", "10", ";", " ", " ", " ", " ", "Wire", "less", "Model", ".", "update", "config", "()", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "values", "tol", "ink", "params_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "range_", "=_", "float_", "(_", "self_", "._", "value", "of_", "(_", "\"", "range", "\"_", ",_", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "link", "msg_", "(_", "self_", ",_", "neti", "f_", ",_", "neti", "f2_", ",_", "flags_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Creat", "e", " ", "a", " ", "wireless", " ", "link", "/", "unlink", " ", "API", " ", "message", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n1_", "=_", "neti", "f_", "._", "local", "name_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n2_", "=_", "neti", "f2_", "._", "local", "name_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "N1", "NUMBER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "neti", "f_", "._", "node_", "._", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "N", "2", "NUMBER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "neti", "f2_", "._", "node_", "._", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "NET", "ID_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wlan", "_", "._", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "tlv", "data", " ", "+=", " ", "core", "api", ".", "Core", "Link", "Tl", "v", ".", "pack", "(", "core", "api", ".", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "1", "NUM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "neti", "f", ".", "index", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "tlv", "data", " ", "+=", " ", "core", "api", ".", "Core", "Link", "Tl", "v", ".", "pack", "(", "core", "api", ".", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "IF", "2", "NUM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "neti", "f2", ".", "index", ")_", "\\u\\u\\uNL\\u\\u\\u_", "tlv", "data_", "+=_", "core", "api_", "._", "Core", "Link", "Tl", "v_", "._", "pack_", "(_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "LINK", "\\u", "TYPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "core", "api_", "._", "CORE", "\\u", "LINK", "\\u", "WIRE", "LESS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "core", "api_", "._", "Core", "Link", "Message_", "._", "pack_", "(_", "flags_", ",_", "tlv", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "link", "msg_", "(_", "self_", ",_", "neti", "f_", ",_", "neti", "f2_", ",_", "unlink_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Sen", "d", " ", "a", " ", "wireless", " ", "link", "/", "unlink", " ", "API", " ", "message", " ", "to", " ", "the", " ", "GU", "I", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unlink_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "=_", "core", "api_", "._", "CORE", "\\u", "API", "\\u", "DEL", "\\u", "FLAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flags_", "=_", "core", "api_", "._", "CORE", "\\u", "API", "\\u", "ADD", "\\u", "FLAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "self_", "._", "link", "msg_", "(_", "neti", "f_", ",_", "neti", "f2_", ",_", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "broadcast", "raw_", "(_", "src_", "=_", "None_", ",_", "data_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "sd", "t_", "._", "update", "link_", "(_", "neti", "f_", "._", "node_", "._", "obji", "d_", ",_", "neti", "f2_", "._", "node_", "._", "obji", "d_", ",_", "flags_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wireless", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Range", "Model_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tol", "ink", "msgs_", "(_", "self_", ",_", "flags_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "wireless", " ", "link", " ", "message", "s", " ", "for", " ", "whe", "n", " ", "the", " ", "GU", "I", " ", "reconnect", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "wlan", "_", "._", "\\u", "linked", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "a_", "in_", "self_", "._", "wlan", "_", "._", "\\u", "linked_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "b_", "in_", "self_", "._", "wlan", "_", "._", "\\u", "linked_", "[_", "a_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "wlan", "_", "._", "\\u", "linked_", "[_", "a_", "]_", "[_", "b_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "r_", "._", "append_", "(_", "self_", "._", "link", "msg_", "(_", "a_", ",_", "b_", ",_", "flags_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Abstract", " ", "class", " ", "for", " ", "mobi", "lit", "y", " ", "model", "s", " ", "tha", "t", " ", "set", " ", "node", " ", "waypoints", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "name_", "=_", "\"", "waypoint", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "type_", "=_", "core", "api_", "._", "CORE", "\\u", "TLV", "\\u", "REG", "\\u", "MOB", "ILI", "TY_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STATE", "\\u", "STOPPED", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATE", "\\u", "RUNNING_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATE", "\\u", "PAUSE", "D_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Way", "Point_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "time_", ",_", "node", "num_", ",_", "coords_", ",_", "speed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "time_", "=_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "node", "num_", "=_", "node", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "coords_", "=_", "coords_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "speed_", "=_", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "cmp", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "cmp_", "(_", "self_", "._", "time_", ",_", "other_", "._", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmp_", "=_", "cmp_", "(_", "self_", "._", "node", "num_", ",_", "other_", "._", "node", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tmp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ",_", "obji", "d_", ",_", "verbose_", "=_", "False_", ",_", "values_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Way", "Point", "Mob", "ility_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "session_", "=_", "session_", ",_", "obji", "d_", "=_", "obji", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "verbose_", ",_", "values_", "=_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "=_", "self_", "._", "STATE", "\\u", "STOPPED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "queue_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "queue", "\\u", "copy_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "points_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "initial_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "endtime_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wlan", "_", "=_", "session_", "._", "obj_", "(_", "obji", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "these", " ", "are", " ", "reall", "y", " ", "set", " ", "in", " ", "child", " ", "class", " ", "via", " ", "conf", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "loop_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "refre", "sh", "\\u", "ms_", "=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "flag", " ", "whe", "ther", " ", "to", " ", "stop", " ", "sched", "ulin", "g", " ", "whe", "n", " ", "queue", " ", "is", " ", "empty_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "(", "ns", "-", "3", " ", "sets", " ", "this", " ", "to", " ", "Fal", "se", " ", "as", " ", "new", " ", "waypoints", " ", "may", " ", "be", " ", "adde", "d", " ", "from", " ", "trace", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "empty", "\\u", "queue", "\\u", "stop_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "round_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Advance", " ", "script", " ", "time", " ", "and", " ", "move", " ", "nodes", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "state_", "!=_", "self_", "._", "STATE", "\\u", "RUNNING_", ":_", "\\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_", "t_", "=_", "self_", "._", "last", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "self_", "._", "last", "time_", "-_", "self_", "._", "time", "zero_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dt_", "=_", "self_", "._", "last", "time_", "-_", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "run", "round", "(", "now", "=", "%", ".2", "f", ",", " ", "dt", "=", "%", ".2", "f", ")\"", " ", "%", " ", "(", "now", ",", " ", "dt", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keep", " ", "current", " ", "waypoints", " ", "up", "-", "to", "-", "date_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update", "points_", "(_", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "len_", "(_", "self_", "._", "points_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "queue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "more", " ", "future", " ", "waypoints", ",", " ", "allow", " ", "time", " ", "for", " ", "self", ".", "last", "time", " ", "update_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "time_", "=_", "self_", "._", "queue_", "[_", "0_", "]_", "._", "time_", "-_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "next", "time_", ">_", "(_", "0.001_", "*_", "self_", "._", "refre", "sh", "\\u", "ms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "next", "time_", "-=_", "(_", "0.001_", "*_", "self_", "._", "refre", "sh", "\\u", "ms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "session_", "._", "ev", "q_", "._", "add", "\\u", "event_", "(_", "next", "time_", ",_", "self_", "._", "run", "round_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "more", " ", "waypoints", " ", "or", " ", "queue", "d", " ", "items", ",", " ", "loop", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "empty", "\\u", "queue", "\\u", "stop_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "keep", " ", "runn", "ing", " ", "every", " ", "refre", "sh", "\\u", "ms", ",", " ", "even", " ", "with", " ", "empty", " ", "queue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "session_", "._", "ev", "q_", "._", "add", "\\u", "event_", "(_", "0.001_", "*_", "self_", "._", "refre", "sh", "\\u", "ms_", ",_", "self_", "._", "run", "round_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "loop", "waypoints", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "self_", "._", "stop_", "(_", "move", "\\u", "initial_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "len_", "(_", "self_", "._", "queue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prevent", " ", "bus", "y", " ", "loop_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "move", " ", "neti", "fs", " ", "attache", "d", " ", "to", " ", "self", ".", "wlan", ",", " ", "or", " ", "all", " ", "node", "num", " ", "in", " ", "script", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "moved_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "moved", "\\u", "neti", "fs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "neti", "f_", "in_", "self_", "._", "wlan", "_", "._", "neti", "fs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "neti", "f_", "._", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "move", "node_", "(_", "node_", ",_", "dt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "moved_", "._", "append_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "moved", "\\u", "neti", "fs_", "._", "append_", "(_", "neti", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "all", " ", "ranges", " ", "after", " ", "movin", "g", " ", "nodes", ";", " ", "this", " ", "save", "s", " ", "calculati", "ons_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "wlan", ".", "model", ".", "update", "(", "moved", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "session_", "._", "mobi", "lity_", "._", "update", "wlan", "s_", "(_", "moved_", ",_", "moved", "\\u", "neti", "fs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "check", " ", "session", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "._", "ev", "q_", "._", "add", "\\u", "event_", "(_", "0.001_", "*_", "self_", "._", "refre", "sh", "\\u", "ms_", ",_", "self_", "._", "run", "round_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "time", "zero_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "time_", "=_", "self_", "._", "time", "zero_", "-_", "(_", "0.001_", "*_", "self_", "._", "refre", "sh", "\\u", "ms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "move", "nodes", "initial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "round_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "mobi", "lity_", "._", "send", "event_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "move", "node_", "(_", "self_", ",_", "node_", ",_", "dt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Calculat", "e", " ", "next", " ", "node", " ", "location", " ", "and", " ", "update", " ", "its", " ", "coordinate", "s", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "the", " ", "node", "'", "s", " ", "position", " ", "has", " ", "change", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", "._", "obji", "d_", "not_", "in_", "self_", "._", "points_", ":_", "\\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_", "x1_", ",_", "y1_", ",_", "z1_", "=_", "node_", "._", "getp", "osition", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", ",_", "y2_", ",_", "z2_", "=_", "self_", "._", "points_", "[_", "node_", "._", "obji", "d_", "]_", "._", "coords_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "speed_", "=_", "self_", "._", "points_", "[_", "node_", "._", "obji", "d_", "]_", "._", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "instant", "ane", "ous", " ", "move", " ", "(", "prevent", "s", " ", "dx", "/", "dy", " ", "==", " ", "0.", "0", " ", "belo", "w", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "speed_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "setn", "ode", "position_", "(_", "node_", ",_", "x2_", ",_", "y2_", ",_", "z2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "points_", "[_", "node_", "._", "obji", "d_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "speed", " ", "can", " ", "be", " ", "a", " ", "velo", "city", " ", "vector", " ", "(", "ns", "3", " ", "mobi", "lit", "y", ")", " ", "or", " ", "speed", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "speed_", ",_", "(_", "float_", ",_", "int_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "linear", " ", "speed", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alpha_", "=_", "math_", "._", "atan2_", "(_", "y2_", "-_", "y1_", ",_", "x2_", "-_", "x1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sx_", "=_", "speed_", "*_", "math_", "._", "cos_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sy_", "=_", "speed_", "*_", "math_", "._", "sin_", "(_", "alpha_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "velo", "city", " ", "vector_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sx_", "=_", "speed_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sy_", "=_", "speed_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calcul", "ate", " ", "dt", " ", "*", " ", "speed", " ", "=", " ", "distance", " ", "moved_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dx_", "=_", "sx_", "*_", "dt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dy_", "=_", "sy_", "*_", "dt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prevent", " ", "overs", "hoo", "t_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "abs_", "(_", "dx_", ")_", ">_", "abs_", "(_", "x2_", "-_", "x1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dx_", "=_", "x2_", "-_", "x1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "abs_", "(_", "dy_", ")_", ">_", "abs_", "(_", "y2_", "-_", "y1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dy_", "=_", "y2_", "-_", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dx_", "==_", "0.0_", "and_", "dy_", "==_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "endtime_", "<_", "(_", "self_", "._", "last", "time_", "-_", "self_", "._", "time", "zero_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "node", " ", "to", " ", "reach", " ", "the", " ", "last", " ", "waypoint", " ", "dete", "rmin", "es", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "script", "'", "s", " ", "endtime_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "endtime_", "=_", "self_", "._", "last", "time_", "-_", "self_", "._", "time", "zero_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "self_", "._", "points_", "[_", "node_", "._", "obji", "d_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "node", " ", "%", "s", " ", "dx", ",", "dy", "=", " ", "<", "%", "s", ",", " ", "%", "d", ">\"", " ", "%", " ", "(", "node", ".", "name", ",", " ", "dx", ",", " ", "dy", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "x1_", "+_", "dx_", ")_", "<_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dx_", "=_", "0.0_", "-_", "x1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "y1_", "+_", "dy_", ")_", "<_", "0.0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dy_", "=_", "0.0_", "-_", "y1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "setn", "ode", "position_", "(_", "node_", ",_", "x1_", "+_", "dx_", ",_", "y1_", "+_", "dy_", ",_", "z1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "move", "nodes", "initial_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Move", " ", "nodes", " ", "to", " ", "thei", "r", " ", "initial", " ", "position", "s", ".", " ", "The", "n", " ", "calcul", "ate", " ", "the", " ", "ranges", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "moved_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "moved", "\\u", "neti", "fs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "neti", "f_", "in_", "self_", "._", "wlan", "_", "._", "neti", "fs_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "neti", "f_", "._", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", "._", "obji", "d_", "not_", "in_", "self_", "._", "initial_", ":_", "\\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_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "=_", "self_", "._", "initial_", "[_", "node_", "._", "obji", "d_", "]_", "._", "coords_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setn", "ode", "position_", "(_", "node_", ",_", "x_", ",_", "y_", ",_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "moved_", "._", "append_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "moved", "\\u", "neti", "fs_", "._", "append_", "(_", "neti", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "wlan", ".", "model", ".", "update", "(", "moved", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "session_", "._", "mobi", "lity_", "._", "update", "wlan", "s_", "(_", "moved_", ",_", "moved", "\\u", "neti", "fs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "waypoint", "_", "(_", "self_", ",_", "time_", ",_", "node", "num_", ",_", "x_", ",_", "y_", ",_", "z_", ",_", "speed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Way", "points", " ", "are", " ", "pushed", " ", "to", " ", "a", " ", "heap", "q", ",", " ", "sorte", "d", " ", "by", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "add", "waypoint", ":", " ", "%", "s", " ", "%", "s", " ", "%", "s", ",%", "s", ",%", "s", " ", "%", "s", "\"", " ", "%", " ", "(", "time", ",", " ", "node", "num", ",", " ", "x", ",", " ", "y", ",", " ", "z", ",", " ", "speed", ")_", "\\u\\u\\uNL\\u\\u\\u_", "wp_", "=_", "self_", "._", "Way", "Point_", "(_", "time_", ",_", "node", "num_", ",_", "coords_", "=_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", ",_", "speed_", "=_", "speed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heapq_", "._", "heapp", "ush_", "(_", "self_", "._", "queue_", ",_", "wp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "addin", "iti", "al_", "(_", "self_", ",_", "node", "num_", ",_", "x_", ",_", "y_", ",_", "z_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Record", " ", "initial", " ", "position", " ", "in", " ", "a", " ", "dict", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wp_", "=_", "self_", "._", "Way", "Point_", "(_", "0_", ",_", "node", "num_", ",_", "coords_", "=_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", ",_", "speed_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "initial_", "[_", "node", "num_", "]_", "=_", "wp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "points_", "(_", "self_", ",_", "now_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Move", " ", "items", " ", "from", " ", "self", ".", "queue", " ", "to", " ", "self", ".", "points", " ", "whe", "n", " ", "thei", "r", " ", "time", " ", "has", " ", "come", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "self_", "._", "queue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "queue_", "[_", "0_", "]_", "._", "time_", ">_", "now_", ":_", "\\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_", "wp_", "=_", "heapq_", "._", "heapp", "op_", "(_", "self_", "._", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "points_", "[_", "wp_", "._", "node", "num_", "]_", "=_", "wp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "waypoints", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Stor", "e", " ", "backup", " ", "copy", " ", "of", " ", "waypoints", " ", "for", " ", "looping", " ", "and", " ", "stopping", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "queue", "\\u", "copy_", "=_", "list_", "(_", "self_", "._", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "loop", "waypoints", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Restor", "e", " ", "backup", " ", "copy", " ", "of", " ", "waypoints", " ", "whe", "n", " ", "looping", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "queue_", "=_", "list_", "(_", "self_", "._", "queue", "\\u", "copy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setn", "ode", "position_", "(_", "self_", ",_", "node_", ",_", "x_", ",_", "y_", ",_", "z_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Help", "er", " ", "to", " ", "move", " ", "a", " ", "node", ",", " ", "notif", "y", " ", "any", " ", "GU", "I", " ", "(", "connect", "ed", " ", "session", " ", "handler", "s", "),", "\\", "10", ";", " ", " ", " ", " ", "with", "out", " ", "inv", "oki", "ng", " ", "the", " ", "interface", " ", "pos", "hook", " ", "callback", " ", "tha", "t", " ", "may", " ", "perform", "\\", "10", ";", " ", " ", " ", " ", "range", " ", "calculati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "wou", "ld", " ", "caus", "e", " ", "Py", "Core", "Net", "If", ".", "pos", "hook", "()", " ", "callback", " ", "(", "range", " ", "calculati", "on", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "node", ".", "setp", "osition", "(", "x", ",", " ", "y", ",", " ", "z", ")_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "position_", "._", "set_", "(_", "x_", ",_", "y_", ",_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "node_", "._", "ton", "ode", "msg_", "(_", "flags_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "broadcast", "raw_", "(_", "None_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "sd", "t_", "._", "update", "node_", "(_", "node_", "._", "obji", "d_", ",_", "flags_", "=_", "0_", ",_", "x_", "=_", "x_", ",_", "y_", "=_", "y_", ",_", "z_", "=_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sete", "ndt", "ime_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Set", " ", "self", ".", "endtime", " ", "to", " ", "the", " ", "time", " ", "of", " ", "the", " ", "last", " ", "waypoint", " ", "in", " ", "the", " ", "queue", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "waypoints", ".", " ", "Thi", "s", " ", "is", " ", "just", " ", "an", " ", "estimate", ".", " ", "The", " ", "endtime", " ", "will", " ", "late", "r", " ", "be", " ", "\\", "10", ";", " ", " ", " ", " ", "adjusted", ",", " ", "after", " ", "one", " ", "round", " ", "of", " ", "the", " ", "script", " ", "has", " ", "run", ",", " ", "to", " ", "be", " ", "the", " ", "time", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "the", " ", "last", " ", "movin", "g", " ", "node", " ", "has", " ", "reache", "d", " ", "its", " ", "final", " ", "waypoint", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "endtime_", "=_", "self_", "._", "queue_", "[_", "-_", "1_", "]_", "._", "time_", "\\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 ", " _", "self_", "._", "endtime_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Run", " ", "the", " ", "script", " ", "from", " ", "the", " ", "beginn", "ing", " ", "or", " ", "unpa", "use", " ", "from", " ", "where", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "was", " ", "bef", "ore", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lasts", "tate_", "=_", "self_", "._", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "=_", "self_", "._", "STATE", "\\u", "RUNNING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lasts", "tate_", "==_", "self_", "._", "STATE", "\\u", "STOPPED", "_", "or_", "lasts", "tate_", "==_", "self_", "._", "STATE", "\\u", "RUNNING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "loop", "waypoints", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time", "zero_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "time_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "lasts", "tate_", "==_", "self_", "._", "STATE", "\\u", "PAUSE", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time", "zero_", "+=_", "now_", "-_", "self_", "._", "last", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "time_", "=_", "now_", "-_", "(_", "0.001_", "*_", "self_", "._", "refre", "sh", "\\u", "ms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "round_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop_", "(_", "self_", ",_", "move", "\\u", "initial_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Sto", "p", " ", "the", " ", "script", " ", "and", " ", "move", " ", "nodes", " ", "to", " ", "initial", " ", "position", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "=_", "self_", "._", "STATE", "\\u", "STOPPED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "loop", "waypoints", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time", "zero_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "time_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "move", "\\u", "initial_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "move", "nodes", "initial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "session_", "._", "mobi", "lity_", "._", "send", "event_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Way", "Point", "Mob", "ility_", "(_", "Wire", "less", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pause_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Pause", " ", "the", " ", "script", ";", " ", "paus", "e", " ", "time", " ", "is", " ", "store", "d", " ", "to", " ", "self", ".", "last", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "=_", "self_", "._", "STATE", "\\u", "PAUSE", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", "s", " ", "the", " ", "ns", "-", "2", " ", "script", " ", "format", ",", " ", "generat", "ed", " ", "by", " ", "scen", "gen", "/", "setd", "est", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "Bon", "n", "Motion", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "name_", "=_", "\"", "ns", "2s", "cript", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "conf", "matrix_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "file", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "STRING_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "mobi", "lit", "y", " ", "script", " ", "file", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "refre", "sh", "\\u", "ms", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "UINT", "32_", ",_", "'", "50", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "refre", "sh", " ", "time", " ", "(", "ms", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "loop", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "BOOL_", ",_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "On", ",", "Off", "'_", ",_", "'", "loop", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "autostart", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "STRING_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "auto", "-", "start", " ", "second", "s", " ", "(", "0.", "0", " ", "for", " ", "runt", "ime", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "map", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "STRING_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "node", " ", "mapping", " ", "(", "option", "al", ",", " ", "e", ".", "g", ".", " ", "0", ":", "1", ",", "1", ":", "2", ",", "2", ":", "3", ")'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "script", "\\u", "start", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "STRING_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "script", " ", "file", " ", "to", " ", "run", " ", "upo", "n", " ", "start", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "script", "\\u", "paus", "e", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "STRING_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "script", " ", "file", " ", "to", " ", "run", " ", "upo", "n", " ", "paus", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "script", "\\u", "stop", "\"_", ",_", "core", "api_", "._", "CONF", "\\u", "DATA", "\\u", "TYPE", "\\u", "STRING_", ",_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "script", " ", "file", " ", "to", " ", "run", " ", "upo", "n", " ", "stop", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "conf", "groups_", "=_", "\"", "ns", "-", "2", " ", "Mob", "ilit", "y", " ", "Script", " ", "Parameter", "s", ":", "1", "-%", "d", "\"_", "%_", "len_", "(_", "\\u", "conf", "matrix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "session_", ",_", "obji", "d_", ",_", "verbose_", "=_", "False_", ",_", "values_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Ns", "2", "Script", "ed", "Mob", "ility_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "session_", "=_", "session_", ",_", "obji", "d_", "=_", "obji", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "verbose_", ",_", "values_", "=_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "neti", "fs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "neti", "fs", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "values_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "session_", "._", "mobi", "lity_", "._", "getcon", "fig_", "(_", "obji", "d_", ",_", "self_", "._", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "getde", "fault", "values_", "(_", ")_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "file_", "=_", "self_", "._", "value", "of_", "(_", "\"", "file", "\"_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "refre", "sh", "\\u", "ms_", "=_", "int_", "(_", "self_", "._", "value", "of_", "(_", "\"", "refre", "sh", "\\u", "ms", "\"_", ",_", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "loop_", "=_", "(_", "self_", "._", "value", "of_", "(_", "\"", "loop", "\"_", ",_", "values_", ")_", "._", "lower_", "(_", ")_", "==_", "\"", "on", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "autostart", "_", "=_", "self_", "._", "value", "of_", "(_", "\"", "autostart", "\"_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parse", "map_", "(_", "self_", "._", "value", "of_", "(_", "\"", "map", "\"_", ",_", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "script", "\\u", "start_", "=_", "self_", "._", "value", "of_", "(_", "\"", "script", "\\u", "start", "\"_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "script", "\\u", "pause_", "=_", "self_", "._", "value", "of_", "(_", "\"", "script", "\\u", "paus", "e", "\"_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "script", "\\u", "stop_", "=_", "self_", "._", "value", "of_", "(_", "\"", "script", "\\u", "stop", "\"_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "info_", "(_", "\"", "ns", "-", "2", " ", "script", "ed", " ", "mobi", "lit", "y", " ", "configur", "ed", " ", "for", " ", "WL", "AN", " ", "%", "d", "\"_", "\"", " ", "usi", "ng", " ", "file", ":", " ", "%", "s", "\"_", "%_", "(_", "obji", "d_", ",_", "self_", "._", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "reads", "cript", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "copy", "waypoints", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sete", "ndt", "ime_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\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_", "configur", "e\\u", "mob", "_", "(_", "cls_", ",_", "session_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "configura", "tion", " ", "message", "s", " ", "for", " ", "setti", "ng", " ", "up", " ", "a", " ", "model", ".", "\\", "10", ";", " ", " ", " ", " ", "Pass", " ", "the", " ", "Mob", "ilit", "y", "Manager", " ", "object", " ", "as", " ", "the", " ", "manage", "r", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "configure_", "(_", "session_", "._", "mobi", "lity_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reads", "cript", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Read", " ", "in", " ", "mobi", "lit", "y", " ", "script", " ", "from", " ", "a", " ", "file", ".", " ", "Thi", "s", " ", "adds", " ", "waypoints", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "priorit", "y", " ", "queue", ",", " ", "sorte", "d", " ", "by", " ", "waypoint", " ", "time", ".", " ", "Initial", " ", "waypoints", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "store", "d", " ", "in", " ", "a", " ", "separate", " ", "dict", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "self_", "._", "find", "file_", "(_", "self_", "._", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "filename_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "ns", "-", "2", " ", "script", "ed", " ", "mobi", "lit", "y", " ", "fail", "ed", " ", "to", " ", "load", " ", "file", " ", "\"_", "\"", " ", "'%", "s", "'", " ", "(%", "s", ")\"_", "%_", "(_", "self_", "._", "file_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "info_", "(_", "\"", "readi", "ng", " ", "ns", "-", "2", " ", "script", " ", "file", ":", " ", "%", "s", "\"_", "%_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ln_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix_", "=_", "iy_", "=_", "iz_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inode", "num_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ln_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", "[_", ":_", "2_", "]_", "!=_", "'$", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "line_", "[_", ":_", "8_", "]_", "==_", "\"$", "ns", "\\u", " ", "at", " ", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "ix_", "is_", "not_", "None_", "and_", "iy_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "addin", "iti", "al_", "(_", "self_", "._", "map_", "(_", "inode", "num_", ")_", ",_", "ix_", ",_", "iy_", ",_", "iz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix_", "=_", "iy_", "=_", "iz_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "waypoints", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "$", "ns", "\\u", " ", "at", " ", "1.00", " ", "\"$", "node", "\\u(", "6", ")", " ", "setd", "est", " ", "500", ".0", " ", "178", ".0", " ", "25.0", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parts_", "=_", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "=_", "float_", "(_", "parts_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "num_", "=_", "parts_", "[_", "3_", "]_", "[_", "1_", "+_", "parts_", "[_", "3_", "]_", "._", "index_", "(_", "'('_", ")_", ":_", "parts_", "[_", "3_", "]_", "._", "index_", "(_", "')'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "float_", "(_", "parts_", "[_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "float_", "(_", "parts_", "[_", "6_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "z_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "speed_", "=_", "float_", "(_", "parts_", "[_", "7_", "]_", "._", "strip_", "(_", "'\"'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "waypoint", "_", "(_", "time_", ",_", "self_", "._", "map_", "(_", "node", "num_", ")_", ",_", "x_", ",_", "y_", ",_", "z_", ",_", "speed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "[_", ":_", "7_", "]_", "==_", "\"$", "node", "\\u(", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "initial", " ", "position", " ", "(", "time", "=", "0", ",", " ", "speed", "=", "0", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "$", "node", "\\u(", "6", ")", " ", "set", " ", "X", "\\u", " ", "780", ".0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "parts_", "=_", "line_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "num_", "=_", "parts_", "[_", "0_", "]_", "[_", "1_", "+_", "parts_", "[_", "0_", "]_", "._", "index_", "(_", "'('_", ")_", ":_", "parts_", "[_", "0_", "]_", "._", "index_", "(_", "')'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "parts_", "[_", "2_", "]_", "==_", "'", "X", "\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "ix_", "is_", "not_", "None_", "and_", "iy_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "addin", "iti", "al_", "(_", "self_", "._", "map_", "(_", "inode", "num_", ")_", ",_", "ix_", ",_", "iy_", ",_", "iz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix_", "=_", "iy_", "=_", "iz_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ix_", "=_", "float_", "(_", "parts_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "parts_", "[_", "2_", "]_", "==_", "'", "Y", "\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "iy_", "=_", "float_", "(_", "parts_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "parts_", "[_", "2_", "]_", "==_", "'", "Z", "\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "iz_", "=_", "float_", "(_", "parts_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "addin", "iti", "al_", "(_", "self_", "._", "map_", "(_", "node", "num_", ")_", ",_", "ix_", ",_", "iy_", ",_", "iz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ix_", "=_", "iy_", "=_", "iz_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inode", "num_", "=_", "node", "num_", "\\u\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "skip", "ping", " ", "line", " ", "%", "d", " ", "of", " ", "file", " ", "%", "s", " ", "'%", "s", "'", " ", "(%", "s", ")\"_", "%_", "(_", "ln_", ",_", "self_", "._", "file_", ",_", "line_", ",_", "e_", ")_", ")_", "\\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_", "if_", "ix_", "is_", "not_", "None_", "and_", "iy_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "addin", "iti", "al_", "(_", "self_", "._", "map_", "(_", "inode", "num_", ")_", ",_", "ix_", ",_", "iy_", ",_", "iz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "file_", "(_", "self_", ",_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Locat", "e", " ", "a", " ", "script", " ", "file", ".", " ", "If", " ", "the", " ", "specified", " ", "file", " ", "doe", "sn", "'", "t", " ", "exist", ",", " ", "look", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "same", " ", "director", "y", " ", "as", " ", "the", " ", "scen", "ario", " ", "file", " ", "(", "session", ".", "filename", "),", " ", "or", " ", "in", " ", "the", " ", "default", "\\", "10", ";", " ", " ", " ", " ", "configs", " ", "director", "y", " ", "(", "~", "/.", "core", "/", "configs", ").", " ", "Thi", "s", " ", "allow", "s", " ", "for", " ", "sample", " ", "files", " ", "with", "out", "\\", "10", ";", " ", " ", " ", " ", "abs", "olute", " ", "path", "names", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "fn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "filename_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "self_", "._", "session_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sess", "fn_", "=_", "os_", "._", "path_", "._", "join_", "(_", "d_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "sess", "fn_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sess", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "session_", "._", "user_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "fn_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'/", "home", "'_", ",_", "self_", "._", "session_", "._", "user_", ",_", "'.", "core", "'_", ",_", "'", "configs", "'_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "user", "fn_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "user", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "map_", "(_", "self_", ",_", "maps", "tr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Pars", "e", " ", "a", " ", "node", " ", "mapping", " ", "string", ",", " ", "give", "n", " ", "as", " ", "a", " ", "configura", "tion", " ", "parameter", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "node", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "maps", "tr_", "._", "strip_", "(_", ")_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "pair_", "in_", "maps", "tr_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "pair_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "parts_", ")_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "node", "map_", "[_", "int_", "(_", "parts_", "[_", "0_", "]_", ")_", "]_", "=_", "int_", "(_", "parts_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "ns", "-", "2", " ", "mobi", "lit", "y", " ", "node", " ", "map", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\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_", "map_", "(_", "self_", ",_", "node", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Map", " ", "one", " ", "node", " ", "number", " ", "(", "from", " ", "a", " ", "script", " ", "file", ")", " ", "to", " ", "anot", "her", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "num_", "=_", "int_", "(_", "node", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "node", "map_", "[_", "node", "num_", "]_", "\\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_", "node", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "startup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Start", " ", "runn", "ing", " ", "the", " ", "script", " ", "if", " ", "autostart", " ", "is", " ", "enable", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "Move", " ", "node", " ", "to", " ", "initial", " ", "position", "s", " ", "whe", "n", " ", "any", " ", "autostart", " ", "time", " ", "is", " ", "specified", ".", "\\", "10", ";", " ", " ", " ", " ", "Ignor", "e", " ", "the", " ", "script", " ", "if", " ", "autostart", " ", "is", " ", "an", " ", "empty", " ", "string", " ", "(", "can", " ", "still", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "start", "ed", " ", "via", " ", "GU", "I", " ", "controls", ").", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "autostart", "_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "info_", "(_", "\"", "not", " ", "auto", "-", "startin", "g", " ", "ns", "-", "2", " ", "script", " ", "for", " ", "%", "s", "\"_", "%_", "self_", "._", "wlan", "_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "=_", "float_", "(_", "self_", "._", "autostart", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "warn_", "(_", "\"", "Inva", "lid", " ", "auto", "-", "start", " ", "second", "s", " ", "specified", " ", "'%", "s", "'", " ", "for", " ", "\"_", "\"%", "s", "\"_", "%_", "(_", "self_", "._", "autostart", "_", ",_", "self_", "._", "wlan", "_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "move", "nodes", "initial_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "info_", "(_", "\"", "sched", "ulin", "g", " ", "ns", "-", "2", " ", "script", " ", "for", " ", "%", "s", " ", "autostart", " ", "at", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "wlan", "_", "._", "name_", ",_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "state_", "=_", "self_", "._", "STATE", "\\u", "RUNNING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "ev", "q_", "._", "add", "\\u", "event_", "(_", "t_", ",_", "self_", "._", "run_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Handle", " ", "the", " ", "case", " ", "whe", "n", " ", "un", "-", "paus", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lasts", "tate_", "=_", "self_", "._", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Ns", "2", "Script", "ed", "Mob", "ility_", ",_", "self_", ")_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lasts", "tate_", "==_", "self_", "._", "STATE", "\\u", "PAUSE", "D_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state", "script_", "(_", "\"", "unpa", "use", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Start", " ", "is", " ", "presse", "d", " ", "or", " ", "autostart", " ", "is", " ", "trigger", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Ns", "2", "Script", "ed", "Mob", "ility_", ",_", "self_", ")_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state", "script_", "(_", "\"", "run", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pause_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Ns", "2", "Script", "ed", "Mob", "ility_", ",_", "self_", ")_", "._", "pause_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state", "script_", "(_", "\"", "paus", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop_", "(_", "self_", ",_", "move", "\\u", "initial_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Ns", "2", "Script", "ed", "Mob", "ility_", ",_", "self_", ")_", "._", "stop_", "(_", "move", "\\u", "initial_", "=_", "move", "\\u", "initial_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state", "script_", "(_", "\"", "stop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ns", "2", "Script", "ed", "Mob", "ility_", "(_", "Way", "Point", "Mob", "ility_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "state", "script_", "(_", "self_", ",_", "types", "tr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "types", "tr_", "==_", "\"", "run", "\"_", "or_", "types", "tr_", "==_", "\"", "unpa", "use", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "script", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "types", "tr_", "==_", "\"", "paus", "e", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "script", "\\u", "pause_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "types", "tr_", "==_", "\"", "stop", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "script", "\\u", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filename_", "is_", "None_", "or_", "filename_", "==_", "''_", ":_", "\\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_", "filename_", "=_", "self_", "._", "find", "file_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "call_", "(_", "[_", "\"/", "bin", "/", "sh", "\"_", ",_", "filename_", ",_", "types", "tr_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", "=_", "self_", "._", "session_", "._", "session", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "self_", "._", "session_", "._", "gete", "nvir", "on_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "session_", "._", "warn_", "(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Test.py
[ { "content": "# Copyright 2016, Kay Hayen, mailto:[email protected]\n#\n# Python tests originally created or extracted from other peoples work. The\n# parts were too small to be protected.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nfrom __future__ import print_function\n\n\n\nprint(\"Testing locals():\")\nprint(someFunctionWritingLocals())\nprint(someFunctionWritingLocalsContainingExec())\n\n\nprint(\"Vars on module level\", displayDict(vars()))\n\nmodule_locals = locals()\n\n# Patch away \"__file__\" path in a hard to detect way. This will make sure,\n# repeated calls to locals really get the same dictionary.\nimport os\nmodule_locals[\"__file__\"] = os.path.basename(module_locals[ \"__file__\" ])\ndel module_locals\n\nprint(\"Use of locals on the module level\", displayDict(locals()))\n\n\n\nprint(\"Testing globals():\")\nsomeFunctionUsingGlobals()\n\nprint(\"Testing dir():\")\n\nprint(\"Module dir\", end = ' ')\n\n\nsomeFunctionUsingDir()\n\nprint(\"Making a new type, with type() and 3 args:\", end = ' ')\nnew_class = type(\"Name\", (object,), {})\nprint(new_class, new_class())\n\nprint(\"None has type\", type(None))\n\nprint(\"Constant ranges\", range(2), range(1, 6), range(3, 0, -1), range(3, 8, 2), range(5, -5, -3))\nprint(\"Border cases\", range(0), range(-1), range(-1, 1))\n\nprint(\"Corner case large negative value\", range(-2**100))\nprint(\"Corner case with large start/end values in small range\", range(2**100,2**100+2))\n\ntry:\n print(\"Range with 0 step gives:\", end = ' ')\n print(range(3, 8, 0))\nexcept ValueError as e:\n print(repr(e))\n\ntry:\n print(\"Range with float:\", end = ' ')\n print(range(1.0))\nexcept TypeError as e:\n print(\"Gives exception:\", repr(e))\n\ntry:\n print(\"Empty range call\", end = ' ')\n print(range())\nexcept TypeError as e:\n print(\"Gives exception:\", e)\n\nprint(\"List from iterable\", list(\"abc\"), list())\nprint(\"List from sequence\", list(sequence = (0, 1, 2)))\nprint(\"Tuple from iterable\", tuple(\"cda\"), tuple())\nprint(\"Tuple from sequence\", tuple(sequence = (0, 1, 2)))\n\nprint(\"Dictionary from iterable and keywords\", dict((\"ab\", (1, 2)), f = 1, g = 1))\nprint(\"More constant dictionaries\", {\"two\": 2, \"one\": 1}, {}, dict())\ng = {\"two\": 2, \"one\": 1}\nprint(\"Variable dictionary\", dict(g))\nprint(\"Found during optimization\", dict(dict({\"le\": 2, \"la\": 1}), fu = 3), dict(named = dict({\"le\": 2, \"la\": 1})))\n\nprint(\"Floats from constants\", float(\"3.0\"), float(x = 9.0), float())\nprint(\"Found during optimization\", float(float(\"3.2\")), float(x = float(11.0)))\n\nprint(\"Complex from constants\", complex(\"3.0j\"), complex(real = 9.0), complex(imag = 9.0), complex(1,2), complex())\nprint(\"Found during optimization\", complex(float(\"3.2\")), complex(real = float(11.0)), complex(imag = float(11.0)))\n\nprint(\"Strs from constants\", str(\"3.3\"), str(object = 9.1), str())\nprint(\"Found during optimization\", str(float(\"3.3\")), str(object = float(12.0)))\n\nprint(\"Bools from constants\", bool(\"3.3\"), bool(x = 9.1), bool(0), bool())\nprint(\"Found during optimization\", bool(float(\"3.3\")), bool(x = float(0.0)))\n\nprint(\"Ints from constants\", int('3'), int(x = '9'), int('f', 16), int(x = 'e', base = 16), int(\"0101\", base = 2), int(0), int())\nprint(\"Found ints during optimization\", int(int('3')), int(x = int(0.0)))\n\ntry:\n print(\"Longs from constants\", long('3'), long(x = '9'), long('f', 16), long(x = 'e', base = 16), long(\"0101\", base = 2), long(0), long())\n print(\"Found longs during optimization\", long(long('3')), long(x = long(0.0)))\nexcept NameError:\n print(\"Python3 has no long type.\")\n pass\n\n\ntry:\n print(\"Int with only base\", int(base = 2), end = ' ')\nexcept Exception as e:\n print(\"Caused\", repr(e))\nelse:\n print(\"Worked\")\n\ntry:\n print(\"Int with large base\", int(2, 37), end = ' ')\nexcept Exception as e:\n print(\"Caused\", repr(e))\nelse:\n print(\"Worked\")\n\ntry:\n print(\"Long with only base\", int(base = 2), end = ' ')\nexcept Exception as e:\n print(\"Caused\", repr(e))\nelse:\n print(\"Worked\")\n\n\nprint(\"Oct from constants\", oct(467), oct(0))\nprint(\"Found during optimization\", oct(int('3')))\n\nprint(\"Hex from constants\", hex(467), hex(0))\nprint(\"Found during optimization\", hex(int('3')))\n\n\nprint(\"Bin from constants\", bin(467), bin(0))\nprint(\"Found during optimization\", bin(int('3')))\n\ntry:\n int(1,2,3)\nexcept Exception as e:\n print(\"Too many args gave\", repr(e))\n\ntry:\n int(y = 1)\nexcept Exception as e:\n print(\"Wrong arg\", repr(e))\n\nf = 3\nprint(\"Unoptimized call of int\", int('0' * f, base = 16))\n\nd = { 'x' : \"12\", \"base\" : 8 }\nprint(\"Dict star argument call of int\", int(**d))\n\n\nbase = 16\n\ntry:\n value = unicode(\"20\")\nexcept NameError:\n print(\"Python3: Has unicode by default.\")\n value = \"20\"\n\nprint(\"Unoptimized calls of int with unicode args\", int(value, base), int(value))\n\nbase = 37\ntry:\n print(\"Int with large base\", int(2, base), end = ' ')\nexcept Exception as e:\n print(\"Caused\", repr(e))\nelse:\n print(\"Worked\")\n\n\ntry:\n print(chr())\nexcept Exception as e:\n print(\"Disallowed without args\", repr(e))\n\ntry:\n print(ord())\nexcept Exception as e:\n print(\"Disallowed without args\", repr(e))\n\ntry:\n print(ord(s = 1))\nexcept Exception as e:\n print(\"Disallowed keyword args\", repr(e))\n\ntry:\n print(ord(1, 2))\nexcept Exception as e:\n print(\"Too many plain args\", repr(e))\n\ntry:\n print(ord(1, s = 2))\nexcept Exception as e:\n print(\"Too many args, some keywords\", repr(e))\n\ntry:\n print(str('1', offer = 2))\nexcept Exception as e:\n print(\"Too many args, some keywords\", repr(e))\n\n# TODO: This is calls, not really builtins.\na = 2\n\nprint(\"Can optimize the star list argness away\", int(*(a,)), end = ' ')\nprint(\"Can optimize the empty star list arg away\", int(*tuple()), end = ' ')\nprint(\"Can optimize the empty star dict arg away\", int(**dict()))\n\nprint(\"Dict building with keyword arguments\", dict(), dict(a = f))\nprint(\n \"Dictionary entirely from constant args\",\n displayDict(\n dict(q = \"Guido\", w = \"van\", e = \"Rossum\", r = \"invented\", t = \"Python\", y = \"\")\n )\n)\n\na = 5\nprint(\"Instance check recognises\", isinstance(a, int))\n\ntry:\n print(\"Instance check with too many arguments\", isinstance(a, long, int))\nexcept Exception as e:\n print(\"Too many args\", repr(e))\n\ntry:\n print(\"Instance check with too many arguments\", isinstance(a))\nexcept Exception as e:\n print(\"Too few args\", repr(e))\n\n\nusingIterToCheckIterable(1)\n\nprint(\"Nested constant, dict inside a list, referencing a built-in compile time constant\", end = ' ')\nprint([dict(type = int)])\n\nprint(\"nan and -nan sign checks:\")\nfrom math import copysign\nprint(copysign(1.0, float(\"nan\")))\nprint(copysign(1.0, float(\"-nan\")))\n\nprint(\"Using != to detect nan floats:\")\na = float(\"nan\")\nif a != a:\n print(\"is nan\")\nelse:\n print(\"isn't nan\")\n\n\nvalues = [\n b'100',\n b'',\n bytearray(b'100'),\n CustomStr(\"100\"),\n CustomBytes(b'100'),\n CustomByteArray(b'100')\n]\n\nfor x in values:\n try:\n print(\"int\", repr(x), int(x), int(x,2))\n except (TypeError, ValueError) as e:\n print(\"caught\", repr(e))\n\n try:\n print(\"long\", repr(x), long(x), long(x,2))\n except (TypeError, ValueError) as e:\n print(\"caught\", repr(e))\n except NameError:\n print(\"Python3 has no long\")\n\n\nz = range(5)\ntry:\n next(z)\nexcept TypeError as e:\n print(\"caught\", repr(e))\n\ntry:\n open()\nexcept TypeError as e:\n print(\"Open without arguments gives\", repr(e))\n\nprint(\"Type of id values:\", type(id(id)))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def someFunctionWritingLocals():\n x = 1\n r = locals()\n\n # This is without effect on r. It doesn't mention y at all\n y = 2\n\n # This adds z to the locals, but only that.\n r[ 'z' ] = 3\n del x\n\n try:\n z\n except Exception as e:\n print(\"Accessing z writing to locals gives Exception\", e)\n\n return r, y", "metadata": "root.someFunctionWritingLocals", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def someFunctionWritingLocalsContainingExec():\n x = 1\n r = locals()\n\n # This is without effect on r. It doesn't mention y at all\n y = 2\n\n # This adds z to the locals, but only that.\n r[ 'z' ] = 3\n\n try:\n z\n except Exception as e:\n print(\"Accessing z writing to locals in exec function gives Exception\", e)\n\n return r, y\n\n # Note: This exec is dead code, and still changes the behaviour of\n # CPython, because it detects exec during parse already.\n exec(\"\")", "metadata": "root.someFunctionWritingLocalsContainingExec", "header": "['module', '___EOS___']", "index": 37 } ]
[ { "span": "module_locals[\"__file__\"] ", "start_line": 81, "start_column": 0, "end_line": 81, "end_column": 25 }, { "span": "r[ 'z' ] ", "start_line": 27, "start_column": 4, "end_line": 27, "end_column": 12 }, { "span": "r[ 'z' ] ", "start_line": 45, "start_column": 4, "end_line": 45, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Modifica", "tion_", "of_", "dictionary_", "returned_", "by_", "locals_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2016", ",", " ", "Ka", "y", " ", "Ha", "yen", ",", " ", "mail", "to", ":", "ka", "y", ".", "hay", "en", "@", "gma", "il", ".", "com_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "tests", " ", "original", "ly", " ", "created", " ", "or", " ", "extracted", " ", "from", " ", "other", " ", "people", "s", " ", "work", ".", " ", "The", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "part", "s", " ", "wer", "e", " ", "too", " ", "small", " ", "to", " ", "be", " ", "protect", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Test", "ing", " ", "locals", "():", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "some", "Function", "Writ", "ing", "Local", "s_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "some", "Function", "Writ", "ing", "Local", "s", "Contain", "ing", "Exec_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Var", "s", " ", "on", " ", "module", " ", "level", "\"_", ",_", "display", "Dict_", "(_", "vars_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "locals_", "=_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pat", "ch", " ", "awa", "y", " ", "\"\\u\\u", "file", "\\u\\u\"", " ", "path", " ", "in", " ", "a", " ", "hard", " ", "to", " ", "detect", " ", "way", ".", " ", "Thi", "s", " ", "will", " ", "make", " ", "sure", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "repeated", " ", "calls", " ", "to", " ", "locals", " ", "reall", "y", " ", "get", " ", "the", " ", "same", " ", "dictionar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "locals_", "[_", "\"\\u\\u", "file", "\\u\\u\"_", "]_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "module", "\\u", "locals_", "[_", "\"\\u\\u", "file", "\\u\\u\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "module", "\\u", "locals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Us", "e", " ", "of", " ", "locals", " ", "on", " ", "the", " ", "module", " ", "level", "\"_", ",_", "display", "Dict_", "(_", "locals_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Test", "ing", " ", "globals", "():", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "some", "Function", "Us", "ing", "Globals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Test", "ing", " ", "dir", "():", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Modul", "e", " ", "dir", "\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "some", "Function", "Us", "ing", "Dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Maki", "ng", " ", "a", " ", "new", " ", "type", ",", " ", "with", " ", "type", "()", " ", "and", " ", "3", " ", "args", ":\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "class_", "=_", "type_", "(_", "\"", "Name", "\"_", ",_", "(_", "object_", ",_", ")_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "new", "\\u", "class_", ",_", "new", "\\u", "class_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Non", "e", " ", "has", " ", "type", "\"_", ",_", "type_", "(_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Const", "ant", " ", "ranges", "\"_", ",_", "range_", "(_", "2_", ")_", ",_", "range_", "(_", "1_", ",_", "6_", ")_", ",_", "range_", "(_", "3_", ",_", "0_", ",_", "-_", "1_", ")_", ",_", "range_", "(_", "3_", ",_", "8_", ",_", "2_", ")_", ",_", "range_", "(_", "5_", ",_", "-_", "5_", ",_", "-_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Border", " ", "case", "s", "\"_", ",_", "range_", "(_", "0_", ")_", ",_", "range_", "(_", "-_", "1_", ")_", ",_", "range_", "(_", "-_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Corner", " ", "case", " ", "large", " ", "negati", "ve", " ", "value", "\"_", ",_", "range_", "(_", "-_", "2_", "**_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Corner", " ", "case", " ", "with", " ", "large", " ", "start", "/", "end", " ", "values", " ", "in", " ", "small", " ", "range", "\"_", ",_", "range_", "(_", "2_", "**_", "100_", ",_", "2_", "**_", "100_", "+_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Range", " ", "with", " ", "0", " ", "step", " ", "give", "s", ":\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "range_", "(_", "3_", ",_", "8_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Range", " ", "with", " ", "float", ":\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "range_", "(_", "1.0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Give", "s", " ", "exception", ":\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Emp", "ty", " ", "range", " ", "call", "\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "range_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Give", "s", " ", "exception", ":\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "List", " ", "from", " ", "iterable", "\"_", ",_", "list_", "(_", "\"", "abc", "\"_", ")_", ",_", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "List", " ", "from", " ", "sequence", "\"_", ",_", "list_", "(_", "sequence_", "=_", "(_", "0_", ",_", "1_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Tup", "le", " ", "from", " ", "iterable", "\"_", ",_", "tuple_", "(_", "\"", "cda", "\"_", ")_", ",_", "tuple_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Tup", "le", " ", "from", " ", "sequence", "\"_", ",_", "tuple_", "(_", "sequence_", "=_", "(_", "0_", ",_", "1_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Dict", "ionar", "y", " ", "from", " ", "iterable", " ", "and", " ", "keywords", "\"_", ",_", "dict_", "(_", "(_", "\"", "ab", "\"_", ",_", "(_", "1_", ",_", "2_", ")_", ")_", ",_", "f_", "=_", "1_", ",_", "g_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Mor", "e", " ", "constant", " ", "dictionar", "ies", "\"_", ",_", "{_", "\"", "two", "\"_", ":_", "2_", ",_", "\"", "one", "\"_", ":_", "1_", "}_", ",_", "{_", "}_", ",_", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "{_", "\"", "two", "\"_", ":_", "2_", ",_", "\"", "one", "\"_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Varia", "ble", " ", "dictionar", "y", "\"_", ",_", "dict_", "(_", "g_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "dict_", "(_", "dict_", "(_", "{_", "\"", "le", "\"_", ":_", "2_", ",_", "\"", "la", "\"_", ":_", "1_", "}_", ")_", ",_", "fu", "_", "=_", "3_", ")_", ",_", "dict_", "(_", "named_", "=_", "dict_", "(_", "{_", "\"", "le", "\"_", ":_", "2_", ",_", "\"", "la", "\"_", ":_", "1_", "}_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Float", "s", " ", "from", " ", "constant", "s", "\"_", ",_", "float_", "(_", "\"", "3.0", "\"_", ")_", ",_", "float_", "(_", "x_", "=_", "9.0_", ")_", ",_", "float_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "float_", "(_", "float_", "(_", "\"", "3.2", "\"_", ")_", ")_", ",_", "float_", "(_", "x_", "=_", "float_", "(_", "11.0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Comple", "x", " ", "from", " ", "constant", "s", "\"_", ",_", "complex_", "(_", "\"", "3.0", "j", "\"_", ")_", ",_", "complex_", "(_", "real_", "=_", "9.0_", ")_", ",_", "complex_", "(_", "imag_", "=_", "9.0_", ")_", ",_", "complex_", "(_", "1_", ",_", "2_", ")_", ",_", "complex_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "complex_", "(_", "float_", "(_", "\"", "3.2", "\"_", ")_", ")_", ",_", "complex_", "(_", "real_", "=_", "float_", "(_", "11.0_", ")_", ")_", ",_", "complex_", "(_", "imag_", "=_", "float_", "(_", "11.0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Str", "s", " ", "from", " ", "constant", "s", "\"_", ",_", "str_", "(_", "\"", "3.3", "\"_", ")_", ",_", "str_", "(_", "object_", "=_", "9.1", "_", ")_", ",_", "str_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "str_", "(_", "float_", "(_", "\"", "3.3", "\"_", ")_", ")_", ",_", "str_", "(_", "object_", "=_", "float_", "(_", "12.0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Boo", "ls", " ", "from", " ", "constant", "s", "\"_", ",_", "bool_", "(_", "\"", "3.3", "\"_", ")_", ",_", "bool_", "(_", "x_", "=_", "9.1", "_", ")_", ",_", "bool_", "(_", "0_", ")_", ",_", "bool_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "bool_", "(_", "float_", "(_", "\"", "3.3", "\"_", ")_", ")_", ",_", "bool_", "(_", "x_", "=_", "float_", "(_", "0.0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Int", "s", " ", "from", " ", "constant", "s", "\"_", ",_", "int_", "(_", "'", "3", "'_", ")_", ",_", "int_", "(_", "x_", "=_", "'", "9", "'_", ")_", ",_", "int_", "(_", "'", "f", "'_", ",_", "16_", ")_", ",_", "int_", "(_", "x_", "=_", "'", "e", "'_", ",_", "base_", "=_", "16_", ")_", ",_", "int_", "(_", "\"", "0101", "\"_", ",_", "base_", "=_", "2_", ")_", ",_", "int_", "(_", "0_", ")_", ",_", "int_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "ints", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "int_", "(_", "int_", "(_", "'", "3", "'_", ")_", ")_", ",_", "int_", "(_", "x_", "=_", "int_", "(_", "0.0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Long", "s", " ", "from", " ", "constant", "s", "\"_", ",_", "long_", "(_", "'", "3", "'_", ")_", ",_", "long_", "(_", "x_", "=_", "'", "9", "'_", ")_", ",_", "long_", "(_", "'", "f", "'_", ",_", "16_", ")_", ",_", "long_", "(_", "x_", "=_", "'", "e", "'_", ",_", "base_", "=_", "16_", ")_", ",_", "long_", "(_", "\"", "0101", "\"_", ",_", "base_", "=_", "2_", ")_", ",_", "long_", "(_", "0_", ")_", ",_", "long_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "long", "s", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "long_", "(_", "long_", "(_", "'", "3", "'_", ")_", ")_", ",_", "long_", "(_", "x_", "=_", "long_", "(_", "0.0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Pyth", "on", "3", " ", "has", " ", "no", " ", "long", " ", "type", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Int", " ", "with", " ", "only", " ", "base", "\"_", ",_", "int_", "(_", "base_", "=_", "2_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Cause", "d", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Worke", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Int", " ", "with", " ", "large", " ", "base", "\"_", ",_", "int_", "(_", "2_", ",_", "37_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Cause", "d", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Worke", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Long", " ", "with", " ", "only", " ", "base", "\"_", ",_", "int_", "(_", "base_", "=_", "2_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Cause", "d", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Worke", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Oct", " ", "from", " ", "constant", "s", "\"_", ",_", "oct", "_", "(_", "467", "_", ")_", ",_", "oct", "_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "oct", "_", "(_", "int_", "(_", "'", "3", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Hex", " ", "from", " ", "constant", "s", "\"_", ",_", "hex_", "(_", "467", "_", ")_", ",_", "hex_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "hex_", "(_", "int_", "(_", "'", "3", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Bin", " ", "from", " ", "constant", "s", "\"_", ",_", "bin_", "(_", "467", "_", ")_", ",_", "bin_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Foun", "d", " ", "dur", "ing", " ", "optimization", "\"_", ",_", "bin_", "(_", "int_", "(_", "'", "3", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "int_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "many", " ", "args", " ", "ga", "ve", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "int_", "(_", "y_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Wro", "ng", " ", "arg", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Uno", "pti", "mi", "zed", " ", "call", " ", "of", " ", "int", "\"_", ",_", "int_", "(_", "'", "0", "'_", "*_", "f_", ",_", "base_", "=_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "{_", "'", "x", "'_", ":_", "\"", "1", "2", "\"_", ",_", "\"", "base", "\"_", ":_", "8_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Dict", " ", "star", " ", "argu", "ment", " ", "call", " ", "of", " ", "int", "\"_", ",_", "int_", "(_", "**_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "unicode_", "(_", "\"", "20", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Pyth", "on", "3", ":", " ", "Has", " ", "unicode", " ", "by", " ", "default", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "\"", "20", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Uno", "pti", "mi", "zed", " ", "calls", " ", "of", " ", "int", " ", "with", " ", "unicode", " ", "args", "\"_", ",_", "int_", "(_", "value_", ",_", "base_", ")_", ",_", "int_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "37_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Int", " ", "with", " ", "large", " ", "base", "\"_", ",_", "int_", "(_", "2_", ",_", "base_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Cause", "d", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Worke", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "chr_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Disa", "llow", "ed", " ", "with", "out", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "ord_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Disa", "llow", "ed", " ", "with", "out", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "ord_", "(_", "s_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Disa", "llow", "ed", " ", "keyw", "ord", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "ord_", "(_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "many", " ", "plain", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "ord_", "(_", "1_", ",_", "s_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "many", " ", "args", ",", " ", "some", " ", "keywords", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "str_", "(_", "'", "1", "'_", ",_", "offer_", "=_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "many", " ", "args", ",", " ", "some", " ", "keywords", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Thi", "s", " ", "is", " ", "calls", ",", " ", "not", " ", "reall", "y", " ", "bui", "lti", "ns", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "a_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Can", " ", "optimize", " ", "the", " ", "star", " ", "list", " ", "arg", "ness", " ", "awa", "y", "\"_", ",_", "int_", "(_", "*_", "(_", "a_", ",_", ")_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Can", " ", "optimize", " ", "the", " ", "empty", " ", "star", " ", "list", " ", "arg", " ", "awa", "y", "\"_", ",_", "int_", "(_", "*_", "tuple_", "(_", ")_", ")_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Can", " ", "optimize", " ", "the", " ", "empty", " ", "star", " ", "dict", " ", "arg", " ", "awa", "y", "\"_", ",_", "int_", "(_", "**_", "dict_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Dict", " ", "buildi", "ng", " ", "with", " ", "keyw", "ord", " ", "argu", "ment", "s", "\"_", ",_", "dict_", "(_", ")_", ",_", "dict_", "(_", "a_", "=_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dict", "ionar", "y", " ", "entire", "ly", " ", "from", " ", "constant", " ", "args", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "display", "Dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "q_", "=_", "\"", "Guid", "o", "\"_", ",_", "w_", "=_", "\"", "van", "\"_", ",_", "e_", "=_", "\"", "Ros", "sum", "\"_", ",_", "r_", "=_", "\"", "inven", "ted", "\"_", ",_", "t_", "=_", "\"", "Pyth", "on", "\"_", ",_", "y_", "=_", "\"\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "a_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Insta", "nce", " ", "check", " ", "recog", "nis", "es", "\"_", ",_", "isinstance_", "(_", "a_", ",_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Insta", "nce", " ", "check", " ", "with", " ", "too", " ", "many", " ", "argu", "ment", "s", "\"_", ",_", "isinstance_", "(_", "a_", ",_", "long_", ",_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "many", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Insta", "nce", " ", "check", " ", "with", " ", "too", " ", "many", " ", "argu", "ment", "s", "\"_", ",_", "isinstance_", "(_", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Too", " ", "few", " ", "args", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "usi", "ng", "It", "er", "To", "Check", "Iterable_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Nest", "ed", " ", "constant", ",", " ", "dict", " ", "insi", "de", " ", "a", " ", "list", ",", " ", "referenci", "ng", " ", "a", " ", "bui", "lt", "-", "in", " ", "compile", " ", "time", " ", "constant", "\"_", ",_", "end_", "=_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "[_", "dict_", "(_", "type_", "=_", "int_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "nan", " ", "and", " ", "-", "nan", " ", "sign", " ", "checks", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "copy", "sign_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "copy", "sign_", "(_", "1.0_", ",_", "float_", "(_", "\"", "nan", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "copy", "sign_", "(_", "1.0_", ",_", "float_", "(_", "\"-", "nan", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Us", "ing", " ", "!=", " ", "to", " ", "detect", " ", "nan", " ", "float", "s", ":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "float_", "(_", "\"", "nan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "a_", "!=_", "a_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "is", " ", "nan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "isn", "'", "t", " ", "nan", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "values_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "b", "'", "100", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "b", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bytearray_", "(_", "b", "'", "100", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Custom", "Str_", "(_", "\"", "100", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Custom", "Bytes_", "(_", "b", "'", "100", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Custom", "Byte", "Array_", "(_", "b", "'", "100", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "int", "\"_", ",_", "repr_", "(_", "x_", ")_", ",_", "int_", "(_", "x_", ")_", ",_", "int_", "(_", "x_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "cau", "ght", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "long", "\"_", ",_", "repr_", "(_", "x_", ")_", ",_", "long_", "(_", "x_", ")_", ",_", "long_", "(_", "x_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "cau", "ght", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Pyth", "on", "3", " ", "has", " ", "no", " ", "long", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "z_", "=_", "range_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next_", "(_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "cau", "ght", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "open_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Open", " ", "with", "out", " ", "argu", "ment", "s", " ", "give", "s", "\"_", ",_", "repr_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "\"", "Type", " ", "of", " ", "id", " ", "values", ":\"_", ",_", "type_", "(_", "id_", "(_", "id_", ")_", ")_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "some", "Function", "Writ", "ing", "Local", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "with", "out", " ", "effect", " ", "on", " ", "r", ".", " ", "It", " ", "doe", "sn", "'", "t", " ", "menti", "on", " ", "y", " ", "at", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "adds", " ", "z", " ", "to", " ", "the", " ", "locals", ",", " ", "but", " ", "only", " ", "tha", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "r_", "[_", "'", "z", "'_", "]_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "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 ", " _", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Access", "ing", " ", "z", " ", "writ", "ing", " ", "to", " ", "locals", " ", "give", "s", " ", "Except", "ion", "\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "r_", ",_", "y_", "\\u\\u\\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_", "some", "Function", "Writ", "ing", "Local", "s", "Contain", "ing", "Exec_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "with", "out", " ", "effect", " ", "on", " ", "r", ".", " ", "It", " ", "doe", "sn", "'", "t", " ", "menti", "on", " ", "y", " ", "at", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "y_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "adds", " ", "z", " ", "to", " ", "the", " ", "locals", ",", " ", "but", " ", "only", " ", "tha", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "r_", "[_", "'", "z", "'_", "]_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Access", "ing", " ", "z", " ", "writ", "ing", " ", "to", " ", "locals", " ", "in", " ", "exec", " ", "function", " ", "give", "s", " ", "Except", "ion", "\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "r_", ",_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Thi", "s", " ", "exec", " ", "is", " ", "dead", " ", "code", ",", " ", "and", " ", "still", " ", "change", "s", " ", "the", " ", "behaviour", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CP", "yth", "on", ",", " ", "bec", "aus", "e", " ", "it", " ", "detect", "s", " ", "exec", " ", "dur", "ing", " ", "parse", " ", "alr", "ead", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "exec_", "(_", "\"\"_", ")_", "\\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, 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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 ]
Except block handles 'BaseException'
wal-e/wal-e/wal_e/pipebuf.py
[ { "content": "def _configure_buffer_sizes():\n \"\"\"Set up module globals controlling buffer sizes\"\"\"\n global PIPE_BUF_BYTES\n global OS_PIPE_SZ\n\n PIPE_BUF_BYTES = 65536\n OS_PIPE_SZ = None\n\n # Teach the 'fcntl' module about 'F_SETPIPE_SZ', which is a Linux-ism,\n # but a good one that can drastically reduce the number of syscalls\n # when dealing with high-throughput pipes.\n if not hasattr(fcntl, 'F_SETPIPE_SZ'):\n import platform\n\n if platform.system() == 'Linux':\n fcntl.F_SETPIPE_SZ = 1031\n\n # If Linux procfs (or something that looks like it) exposes its\n # maximum F_SETPIPE_SZ, adjust the default buffer sizes.\n try:\n with open('/proc/sys/fs/pipe-max-size', 'r') as f:\n # Figure out OS pipe size, but in case it is unusually large\n # or small restrain it to sensible values.\n OS_PIPE_SZ = min(int(f.read()), 1024 * 1024)\n PIPE_BUF_BYTES = max(OS_PIPE_SZ, PIPE_BUF_BYTES)\n except:\n pass", "metadata": "root._configure_buffer_sizes", "header": "['module', '___EOS___']", "index": 17 } ]
[ { "span": "except:", "start_line": 42, "start_column": 4, "end_line": 42, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "configur", "e\\u", "buffer", "\\u", "sizes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "up", " ", "module", " ", "globals", " ", "controll", "ing", " ", "buffer", " ", "size", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "PIPE", "\\u", "BUF", "\\u", "BYTES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "OS", "\\u", "PIPE", "\\u", "SZ", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PIPE", "\\u", "BUF", "\\u", "BYTES_", "=_", "65536_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OS", "\\u", "PIPE", "\\u", "SZ", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tea", "ch", " ", "the", " ", "'", "fcn", "tl", "'", " ", "module", " ", "abo", "ut", " ", "'", "F", "\\u", "SET", "PIPE", "\\u", "SZ", "',", " ", "whi", "ch", " ", "is", " ", "a", " ", "Lin", "ux", "-", "ism", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "a", " ", "good", " ", "one", " ", "tha", "t", " ", "can", " ", "dra", "stic", "ally", " ", "reduce", " ", "the", " ", "number", " ", "of", " ", "syscall", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "deal", "ing", " ", "with", " ", "high", "-", "throughput", " ", "pipe", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "fcntl_", ",_", "'", "F", "\\u", "SET", "PIPE", "\\u", "SZ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Lin", "ux", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fcntl_", "._", "F", "\\u", "SET", "PIPE", "\\u", "SZ", "_", "=_", "103", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "Lin", "ux", " ", "proc", "fs", " ", "(", "or", " ", "somet", "hing", " ", "tha", "t", " ", "look", "s", " ", "like", " ", "it", ")", " ", "expos", "es", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "maxim", "um", " ", "F", "\\u", "SET", "PIPE", "\\u", "SZ", ",", " ", "adjust", " ", "the", " ", "default", " ", "buffer", " ", "size", "s", "._", "\\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 ", " _", "with_", "open_", "(_", "'/", "proc", "/", "sys", "/", "fs", "/", "pipe", "-", "max", "-", "size", "'_", ",_", "'", "r", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fig", "ure", " ", "out", " ", "OS", " ", "pipe", " ", "size", ",", " ", "but", " ", "in", " ", "case", " ", "it", " ", "is", " ", "unu", "sua", "ll", "y", " ", "large_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "small", " ", "restrain", " ", "it", " ", "to", " ", "sensi", "ble", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "OS", "\\u", "PIPE", "\\u", "SZ", "_", "=_", "min_", "(_", "int_", "(_", "f_", "._", "read_", "(_", ")_", ")_", ",_", "1024_", "*_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PIPE", "\\u", "BUF", "\\u", "BYTES_", "=_", "max_", "(_", "OS", "\\u", "PIPE", "\\u", "SZ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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, 0, 1, 1, 1, 2, 2, 2, 2, 2 ]
Testing equality to None
sightmachine/SimpleCV/SimpleCV/examples/detection/FeatureDetection.py
[ { "content": "#!/usr/bin/python\n'''\nThis program is used to find keypoint features in an image.\n\nYou need to click the upper left hand corner of what you want to train,\nthen click the right lower corner of what you want to train.\n\nThis will give you a template. For instance if you wanted to train\na face to recognize in the image you would click on the upper left corner\nof the face, then click in the lower right corner of the face. If you\nwant to retrain then just right click to reset.\n\n'''\n\nprint __doc__\n\nimport time\nfrom SimpleCV import Color, Image, np, Camera\nfrom SimpleCV.Display import Display\ncam = Camera()\ndisplay = Display((640,480)) # create our display\n\nquality = 400.00\nminDist = 0.35\nminMatch = 0.2\ntemplate_img = None\nmode = \"untrained\"\nstartX = None\nstartY = None\nendY = None\nendX = None\n\nwhile( display.isNotDone() ):\n img = cam.getImage().resize(640,480)\n\n #Display this if a template has not been trained yet\n if mode == \"untrained\":\n if startX == None or startY == None:\n img.dl().text(\"Click the upper left corner to train\", (10,10))\n if display.mouseLeft:\n startX = display.mouseRawX\n startY = display.mouseRawY\n time.sleep(0.2)\n elif endX == None or endY == None:\n img.dl().text(\"now click the lower right corner to train\", (10,10))\n if display.mouseLeft:\n endX = display.mouseX\n endY = display.mouseY\n template_img = img.crop(startX,startY,endX - startX, endY - startY)\n mode = \"trained\"\n time.sleep(0.2)\n else:\n pass\n\n if mode == \"trained\":\n keypoints = img.findKeypointMatch(template_img,quality,minDist,minMatch)\n if keypoints:\n #keypoints.draw()\n img = img.applyLayers()\n img = img.drawKeypointMatches(template_img) # draw the keypoint layers\n\n #Reset\n if display.mouseRight:\n template_img = None\n mode = \"untrained\"\n startX = None\n startY = None\n endY = None\n endX = None\n\n img = img.applyLayers() # apply the layers before resize\n img = img.resize(640,480)\n img.save(display)\n time.sleep(0.05)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "startX == None ", "start_line": 37, "start_column": 11, "end_line": 37, "end_column": 25 }, { "span": "startY == None:", "start_line": 37, "start_column": 29, "end_line": 37, "end_column": 43 }, { "span": "endX == None ", "start_line": 43, "start_column": 13, "end_line": 43, "end_column": 25 }, { "span": "endY == None:", "start_line": 43, "start_column": 29, "end_line": 43, "end_column": 41 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Thi", "s", " ", "program", " ", "is", " ", "used", " ", "to", " ", "find", " ", "keypoint", " ", "features", " ", "in", " ", "an", " ", "image", ".", "\\", "10", ";", "\\", "10", ";", "You", " ", "need", " ", "to", " ", "click", " ", "the", " ", "upper", " ", "left", " ", "hand", " ", "corn", "er", " ", "of", " ", "what", " ", "you", " ", "want", " ", "to", " ", "train", ",", "\\", "10", ";", "then", " ", "click", " ", "the", " ", "right", " ", "lower", " ", "corn", "er", " ", "of", " ", "what", " ", "you", " ", "want", " ", "to", " ", "train", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "will", " ", "give", " ", "you", " ", "a", " ", "template", ".", " ", " ", "For", " ", "instance", " ", "if", " ", "you", " ", "want", "ed", " ", "to", " ", "train", "\\", "10", ";", "a", " ", "face", " ", "to", " ", "recognize", " ", "in", " ", "the", " ", "image", " ", "you", " ", "wou", "ld", " ", "click", " ", "on", " ", "the", " ", "upper", " ", "left", " ", "corn", "er", "\\", "10", ";", "of", " ", "the", " ", "face", ",", " ", "then", " ", "click", " ", "in", " ", "the", " ", "lower", " ", "right", " ", "corn", "er", " ", "of", " ", "the", " ", "face", ".", " ", " ", "If", " ", "you", "\\", "10", ";", "want", " ", "to", " ", "retra", "in", " ", "then", " ", "just", " ", "right", " ", "click", " ", "to", " ", "reset", ".", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Simple", "CV_", "import_", "Color_", ",_", "Image_", ",_", "np_", ",_", "Camera_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Simple", "CV_", "._", "Display_", "import_", "Display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cam_", "=_", "Camera_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display_", "=_", "Display_", "(_", "(_", "640_", ",_", "480_", ")_", ")_", "#", " ", "create", " ", "our", " ", "display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quality_", "=_", "400", ".00", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "Dist_", "=_", "0.35_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "Match_", "=_", "0.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "img_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "=_", "\"", "untr", "aine", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "X_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Y_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Y_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "X_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "display_", "._", "is", "Not", "Done_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "=_", "cam_", "._", "get", "Image_", "(_", ")_", "._", "resize_", "(_", "640_", ",_", "480_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Display", " ", "this", " ", "if", " ", "a", " ", "template", " ", "has", " ", "not", " ", "bee", "n", " ", "trained", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mode_", "==_", "\"", "untr", "aine", "d", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "start", "X_", "==_", "None_", "or_", "start", "Y_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "._", "dl_", "(_", ")_", "._", "text_", "(_", "\"", "Click", " ", "the", " ", "upper", " ", "left", " ", "corn", "er", " ", "to", " ", "train", "\"_", ",_", "(_", "10_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "display_", "._", "mouse", "Left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "X_", "=_", "display_", "._", "mouse", "Ra", "w", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Y_", "=_", "display_", "._", "mouse", "Ra", "w", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "end", "X_", "==_", "None_", "or_", "end", "Y_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "._", "dl_", "(_", ")_", "._", "text_", "(_", "\"", "now", " ", "click", " ", "the", " ", "lower", " ", "right", " ", "corn", "er", " ", "to", " ", "train", "\"_", ",_", "(_", "10_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "display_", "._", "mouse", "Left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "X_", "=_", "display_", "._", "mouse", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Y_", "=_", "display_", "._", "mouse", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "img_", "=_", "img_", "._", "crop_", "(_", "start", "X_", ",_", "start", "Y_", ",_", "end", "X_", "-_", "start", "X_", ",_", "end", "Y_", "-_", "start", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "=_", "\"", "trained", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.2_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mode_", "==_", "\"", "trained", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keypoints_", "=_", "img_", "._", "find", "Keyp", "oint", "Match_", "(_", "template", "\\u", "img_", ",_", "quality_", ",_", "min", "Dist_", ",_", "min", "Match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "keypoints_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "keypoint", "s", ".", "draw", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "=_", "img_", "._", "appl", "y", "Layers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "img_", "=_", "img_", "._", "draw", "Keyp", "oint", "Matches_", "(_", "template", "\\u", "img_", ")_", "#", " ", "draw", " ", "the", " ", "keypoint", " ", "layers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Reset_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "display_", "._", "mouse", "Right_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "img_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "=_", "\"", "untr", "aine", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "X_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Y_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Y_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "X_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "img_", "=_", "img_", "._", "appl", "y", "Layers_", "(_", ")_", "#", " ", "appl", "y", " ", "the", " ", "layer", "s", " ", "bef", "ore", " ", "resize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "img_", "._", "resize_", "(_", "640_", ",_", "480_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "._", "save_", "(_", "display_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
msanders/cider/cider/core.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, print_function, unicode_literals\nfrom . import _osx as osx\nfrom . import _tty as tty\nfrom .exceptions import (\n UnsupportedOSError, XcodeMissingError, BrewMissingError,\n SymlinkError, AppMissingError, StowError\n)\nfrom ._lib import lazyproperty\nfrom ._sh import (\n Brew, Defaults, spawn, collapseuser, commonpath, curl, mkdir_p,\n read_config, write_config, modify_config, isdirname, prompt\n)\nfrom fnmatch import fnmatch\nfrom glob import iglob\nfrom rfc3987 import parse as urlparse\nfrom tempfile import mkdtemp\nimport click\nimport errno\nimport json\nimport os\nimport platform\nimport re\nimport shutil\nimport subprocess\nimport sys\n\n_DEFAULTS_TRUE_RE = re.compile(r\"\\b(Y(ES)?|TRUE)\\b\", re.I)\n_DEFAULTS_FALSE_RE = re.compile(r\"\\b(N(O)?|FALSE)\\b\", re.I)\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Cider(object):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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.Cider", "header": "['module', '___EOS___']", "index": 31 }, { "content": " def __init__(self, cask=None, debug=None, verbose=None, cider_dir=None,\n support_dir=None):\n self.cask = cask if cask is not None else False\n self.debug = debug if debug is not None else False\n self.verbose = verbose if verbose is not None else False\n self.cider_dir = cider_dir if cider_dir is not None else \\\n self.fallback_cider_dir()\n self.support_dir = support_dir if support_dir is not None else \\\n self.fallback_support_dir()\n self.brew = Brew(cask, debug, verbose, self.env)\n self.defaults = Defaults(debug, self.env)", "metadata": "root.Cider.__init__", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 32 }, { "content": " @lazyproperty\n def symlink_dir(self):\n return os.path.join(self.cider_dir, \"symlinks\")", "metadata": "root.Cider.symlink_dir", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 44 }, { "content": " @lazyproperty\n def bootstrap_file(self):\n legacy_path = os.path.join(self.cider_dir, \"bootstrap.json\")\n if os.path.isfile(legacy_path):\n return legacy_path\n return os.path.join(self.cider_dir, \"bootstrap.yaml\")", "metadata": "root.Cider.bootstrap_file", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 48 }, { "content": " @lazyproperty\n def defaults_file(self):\n legacy_path = os.path.join(self.cider_dir, \"defaults.json\")\n if os.path.isfile(legacy_path):\n return legacy_path\n return os.path.join(self.cider_dir, \"defaults.yaml\")", "metadata": "root.Cider.defaults_file", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 55 }, { "content": " @lazyproperty\n def env(self):\n env = os.environ.copy()\n env.update(self.read_bootstrap().get(\"env\", {}))\n return env", "metadata": "root.Cider.env", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 62 }, { "content": " def fallback_cider_dir(self):\n try:\n return os.path.join(os.environ[\"XDG_CONFIG_HOME\"], \"cider\")\n except KeyError:\n return os.path.join(os.path.expanduser(\"~\"), \".cider\")", "metadata": "root.Cider.fallback_cider_dir", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 68 }, { "content": " def fallback_support_dir(self):\n try:\n return os.path.join(os.environ[\"XDG_DATA_HOME\"], \"cider\")\n except KeyError:\n return os.path.join(\n os.path.expanduser(\"~\"),\n \"Library\",\n \"Application Support\",\n \"com.msanders.cider\"\n )", "metadata": "root.Cider.fallback_support_dir", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 74 }, { "content": " @lazyproperty\n def symlink_targets_file(self):\n return os.path.join(self.support_dir, \"symlink_targets.json\")", "metadata": "root.Cider.symlink_targets_file", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 85 }, { "content": " def read_bootstrap(self):\n return read_config(self.bootstrap_file, {})", "metadata": "root.Cider.read_bootstrap", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 89 }, { "content": " def read_defaults(self):\n return read_config(self.defaults_file, {})", "metadata": "root.Cider.read_defaults", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 92 }, { "content": " def _check_cider_dir(self):\n if not os.path.isdir(self.cider_dir):\n os.mkdir(self.cider_dir)\n print(tty.progress(\"Created cider dir at {0}\".format(\n self.cider_dir\n )))", "metadata": "root.Cider._check_cider_dir", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 95 }, { "content": " def _modify_bootstrap(self, key, transform=None, fallback=None):\n if transform is None:\n transform = lambda x: x # pep8: noqa\n\n if fallback is None:\n fallback = []\n\n def outer_transform(bootstrap):\n bootstrap[key] = transform(bootstrap.get(key, fallback))\n if isinstance(bootstrap[key], list):\n bootstrap[key] = sorted(bootstrap[key])\n return bootstrap\n\n self._check_cider_dir()\n return modify_config(self.bootstrap_file, outer_transform)", "metadata": "root.Cider._modify_bootstrap", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 102 }, { "content": " def _modify_defaults(self, domain, transform):\n def outer_transform(defaults):\n defaults[domain] = transform(defaults.get(domain, {}))\n return defaults\n\n self._check_cider_dir()\n return modify_config(self.defaults_file, outer_transform)", "metadata": "root.Cider._modify_defaults", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 118 }, { "content": " def _cached_targets(self):\n return read_config(self.symlink_targets_file, [])", "metadata": "root.Cider._cached_targets", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 126 }, { "content": " def _update_target_cache(self, new_targets):\n self._check_cider_dir()\n mkdir_p(os.path.dirname(self.symlink_targets_file))\n write_config(self.symlink_targets_file, sorted(new_targets))", "metadata": "root.Cider._update_target_cache", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 129 }, { "content": " def _remove_dead_targets(self, targets):\n for target in targets:\n if os.path.islink(target) and os.path.samefile(\n self.cider_dir,\n commonpath([\n self.cider_dir,\n os.path.realpath(target)\n ]),\n ):\n os.remove(target)\n print(tty.progress(\"Removed dead symlink: {0}\".format(\n collapseuser(target))\n ))", "metadata": "root.Cider._remove_dead_targets", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 134 }, { "content": " @staticmethod\n def _remove_link_target(source, target):\n if os.path.exists(target):\n if os.path.samefile(os.path.realpath(target),\n os.path.realpath(source)):\n os.remove(target)\n else:\n raise SymlinkError(\n \"{0} symlink target already exists at: {1}\".format(\n collapseuser(source), collapseuser(target)\n )\n )", "metadata": "root.Cider._remove_link_target", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 148 }, { "content": " def _has_xcode_tools(self):\n developer_dir = spawn([\"/usr/bin/xcode-select\", \"-print-path\"],\n check_output=True,\n debug=self.debug,\n env=self.env).strip()\n\n return bool(os.path.isdir(developer_dir) and os.path.exists(\n os.path.join(developer_dir, \"usr\", \"bin\", \"git\")\n ))", "metadata": "root.Cider._has_xcode_tools", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 161 }, { "content": " def _assert_requirements(self):\n macos_version = platform.mac_ver()[0]\n\n if int(macos_version.split(\".\")[1]) < 9:\n raise UnsupportedOSError(\n \"Unsupported OS version; please upgrade to 10.9 or later \"\n \"and try again.\",\n macos_version\n )\n\n if not self._has_xcode_tools():\n print(tty.progress(\"Installing the Command Line Tools (expect a \"\n \"GUI popup):\"))\n spawn([\"/usr/bin/xcode-select\", \"--install\"],\n debug=self.debug, env=self.env)\n click.pause(\"Press any key when the installation is complete.\")\n if not self._has_xcode_tools():\n raise XcodeMissingError(\n \"Aborted Command Line Tools installation.\",\n )\n\n if spawn([\"which\", \"brew\"], check_call=False, debug=self.debug,\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE,\n env=self.env):\n raise BrewMissingError(\n \"Homebrew not installed\",\n \"http://brew.sh/#install\"\n )", "metadata": "root.Cider._assert_requirements", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 171 }, { "content": " @staticmethod\n def _islinkkey(symlink, stow):\n return symlink == stow or symlink.startswith(os.path.join(stow, \"\"))", "metadata": "root.Cider._islinkkey", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 201 }, { "content": " def restore(self, ignore_errors=None):\n ignore_errors = ignore_errors if ignore_errors is not None else False\n self._assert_requirements()\n caskbrew = Brew(True, self.debug, self.verbose)\n homebrew = Brew(False, self.debug, self.verbose)\n\n bootstrap = self.read_bootstrap()\n casks = bootstrap.get(\"casks\", [])\n dependencies = bootstrap.get(\"dependencies\", {})\n\n self.run_scripts(before=True)\n\n for tap in bootstrap.get(\"taps\", []):\n homebrew.tap(tap)\n\n outdated = homebrew.outdated()\n\n for formula in bootstrap.get(\"formulas\", []):\n if formula in dependencies:\n deps = dependencies[formula]\n deps = deps if isinstance(deps, list) else [deps]\n\n # Currently only cask dependencies are supported.\n deps = (dep for dep in deps if dep.startswith(\"casks/\"))\n\n for dep in deps:\n cask = dep.split(\"/\")[1]\n print(tty.progress(\n \"Installing {0} dependency for {1}\").format(\n cask, formula\n )\n )\n\n caskbrew.safe_install(cask, ignore_errors)\n del casks[casks.index(cask)]\n\n homebrew.safe_install(formula, ignore_errors, formula in outdated)\n\n for cask in casks:\n caskbrew.safe_install(cask, ignore_errors)\n\n self.relink()\n self.apply_defaults()\n self.apply_icons()\n self.run_scripts(after=True)", "metadata": "root.Cider.restore", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 205 }, { "content": " def install(self, *formulas, **kwargs):\n formulas = list(formulas) or []\n force = kwargs.get(\"force\", False)\n\n self.brew.install(*formulas, force=force)\n self.add_to_bootstrap(formulas)", "metadata": "root.Cider.install", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 251 }, { "content": " def add_to_bootstrap(self, formulas):\n # Avoid pylint scoping warning W0640\n def transform(formula):\n return lambda x: x + [formula] if formula not in x else x\n\n for formula in formulas:\n if self._modify_bootstrap(\n \"casks\" if self.cask else \"formulas\",\n transform=transform(formula),\n fallback=[]\n ):\n tty.puts(\"Added {0} to bootstrap\".format(formula))\n else:\n tty.puterr(\"{0} already bootstrapped; skipping install\".format(\n formula\n ), warning=True)", "metadata": "root.Cider.add_to_bootstrap", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 258 }, { "content": " def rm(self, *formulas):\n def transform(formula):\n return lambda xs: [x for x in xs if x != formula]\n\n formulas = list(formulas) or []\n self.brew.rm(*formulas)\n\n for formula in formulas:\n if self._modify_bootstrap(\n \"casks\" if self.cask else \"formulas\",\n transform=transform(formula),\n fallback=[]\n ):\n tty.puts(\"Removed {0} from bootstrap\".format(formula))\n else:\n tty.puterr(\"{0} not found in bootstrap\".format(formula))", "metadata": "root.Cider.rm", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 275 }, { "content": " def tap(self, tap):\n if tap is None:\n tapped = self.tapped()\n if tapped:\n print(\"\\n\".join(tapped))\n else:\n self.brew.tap(tap)\n self.add_taps([tap])", "metadata": "root.Cider.tap", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 292 }, { "content": " def add_taps(self, taps):\n def transform(tap):\n return lambda x: x + [tap] if tap not in x else x\n\n for tap in taps:\n if self._modify_bootstrap(\n \"taps\",\n transform=transform(tap),\n fallback=[]\n ):\n tty.puts(\"Added {0} tap to bootstrap\".format(tap))\n else:\n tty.puterr(\"{0} tap already bootstrapped\".format(tap))", "metadata": "root.Cider.add_taps", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 301 }, { "content": " def untap(self, tap):\n self.brew.untap(tap)\n if self._modify_bootstrap(\n \"taps\",\n transform=lambda xs: [x for x in xs if x != tap],\n fallback=[]\n ):\n tty.puts(\"Removed {0} tap from bootstrap\".format(tap))\n else:\n tty.puterr(\"{0} tap not found in bootstrapped\".format(tap))", "metadata": "root.Cider.untap", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 315 }, { "content": " @staticmethod\n def expandtarget(source, target):\n expanded = os.path.expanduser(target)\n if isdirname(target):\n return os.path.join(expanded, os.path.basename(source))\n return expanded", "metadata": "root.Cider.expandtarget", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 326 }, { "content": " def expandtargets(self, source_glob, target):\n if not isdirname(target) and (\"*\" in source_glob or\n \"?\" in source_glob):\n raise SymlinkError(\n \"Invalid symlink: {0} => {1} (did you mean to add a \"\n \"trailing '/'?)\".format(source_glob, target)\n )\n\n mkdir_p(os.path.dirname(os.path.expanduser(target)))\n sources = iglob(os.path.join(self.symlink_dir, source_glob))\n expanded = []\n for source in sources:\n source = os.path.join(self.cider_dir, source)\n source_target = self.expandtarget(source, target)\n\n expanded.append((source, source_target))\n return expanded", "metadata": "root.Cider.expandtargets", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 333 }, { "content": " def relink(self, force=None):\n force = force if force is not None else False\n symlinks = self.read_bootstrap().get(\"symlinks\", {})\n old_targets = self._cached_targets()\n new_targets = []\n\n for source_glob, target in symlinks.items():\n for source, expanded_target in self.expandtargets(source_glob,\n target):\n if self.mklink(source, expanded_target, force):\n new_targets.append(expanded_target)\n\n self._remove_dead_targets(set(old_targets) - set(new_targets))\n self._update_target_cache(new_targets)\n return new_targets", "metadata": "root.Cider.relink", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 351 }, { "content": " def mklink(self, source, target, force=None):\n linked = False\n\n if not os.path.exists(source):\n raise SymlinkError(\n \"symlink source \\\"{0}\\\" does not exist\".format(\n collapseuser(source)\n )\n )\n\n try:\n os.symlink(source, target)\n linked = True\n tty.puts(\"symlinked {0} -> {1}\".format(\n tty.color(collapseuser(target), tty.MAGENTA),\n collapseuser(source)\n ))\n except OSError as e:\n if e.errno != errno.EEXIST:\n raise\n\n if os.path.islink(target):\n if os.path.samefile(\n os.path.realpath(target),\n os.path.realpath(source)\n ):\n linked = True\n tty.putdebug(\"Already linked: {0} -> {1}\".format(\n tty.color(collapseuser(target), tty.MAGENTA),\n collapseuser(source)\n ), self.debug)\n else:\n fmt = \"Linked to wrong target: {0} -> {1} (instead of {2})\"\n tty.puterr(fmt.format(\n tty.color(target, tty.MAGENTA),\n os.path.realpath(collapseuser(target)),\n os.path.realpath(collapseuser(source))\n ), warning=force)\n else:\n tty.puterr(\"{0} symlink target already exists at: {1}\".format(\n collapseuser(source),\n collapseuser(target)\n ), warning=force)\n\n if not linked and force:\n try:\n osx.move_to_trash(target)\n print(tty.progress(\"Moved {0} to trash\").format(target))\n except OSError as e:\n tty.puterr(\"Error moving {0} to trash: {1}\".format(\n target, str(e))\n )\n return False\n return self.mklink(source, target, force)\n\n return linked", "metadata": "root.Cider.mklink", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 367 }, { "content": " def installed(self, prefix=None):\n bootstrap = self.read_bootstrap()\n key = \"casks\" if self.cask else \"formulas\"\n formulas = bootstrap.get(key, [])\n if prefix:\n return [x for x in formulas if x.startswith(prefix)]\n return formulas", "metadata": "root.Cider.installed", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 424 }, { "content": " def tapped(self):\n return self.read_bootstrap().get(\"taps\", [])", "metadata": "root.Cider.tapped", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 432 }, { "content": " def missing(self):\n installed = [item.split()[0].strip() for item in self.installed()]\n brewed = self.brew.ls()\n\n def brew_orphan(formula):\n # Temporary workaround to avoid bug with brew-pip.\n # https://github.com/msanders/cider/issues/25\n if formula.startswith(\"pip-\"):\n return False\n uses = self.brew.uses(formula)\n return len(set(installed) & set(uses)) == 0\n\n return sorted(filter(brew_orphan, set(brewed) - set(installed)))", "metadata": "root.Cider.missing", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 435 }, { "content": " def missing_taps(self):\n bootstrapped = self.tapped()\n brewed = self.brew.tap().strip().splitlines()\n return sorted(set(brewed) - set(bootstrapped))", "metadata": "root.Cider.missing_taps", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 449 }, { "content": " def ls(self, formula):\n formulas = self.installed(formula)\n if formulas:\n print(\"\\n\".join(formulas))\n else:\n tty.puterr(\"nothing to list\", prefix=\"Error\")", "metadata": "root.Cider.ls", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 454 }, { "content": " def list_missing(self):\n missing_items = self.missing()\n if missing_items:\n suffix = \"s\" if len(missing_items) != 1 else \"\"\n fmt = \"{0} missing formula{1} (tip: try `brew uses \" + \\\n \"--installed` to see what's using it)\"\n tty.puterr(fmt.format(len(missing_items), suffix), warning=True)\n print(\"\\n\".join(missing_items) + \"\\n\")\n\n if prompt(\"Add to bootstrap? [y/N] \"):\n self.add_to_bootstrap(missing_items)\n else:\n print(\"Everything up to date.\")", "metadata": "root.Cider.list_missing", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 461 }, { "content": " def list_missing_taps(self):\n missing_taps = self.missing_taps()\n if missing_taps:\n suffix = \"s\" if len(missing_taps) != 1 else \"\"\n fmt = \"{0} missing tap{1}\"\n tty.puterr(fmt.format(len(missing_taps), suffix), warning=True)\n print(\"\\n\".join(missing_taps) + \"\\n\")\n\n if prompt(\"Add to bootstrap? [y/N] \"):\n self.add_taps(missing_taps)\n else:\n print(\"Everything up to date.\")", "metadata": "root.Cider.list_missing_taps", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 475 }, { "content": " @staticmethod\n def json_value(value):\n if isinstance(value, str) or isinstance(value, unicode):\n try:\n return json.loads(_DEFAULTS_FALSE_RE.sub(\n \"false\",\n _DEFAULTS_TRUE_RE.sub(\"true\", value)\n ))\n except ValueError:\n pass\n return value", "metadata": "root.Cider.json_value", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 488 }, { "content": " def set_default(self, domain, key, value, force=None):\n json_value = self.json_value(value)\n self.defaults.write(domain, key, json_value, force)\n\n def transform(defaults):\n defaults[key] = json_value\n return defaults\n\n if self._modify_defaults(domain, transform):\n tty.puts(\"Updated defaults\")", "metadata": "root.Cider.set_default", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 500 }, { "content": " def remove_default(self, domain, key):\n self.defaults.delete(domain, key)\n\n def transform(defaults):\n defaults.pop(key, None)\n return defaults\n\n if self._modify_defaults(domain, transform):\n tty.puts(\"Updated defaults\")", "metadata": "root.Cider.remove_default", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 511 }, { "content": " def apply_defaults(self):\n defaults = self.read_defaults()\n for domain, options in defaults.items():\n for key, value in options.items():\n self.defaults.write(domain, key, value)\n\n tty.puts(\"Applied defaults\")", "metadata": "root.Cider.apply_defaults", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 521 }, { "content": " def run_scripts(self, before=None, after=None):\n bootstrap = self.read_bootstrap()\n scripts = []\n scripts += bootstrap.get(\"before-scripts\", []) if before else []\n scripts += bootstrap.get(\"after-scripts\", []) if after else []\n for script in scripts:\n spawn([script], shell=True, debug=self.debug,\n cwd=self.cider_dir, env=self.env)", "metadata": "root.Cider.run_scripts", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 529 }, { "content": " def set_icon(self, app, icon):\n def transform(icons):\n icons[app] = icon\n return icons\n\n self._modify_bootstrap(\"icons\", transform, {})\n _apply_icon(app, icon)", "metadata": "root.Cider.set_icon", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 538 }, { "content": " def remove_icon(self, app):\n def transform(icons):\n if icons:\n del icons[app]\n return icons\n\n app_path = osx.path_for_app(app)\n if not app_path:\n raise AppMissingError(\"Application not found: '{0}'\".format(app))\n\n self._modify_bootstrap(\"icons\", transform)\n osx.remove_icon(app_path)", "metadata": "root.Cider.remove_icon", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 546 }, { "content": " def apply_icons(self):\n bootstrap = read_config(self.bootstrap_file)\n icons = bootstrap.get(\"icons\", {})\n for app, icon in icons.items():\n _apply_icon(app, icon)\n\n tty.puts(\"Applied icons\")", "metadata": "root.Cider.apply_icons", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 559 }, { "content": " def add_symlink(self, name, target):\n target = collapseuser(os.path.normpath(target))\n target_dir = os.path.dirname(target)\n\n # Add trailing slash for globbing.\n if target_dir != \"~\":\n target_dir = os.path.join(target_dir, \"\")\n\n def transform(symlinks):\n for key in symlinks:\n if (os.path.dirname(key) == name and\n fnmatch(os.path.basename(target), os.path.basename(key))):\n return symlinks\n\n dotted = os.path.basename(target).startswith(\".\")\n pattern = \"{0}/{1}*\".format(name, \".\" if dotted else \"\")\n symlinks[pattern] = target_dir\n return symlinks\n\n return self._modify_bootstrap(\"symlinks\", transform, {})", "metadata": "root.Cider.add_symlink", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 567 }, { "content": " def remove_symlink(self, name):\n def transform(symlinks):\n if symlinks:\n for key in symlinks.keys():\n if self._islinkkey(key, name):\n del symlinks[key]\n\n return symlinks\n\n return self._modify_bootstrap(\"symlinks\", transform)", "metadata": "root.Cider.remove_symlink", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 588 }, { "content": " def addlink(self, name, *items):\n for item in items:\n stow_path = os.path.join(self.symlink_dir, name)\n stow_fpath = os.path.join(stow_path, os.path.basename(item))\n if not os.path.exists(item):\n raise StowError(\n \"Can't link {0}: No such file or directory\".format(\n collapseuser(item)\n )\n )\n\n samefile = os.path.exists(stow_fpath) and os.path.samefile(\n os.path.realpath(stow_fpath), os.path.realpath(item)\n )\n\n if os.path.exists(stow_fpath) and not samefile:\n raise StowError(\"Link already exists at {0}\".format(\n collapseuser(stow_fpath)\n ))\n\n if not samefile:\n mkdir_p(stow_path)\n shutil.move(item, stow_path)\n\n target = os.path.abspath(item)\n self.add_symlink(name, target)\n self.mklink(stow_fpath, target)\n self._update_target_cache(self._cached_targets() + [target])", "metadata": "root.Cider.addlink", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 599 }, { "content": " def unlink(self, name):\n symlinks = self.read_bootstrap().get(\"symlinks\", {})\n\n removed_targets = set()\n found = False\n for source_glob, target in symlinks.items():\n if self._islinkkey(source_glob, name):\n found = True\n for source, target in self.expandtargets(source_glob, target):\n self._remove_link_target(source, target)\n removed_targets.add(target)\n shutil.move(source, target)\n print(tty.progress(\"Moved {0} -> {1}\".format(\n collapseuser(source),\n collapseuser(target)\n )))\n\n if not found:\n raise StowError(\"No symlink found with name: {0}\".format(name))\n\n try:\n os.rmdir(os.path.join(self.symlink_dir, name))\n except OSError as e:\n if e.errno != errno.ENOTEMPTY:\n raise e\n\n self.remove_symlink(name)\n self._update_target_cache(\n set(self._cached_targets()) - removed_targets\n )", "metadata": "root.Cider.unlink", "header": "['class', 'Cider', '(', 'object', ')', ':', '___EOS___']", "index": 628 }, { "content": "def _apply_icon(app, icon):\n app_path = osx.path_for_app(app)\n if not app_path:\n raise AppMissingError(\"Application not found: '{0}'\".format(app))\n\n try:\n components = urlparse(icon)\n if not components[\"scheme\"] or components['scheme'] == \"file\":\n icon_path = components[\"path\"]\n else:\n tmpdir = mkdtemp()\n icon_path = os.path.join(tmpdir,\n os.path.basename(components[\"path\"]))\n print(tty.progress(\"Downloading {0} icon: {1}\".format(app, icon)))\n curl(icon, icon_path)\n except ValueError:\n icon_path = icon\n\n osx.set_icon(app_path, os.path.expanduser(icon_path))", "metadata": "root._apply_icon", "header": "['module', '___EOS___']", "index": 660 } ]
[ { "span": "import sys", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "print", "\\u", "function_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "\\u", "os", "x_", "as_", "os", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "\\u", "tty_", "as_", "tty_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "exceptions_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Unsu", "ppo", "rted", "OSE", "rror_", ",_", "Xco", "de", "Missing", "Error_", ",_", "Bre", "w", "Missing", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sym", "link", "Error_", ",_", "App", "Missing", "Error_", ",_", "Sto", "w", "Error_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "\\u", "lib_", "import_", "lazy", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "\\u", "sh_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Bre", "w_", ",_", "Defaults_", ",_", "spawn_", ",_", "collapse", "user_", ",_", "common", "path_", ",_", "curl_", ",_", "mkd", "ir", "\\u", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "read", "\\u", "config_", ",_", "write", "\\u", "config_", ",_", "modif", "y", "\\u", "config_", ",_", "isdi", "rname_", ",_", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fnmatch_", "import_", "fnmatch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "glob_", "import_", "ig", "lob", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rfc", "398", "7_", "import_", "parse_", "as_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tempfile_", "import_", "mkdtemp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "click_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "errno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\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_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "DEF", "AUL", "TS", "\\u", "TRU", "E", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "r", "\"\\\\", "b", "(", "Y", "(", "ES", ")?", "|", "TRU", "E", ")\\\\", "b", "\"_", ",_", "re_", "._", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "DEF", "AUL", "TS", "\\u", "FAL", "SE", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "r", "\"\\\\", "b", "(", "N", "(", "O", ")?", "|", "FAL", "SE", ")\\\\", "b", "\"_", ",_", "re_", "._", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Cid", "er_", "(_", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Cid", "er_", "(_", "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_", ",_", "cas", "k_", "=_", "None_", ",_", "debug_", "=_", "None_", ",_", "verbose_", "=_", "None_", ",_", "cide", "r", "\\u", "dir_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "support", "\\u", "dir_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cas", "k_", "=_", "cas", "k_", "if_", "cas", "k_", "is_", "not_", "None_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "debug_", "=_", "debug_", "if_", "debug_", "is_", "not_", "None_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verbose_", "=_", "verbose_", "if_", "verbose_", "is_", "not_", "None_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cide", "r", "\\u", "dir_", "=_", "cide", "r", "\\u", "dir_", "if_", "cide", "r", "\\u", "dir_", "is_", "not_", "None_", "else_", "self_", "._", "fall", "back", "\\u", "cide", "r", "\\u", "dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "support", "\\u", "dir_", "=_", "support", "\\u", "dir_", "if_", "support", "\\u", "dir_", "is_", "not_", "None_", "else_", "self_", "._", "fall", "back", "\\u", "support", "\\u", "dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "brew", "_", "=_", "Bre", "w_", "(_", "cas", "k_", ",_", "debug_", ",_", "verbose_", ",_", "self_", "._", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "defaults_", "=_", "Defaults_", "(_", "debug_", ",_", "self_", "._", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lazy", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "symlink", "\\u", "dir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "cide", "r", "\\u", "dir_", ",_", "\"", "symlinks", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lazy", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "boots", "trap", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lega", "cy", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "cide", "r", "\\u", "dir_", ",_", "\"", "boots", "trap", ".", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "lega", "cy", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "lega", "cy", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "cide", "r", "\\u", "dir_", ",_", "\"", "boots", "trap", ".", "yaml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lazy", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "default", "s", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lega", "cy", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "cide", "r", "\\u", "dir_", ",_", "\"", "default", "s", ".", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "lega", "cy", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "lega", "cy", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "cide", "r", "\\u", "dir_", ",_", "\"", "default", "s", ".", "yaml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lazy", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "env_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "os_", "._", "environ_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "update_", "(_", "self_", "._", "read", "\\u", "bootstrap_", "(_", ")_", "._", "get_", "(_", "\"", "env", "\"_", ",_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fall", "back", "\\u", "cide", "r", "\\u", "dir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "environ_", "[_", "\"", "XD", "G", "\\u", "CONFIG", "\\u", "HOM", "E", "\"_", "]_", ",_", "\"", "cide", "r", "\"_", ")_", "\\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_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "\"~\"_", ")_", ",_", "\".", "cide", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fall", "back", "\\u", "support", "\\u", "dir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "environ_", "[_", "\"", "XD", "G", "\\u", "DATA", "\\u", "HOM", "E", "\"_", "]_", ",_", "\"", "cide", "r", "\"_", ")_", "\\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_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "expanduser_", "(_", "\"~\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Libr", "ary", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Applica", "tion", " ", "Supp", "ort", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "com", ".", "msa", "nder", "s", ".", "cide", "r", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "lazy", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "symlink", "\\u", "target", "s", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "support", "\\u", "dir_", ",_", "\"", "symlink", "\\u", "target", "s", ".", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "bootstrap_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "read", "\\u", "config_", "(_", "self_", "._", "boots", "trap", "\\u", "file_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "defaults_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "read", "\\u", "config_", "(_", "self_", "._", "default", "s", "\\u", "file_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "cide", "r", "\\u", "dir_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "self_", "._", "cide", "r", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "self_", "._", "cide", "r", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tty_", "._", "progress_", "(_", "\"", "Creat", "ed", " ", "cide", "r", " ", "dir", " ", "at", " ", "{", "0", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cide", "r", "\\u", "dir_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "modif", "y", "\\u", "bootstrap_", "(_", "self_", ",_", "key_", ",_", "transform_", "=_", "None_", ",_", "fallback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "transform_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "transform_", "=_", "lambda_", "x_", ":_", "x_", "#", " ", "pep", "8", ":", " ", "no", "qa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fallback_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fallback_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "outer", "\\u", "transform_", "(_", "bootstrap_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bootstrap_", "[_", "key_", "]_", "=_", "transform_", "(_", "bootstrap_", "._", "get_", "(_", "key_", ",_", "fallback_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "bootstrap_", "[_", "key_", "]_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bootstrap_", "[_", "key_", "]_", "=_", "sorted_", "(_", "bootstrap_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bootstrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "cide", "r", "\\u", "dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "modif", "y", "\\u", "config_", "(_", "self_", "._", "boots", "trap", "\\u", "file_", ",_", "outer", "\\u", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "modif", "y", "\\u", "defaults_", "(_", "self_", ",_", "domain_", ",_", "transform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "outer", "\\u", "transform_", "(_", "defaults_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defaults_", "[_", "domain_", "]_", "=_", "transform_", "(_", "defaults_", "._", "get_", "(_", "domain_", ",_", "{_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "defaults_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "cide", "r", "\\u", "dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "modif", "y", "\\u", "config_", "(_", "self_", "._", "default", "s", "\\u", "file_", ",_", "outer", "\\u", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cache", "d\\u", "targets_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "read", "\\u", "config_", "(_", "self_", "._", "symlink", "\\u", "target", "s", "\\u", "file_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "\\u", "target", "\\u", "cache_", "(_", "self_", ",_", "new", "\\u", "targets_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "check", "\\u", "cide", "r", "\\u", "dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mkd", "ir", "\\u", "p_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "self_", "._", "symlink", "\\u", "target", "s", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "write", "\\u", "config_", "(_", "self_", "._", "symlink", "\\u", "target", "s", "\\u", "file_", ",_", "sorted_", "(_", "new", "\\u", "targets_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "remove", "\\u", "dead", "\\u", "targets_", "(_", "self_", ",_", "targets_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "target_", "in_", "targets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "islink_", "(_", "target_", ")_", "and_", "os_", "._", "path_", "._", "same", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cide", "r", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "common", "path_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "cide", "r", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "realpath_", "(_", "target_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tty_", "._", "progress_", "(_", "\"", "Remove", "d", " ", "dead", " ", "symlink", ":", " ", "{", "0", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "collapse", "user_", "(_", "target_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "remove", "\\u", "link", "\\u", "target_", "(_", "source_", ",_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "same", "file_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "target_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "realpath_", "(_", "source_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "target_", ")_", "\\u\\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_", "Sym", "link", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"{", "0", "}", " ", "symlink", " ", "target", " ", "alr", "ead", "y", " ", "exist", "s", " ", "at", ":", " ", "{", "1", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "collapse", "user_", "(_", "source_", ")_", ",_", "collapse", "user_", "(_", "target_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "has", "\\u", "xco", "de", "\\u", "tools_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "developer", "\\u", "dir_", "=_", "spawn_", "(_", "[_", "\"/", "usr", "/", "bin", "/", "xco", "de", "-", "select", "\"_", ",_", "\"-", "print", "-", "path", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "check", "\\u", "output_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "self_", "._", "debug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "self_", "._", "env_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "bool_", "(_", "os_", "._", "path_", "._", "isdir_", "(_", "developer", "\\u", "dir_", ")_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "developer", "\\u", "dir_", ",_", "\"", "usr", "\"_", ",_", "\"", "bin", "\"_", ",_", "\"", "git", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "assert", "\\u", "requirements_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "macos", "\\u", "version_", "=_", "platform_", "._", "mac", "\\u", "ver_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "int_", "(_", "macos", "\\u", "version_", "._", "split_", "(_", "\".\"_", ")_", "[_", "1_", "]_", ")_", "<_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Unsu", "ppo", "rted", "OSE", "rror_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Unsu", "ppo", "rted", " ", "OS", " ", "version", ";", " ", "plea", "se", " ", "upgrade", " ", "to", " ", "10.", "9", " ", "or", " ", "late", "r", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "and", " ", "try", " ", "again", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "macos", "\\u", "version_", "\\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_", "not_", "self_", "._", "\\u", "has", "\\u", "xco", "de", "\\u", "tools_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "tty_", "._", "progress_", "(_", "\"", "Install", "ing", " ", "the", " ", "Command", " ", "Line", " ", "Tool", "s", " ", "(", "expect", " ", "a", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "GU", "I", " ", "popu", "p", "):\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spawn_", "(_", "[_", "\"/", "usr", "/", "bin", "/", "xco", "de", "-", "select", "\"_", ",_", "\"--", "install", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "self_", "._", "debug_", ",_", "env_", "=_", "self_", "._", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "click_", "._", "pause_", "(_", "\"", "Press", " ", "any", " ", "key", " ", "whe", "n", " ", "the", " ", "installation", " ", "is", " ", "complete", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "has", "\\u", "xco", "de", "\\u", "tools_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Xco", "de", "Missing", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Abo", "rted", " ", "Command", " ", "Line", " ", "Tool", "s", " ", "installation", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "spawn_", "(_", "[_", "\"", "whi", "ch", "\"_", ",_", "\"", "brew", "\"_", "]_", ",_", "check", "\\u", "call_", "=_", "False_", ",_", "debug_", "=_", "self_", "._", "debug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "self_", "._", "env_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Bre", "w", "Missing", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Home", "brew", " ", "not", " ", "install", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "http", "://", "brew", ".", "sh", "/", "#", "install", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "isl", "ink", "key_", "(_", "symlink_", ",_", "sto", "w_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "symlink_", "==_", "sto", "w_", "or_", "symlink_", "._", "startswith_", "(_", "os_", "._", "path_", "._", "join_", "(_", "sto", "w_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "restore_", "(_", "self_", ",_", "ignore", "\\u", "errors_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ignore", "\\u", "errors_", "=_", "ignore", "\\u", "errors_", "if_", "ignore", "\\u", "errors_", "is_", "not_", "None_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "assert", "\\u", "requirements_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cas", "kb", "rew", "_", "=_", "Bre", "w_", "(_", "True_", ",_", "self_", "._", "debug_", ",_", "self_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "brew", "_", "=_", "Bre", "w_", "(_", "False_", ",_", "self_", "._", "debug_", ",_", "self_", "._", "verbose_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bootstrap_", "=_", "self_", "._", "read", "\\u", "bootstrap_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cas", "ks_", "=_", "bootstrap_", "._", "get_", "(_", "\"", "cas", "ks", "\"_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dependencies_", "=_", "bootstrap_", "._", "get_", "(_", "\"", "dependen", "cies", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "run", "\\u", "scripts_", "(_", "before_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "tap_", "in_", "bootstrap_", "._", "get_", "(_", "\"", "taps", "\"_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "home", "brew", "_", "._", "tap_", "(_", "tap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outdate", "d_", "=_", "home", "brew", "_", "._", "outdate", "d_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "formula_", "in_", "bootstrap_", "._", "get_", "(_", "\"", "formulas", "\"_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "formula_", "in_", "dependencies_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deps_", "=_", "dependencies_", "[_", "formula_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deps_", "=_", "deps_", "if_", "isinstance_", "(_", "deps_", ",_", "list_", ")_", "else_", "[_", "deps_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Curr", "ent", "ly", " ", "only", " ", "cas", "k", " ", "dependen", "cies", " ", "are", " ", "support", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "deps_", "=_", "(_", "dep_", "for_", "dep_", "in_", "deps_", "if_", "dep_", "._", "startswith_", "(_", "\"", "cas", "ks", "/\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "dep_", "in_", "deps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cas", "k_", "=_", "dep_", "._", "split_", "(_", "\"/\"_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tty_", "._", "progress_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Install", "ing", " ", "{", "0", "}", " ", "dependen", "cy", " ", "for", " ", "{", "1", "}\"_", ")_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cas", "k_", ",_", "formula_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cas", "kb", "rew", "_", "._", "safe", "\\u", "install_", "(_", "cas", "k_", ",_", "ignore", "\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "cas", "ks_", "[_", "cas", "ks_", "._", "index_", "(_", "cas", "k_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "home", "brew", "_", "._", "safe", "\\u", "install_", "(_", "formula_", ",_", "ignore", "\\u", "errors_", ",_", "formula_", "in_", "outdate", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "cas", "k_", "in_", "cas", "ks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cas", "kb", "rew", "_", "._", "safe", "\\u", "install_", "(_", "cas", "k_", ",_", "ignore", "\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "reli", "nk_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "appl", "y", "\\u", "defaults_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "appl", "y", "\\u", "icons_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "scripts_", "(_", "after_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "install_", "(_", "self_", ",_", "*_", "formulas", "_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formulas", "_", "=_", "list_", "(_", "formulas", "_", ")_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "force_", "=_", "kwargs_", "._", "get_", "(_", "\"", "force", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "brew", "_", "._", "install_", "(_", "*_", "formulas", "_", ",_", "force_", "=_", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "to", "\\u", "bootstrap_", "(_", "formulas", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "to", "\\u", "bootstrap_", "(_", "self_", ",_", "formulas", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Av", "oid", " ", "pylint", " ", "scop", "ing", " ", "warn", "ing", " ", "W", "064", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "transform_", "(_", "formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "lambda_", "x_", ":_", "x_", "+_", "[_", "formula_", "]_", "if_", "formula_", "not_", "in_", "x_", "else_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "formula_", "in_", "formulas", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "modif", "y", "\\u", "bootstrap_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cas", "ks", "\"_", "if_", "self_", "._", "cas", "k_", "else_", "\"", "formulas", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transform_", "=_", "transform_", "(_", "formula_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fallback_", "=_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "puts_", "(_", "\"", "Added", " ", "{", "0", "}", " ", "to", " ", "boots", "trap", "\"_", "._", "format_", "(_", "formula_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "put", "err_", "(_", "\"{", "0", "}", " ", "alr", "ead", "y", " ", "bootstrapp", "ed", ";", " ", "skip", "ping", " ", "install", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "formula_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "warning_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rm_", "(_", "self_", ",_", "*_", "formulas", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "transform_", "(_", "formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "lambda_", "xs_", ":_", "[_", "x_", "for_", "x_", "in_", "xs_", "if_", "x_", "!=_", "formula_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "formulas", "_", "=_", "list_", "(_", "formulas", "_", ")_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "brew", "_", "._", "rm_", "(_", "*_", "formulas", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "formula_", "in_", "formulas", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "modif", "y", "\\u", "bootstrap_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "cas", "ks", "\"_", "if_", "self_", "._", "cas", "k_", "else_", "\"", "formulas", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transform_", "=_", "transform_", "(_", "formula_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fallback_", "=_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "puts_", "(_", "\"", "Remove", "d", " ", "{", "0", "}", " ", "from", " ", "boots", "trap", "\"_", "._", "format_", "(_", "formula_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "put", "err_", "(_", "\"{", "0", "}", " ", "not", " ", "found", " ", "in", " ", "boots", "trap", "\"_", "._", "format_", "(_", "formula_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tap_", "(_", "self_", ",_", "tap_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tap_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tap", "ped_", "=_", "self_", "._", "tap", "ped_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tap", "ped_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "tap", "ped_", ")_", ")_", "\\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 ", " _", "self_", "._", "brew", "_", "._", "tap_", "(_", "tap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "taps", "_", "(_", "[_", "tap_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "taps", "_", "(_", "self_", ",_", "taps", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "transform_", "(_", "tap_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "lambda_", "x_", ":_", "x_", "+_", "[_", "tap_", "]_", "if_", "tap_", "not_", "in_", "x_", "else_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "tap_", "in_", "taps", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "modif", "y", "\\u", "bootstrap_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "taps", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transform_", "=_", "transform_", "(_", "tap_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fallback_", "=_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "puts_", "(_", "\"", "Added", " ", "{", "0", "}", " ", "tap", " ", "to", " ", "boots", "trap", "\"_", "._", "format_", "(_", "tap_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "put", "err_", "(_", "\"{", "0", "}", " ", "tap", " ", "alr", "ead", "y", " ", "bootstrapp", "ed", "\"_", "._", "format_", "(_", "tap_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unta", "p_", "(_", "self_", ",_", "tap_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "brew", "_", "._", "unta", "p_", "(_", "tap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "modif", "y", "\\u", "bootstrap_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "taps", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "transform_", "=_", "lambda_", "xs_", ":_", "[_", "x_", "for_", "x_", "in_", "xs_", "if_", "x_", "!=_", "tap_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fallback_", "=_", "[_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "puts_", "(_", "\"", "Remove", "d", " ", "{", "0", "}", " ", "tap", " ", "from", " ", "boots", "trap", "\"_", "._", "format_", "(_", "tap_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "put", "err_", "(_", "\"{", "0", "}", " ", "tap", " ", "not", " ", "found", " ", "in", " ", "bootstrapp", "ed", "\"_", "._", "format_", "(_", "tap_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "expand", "target_", "(_", "source_", ",_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expanded_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isdi", "rname_", "(_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "os_", "._", "path_", "._", "join_", "(_", "expanded_", ",_", "os_", "._", "path_", "._", "basename_", "(_", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "expanded_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "expand", "targets_", "(_", "self_", ",_", "source", "\\u", "glob_", ",_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isdi", "rname_", "(_", "target_", ")_", "and_", "(_", "\"*\"_", "in_", "source", "\\u", "glob_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "\"?\"_", "in_", "source", "\\u", "glob_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sym", "link", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inva", "lid", " ", "symlink", ":", " ", "{", "0", "}", " ", "=>", " ", "{", "1", "}", " ", "(", "did", " ", "you", " ", "mean", " ", "to", " ", "add", " ", "a", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "trail", "ing", " ", "'/'", "?)\"_", "._", "format_", "(_", "source", "\\u", "glob_", ",_", "target_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mkd", "ir", "\\u", "p_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "target_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sources_", "=_", "ig", "lob", "_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "symlink", "\\u", "dir_", ",_", "source", "\\u", "glob_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expanded_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "source_", "in_", "sources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "cide", "r", "\\u", "dir_", ",_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "target_", "=_", "self_", "._", "expand", "target_", "(_", "source_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expanded_", "._", "append_", "(_", "(_", "source_", ",_", "source", "\\u", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "expanded_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reli", "nk_", "(_", "self_", ",_", "force_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "force_", "=_", "force_", "if_", "force_", "is_", "not_", "None_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symlinks", "_", "=_", "self_", "._", "read", "\\u", "bootstrap_", "(_", ")_", "._", "get_", "(_", "\"", "symlinks", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "targets_", "=_", "self_", "._", "\\u", "cache", "d\\u", "targets_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "targets_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "source", "\\u", "glob_", ",_", "target_", "in_", "symlinks", "_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "source_", ",_", "expand", "ed", "\\u", "target_", "in_", "self_", "._", "expand", "targets_", "(_", "source", "\\u", "glob_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "mk", "link_", "(_", "source_", ",_", "expand", "ed", "\\u", "target_", ",_", "force_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "targets_", "._", "append_", "(_", "expand", "ed", "\\u", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "remove", "\\u", "dead", "\\u", "targets_", "(_", "set_", "(_", "old", "\\u", "targets_", ")_", "-_", "set_", "(_", "new", "\\u", "targets_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "target", "\\u", "cache_", "(_", "new", "\\u", "targets_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "new", "\\u", "targets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mk", "link_", "(_", "self_", ",_", "source_", ",_", "target_", ",_", "force_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "linked_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sym", "link", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "symlink", " ", "source", " ", "\\\\\"{", "0", "}\\\\\"", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "collapse", "user_", "(_", "source_", ")_", "\\u\\u\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "symlink_", "(_", "source_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linked_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tty_", "._", "puts_", "(_", "\"", "symlink", "ed", " ", "{", "0", "}", " ", "->", " ", "{", "1", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tty_", "._", "color_", "(_", "collapse", "user_", "(_", "target_", ")_", ",_", "tty_", "._", "MAGE", "NTA", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "collapse", "user_", "(_", "source_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "errno_", "!=_", "errno_", "._", "EE", "XIST", "_", ":_", "\\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_", "if_", "os_", "._", "path_", "._", "islink_", "(_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "same", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "realpath_", "(_", "target_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "realpath_", "(_", "source_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "linked_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tty_", "._", "put", "debug_", "(_", "\"", "Al", "read", "y", " ", "linked", ":", " ", "{", "0", "}", " ", "->", " ", "{", "1", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tty_", "._", "color_", "(_", "collapse", "user_", "(_", "target_", ")_", ",_", "tty_", "._", "MAGE", "NTA", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "collapse", "user_", "(_", "source_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "self_", "._", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fmt_", "=_", "\"", "Linke", "d", " ", "to", " ", "wrong", " ", "target", ":", " ", "{", "0", "}", " ", "->", " ", "{", "1", "}", " ", "(", "inst", "ead", " ", "of", " ", "{", "2", "})\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tty_", "._", "put", "err_", "(_", "fmt_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tty_", "._", "color_", "(_", "target_", ",_", "tty_", "._", "MAGE", "NTA", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "realpath_", "(_", "collapse", "user_", "(_", "target_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "realpath_", "(_", "collapse", "user_", "(_", "source_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "warning_", "=_", "force_", ")_", "\\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 ", " _", "tty_", "._", "put", "err_", "(_", "\"{", "0", "}", " ", "symlink", " ", "target", " ", "alr", "ead", "y", " ", "exist", "s", " ", "at", ":", " ", "{", "1", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "collapse", "user_", "(_", "source_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "collapse", "user_", "(_", "target_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "warning_", "=_", "force_", ")_", "\\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_", "linked_", "and_", "force_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os", "x_", "._", "move", "\\u", "to", "\\u", "trash", "_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tty_", "._", "progress_", "(_", "\"", "Move", "d", " ", "{", "0", "}", " ", "to", " ", "trash", "\"_", ")_", "._", "format_", "(_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "put", "err_", "(_", "\"", "Error", " ", "movin", "g", " ", "{", "0", "}", " ", "to", " ", "trash", ":", " ", "{", "1", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "target_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "mk", "link_", "(_", "source_", ",_", "target_", ",_", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "linked_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "installed_", "(_", "self_", ",_", "prefix_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bootstrap_", "=_", "self_", "._", "read", "\\u", "bootstrap_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "\"", "cas", "ks", "\"_", "if_", "self_", "._", "cas", "k_", "else_", "\"", "formulas", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formulas", "_", "=_", "bootstrap_", "._", "get_", "(_", "key_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prefix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "x_", "for_", "x_", "in_", "formulas", "_", "if_", "x_", "._", "startswith_", "(_", "prefix_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "formulas", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tap", "ped_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "read", "\\u", "bootstrap_", "(_", ")_", "._", "get_", "(_", "\"", "taps", "\"_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "missing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "installed_", "=_", "[_", "item_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "for_", "item_", "in_", "self_", "._", "installed_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "brew", "ed_", "=_", "self_", "._", "brew", "_", "._", "ls_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "brew", "\\u", "orphan", "_", "(_", "formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tempora", "ry", " ", "workar", "ound", " ", "to", " ", "avoid", " ", "bug", " ", "with", " ", "brew", "-", "pip", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "msa", "nder", "s", "/", "cide", "r", "/", "issue", "s", "/", "25_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "formula_", "._", "startswith_", "(_", "\"", "pip", "-\"_", ")_", ":_", "\\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_", "uses_", "=_", "self_", "._", "brew", "_", "._", "uses_", "(_", "formula_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "len_", "(_", "set_", "(_", "installed_", ")_", "&_", "set_", "(_", "uses_", ")_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sorted_", "(_", "filter_", "(_", "brew", "\\u", "orphan", "_", ",_", "set_", "(_", "brew", "ed_", ")_", "-_", "set_", "(_", "installed_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "missi", "ng", "\\u", "taps", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bootstrapp", "ed_", "=_", "self_", "._", "tap", "ped_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "brew", "ed_", "=_", "self_", "._", "brew", "_", "._", "tap_", "(_", ")_", "._", "strip_", "(_", ")_", "._", "splitlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sorted_", "(_", "set_", "(_", "brew", "ed_", ")_", "-_", "set_", "(_", "bootstrapp", "ed_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ls_", "(_", "self_", ",_", "formula_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "formulas", "_", "=_", "self_", "._", "installed_", "(_", "formula_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "formulas", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "formulas", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "put", "err_", "(_", "\"", "not", "hing", " ", "to", " ", "list", "\"_", ",_", "prefix_", "=_", "\"", "Error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list", "\\u", "missing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "missi", "ng", "\\u", "items_", "=_", "self_", "._", "missing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "missi", "ng", "\\u", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "\"", "s", "\"_", "if_", "len_", "(_", "missi", "ng", "\\u", "items_", ")_", "!=_", "1_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt_", "=_", "\"{", "0", "}", " ", "missi", "ng", " ", "formula", "{", "1", "}", " ", "(", "tip", ":", " ", "try", " ", "`", "brew", " ", "use", "s", " ", "\"_", "+_", "\"--", "install", "ed", "`", " ", "to", " ", "see", " ", "what", "'", "s", " ", "usi", "ng", " ", "it", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tty_", "._", "put", "err_", "(_", "fmt_", "._", "format_", "(_", "len_", "(_", "missi", "ng", "\\u", "items_", ")_", ",_", "suffix_", ")_", ",_", "warning_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "missi", "ng", "\\u", "items_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "prompt_", "(_", "\"", "Add", " ", "to", " ", "boots", "trap", "?", " ", "[", "y", "/", "N", "]", " ", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "to", "\\u", "bootstrap_", "(_", "missi", "ng", "\\u", "items_", ")_", "\\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 ", " _", "print_", "(_", "\"", "Every", "thing", " ", "up", " ", "to", " ", "date", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list", "\\u", "missi", "ng", "\\u", "taps", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "missi", "ng", "\\u", "taps", "_", "=_", "self_", "._", "missi", "ng", "\\u", "taps", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "missi", "ng", "\\u", "taps", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suffix_", "=_", "\"", "s", "\"_", "if_", "len_", "(_", "missi", "ng", "\\u", "taps", "_", ")_", "!=_", "1_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt_", "=_", "\"{", "0", "}", " ", "missi", "ng", " ", "tap", "{", "1", "}\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tty_", "._", "put", "err_", "(_", "fmt_", "._", "format_", "(_", "len_", "(_", "missi", "ng", "\\u", "taps", "_", ")_", ",_", "suffix_", ")_", ",_", "warning_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "missi", "ng", "\\u", "taps", "_", ")_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "prompt_", "(_", "\"", "Add", " ", "to", " ", "boots", "trap", "?", " ", "[", "y", "/", "N", "]", " ", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "taps", "_", "(_", "missi", "ng", "\\u", "taps", "_", ")_", "\\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 ", " _", "print_", "(_", "\"", "Every", "thing", " ", "up", " ", "to", " ", "date", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "json", "\\u", "value_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "str_", ")_", "or_", "isinstance_", "(_", "value_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "loads_", "(_", "\\u", "DEF", "AUL", "TS", "\\u", "FAL", "SE", "\\u", "RE_", "._", "sub_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "fal", "se", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "DEF", "AUL", "TS", "\\u", "TRU", "E", "\\u", "RE_", "._", "sub_", "(_", "\"", "true", "\"_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "default_", "(_", "self_", ",_", "domain_", ",_", "key_", ",_", "value_", ",_", "force_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json", "\\u", "value_", "=_", "self_", "._", "json", "\\u", "value_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "defaults_", "._", "write_", "(_", "domain_", ",_", "key_", ",_", "json", "\\u", "value_", ",_", "force_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transform_", "(_", "defaults_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defaults_", "[_", "key_", "]_", "=_", "json", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "defaults_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "modif", "y", "\\u", "defaults_", "(_", "domain_", ",_", "transform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "puts_", "(_", "\"", "Update", "d", " ", "default", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "default_", "(_", "self_", ",_", "domain_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "defaults_", "._", "delete_", "(_", "domain_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transform_", "(_", "defaults_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defaults_", "._", "pop_", "(_", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "defaults_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "modif", "y", "\\u", "defaults_", "(_", "domain_", ",_", "transform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tty_", "._", "puts_", "(_", "\"", "Update", "d", " ", "default", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "\\u", "defaults_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defaults_", "=_", "self_", "._", "read", "\\u", "defaults_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "domain_", ",_", "options_", "in_", "defaults_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "options_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "defaults_", "._", "write_", "(_", "domain_", ",_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tty_", "._", "puts_", "(_", "\"", "Appl", "ied", " ", "default", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "scripts_", "(_", "self_", ",_", "before_", "=_", "None_", ",_", "after_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bootstrap_", "=_", "self_", "._", "read", "\\u", "bootstrap_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scripts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scripts_", "+=_", "bootstrap_", "._", "get_", "(_", "\"", "bef", "ore", "-", "scripts", "\"_", ",_", "[_", "]_", ")_", "if_", "before_", "else_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scripts_", "+=_", "bootstrap_", "._", "get_", "(_", "\"", "after", "-", "scripts", "\"_", ",_", "[_", "]_", ")_", "if_", "after_", "else_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "script_", "in_", "scripts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spawn_", "(_", "[_", "script_", "]_", ",_", "shell_", "=_", "True_", ",_", "debug_", "=_", "self_", "._", "debug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", "=_", "self_", "._", "cide", "r", "\\u", "dir_", ",_", "env_", "=_", "self_", "._", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "icon_", "(_", "self_", ",_", "app_", ",_", "icon_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "transform_", "(_", "icons_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icons_", "[_", "app_", "]_", "=_", "icon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "icons_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "modif", "y", "\\u", "bootstrap_", "(_", "\"", "icons", "\"_", ",_", "transform_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "appl", "y", "\\u", "icon_", "(_", "app_", ",_", "icon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "icon_", "(_", "self_", ",_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "transform_", "(_", "icons_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "icons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "icons_", "[_", "app_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "icons_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "path_", "=_", "os", "x_", "._", "path", "\\u", "for", "\\u", "app_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "app", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "App", "Missing", "Error_", "(_", "\"", "Applica", "tion", " ", "not", " ", "found", ":", " ", "'{", "0", "}'\"_", "._", "format_", "(_", "app_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "modif", "y", "\\u", "bootstrap_", "(_", "\"", "icons", "\"_", ",_", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os", "x_", "._", "remove", "\\u", "icon_", "(_", "app", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "appl", "y", "\\u", "icons_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bootstrap_", "=_", "read", "\\u", "config_", "(_", "self_", "._", "boots", "trap", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icons_", "=_", "bootstrap_", "._", "get_", "(_", "\"", "icons", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "app_", ",_", "icon_", "in_", "icons_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "appl", "y", "\\u", "icon_", "(_", "app_", ",_", "icon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tty_", "._", "puts_", "(_", "\"", "Appl", "ied", " ", "icons", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "symlink_", "(_", "self_", ",_", "name_", ",_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "collapse", "user_", "(_", "os_", "._", "path_", "._", "normpath_", "(_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "trail", "ing", " ", "slash", " ", "for", " ", "glob", "bing", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "target", "\\u", "dir_", "!=_", "\"~\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "target", "\\u", "dir_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "transform_", "(_", "symlinks", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "symlinks", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "key_", ")_", "==_", "name_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "fnmatch_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "target_", ")_", ",_", "os_", "._", "path_", "._", "basename_", "(_", "key_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "symlinks", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dot", "ted_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "target_", ")_", "._", "startswith_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "=_", "\"{", "0", "}/", "{", "1", "}*", "\"_", "._", "format_", "(_", "name_", ",_", "\".\"_", "if_", "dot", "ted_", "else_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symlinks", "_", "[_", "pattern_", "]_", "=_", "target", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "symlinks", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "modif", "y", "\\u", "bootstrap_", "(_", "\"", "symlinks", "\"_", ",_", "transform_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "symlink_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "transform_", "(_", "symlinks", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "symlinks", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "symlinks", "_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "\\u", "isl", "ink", "key_", "(_", "key_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "symlinks", "_", "[_", "key_", "]_", "\\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_", "symlinks", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "modif", "y", "\\u", "bootstrap_", "(_", "\"", "symlinks", "\"_", ",_", "transform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "link_", "(_", "self_", ",_", "name_", ",_", "*_", "items_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sto", "w", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "symlink", "\\u", "dir_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sto", "w", "\\u", "fpath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "sto", "w", "\\u", "path_", ",_", "os_", "._", "path_", "._", "basename_", "(_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "w", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Can", "'", "t", " ", "link", " ", "{", "0", "}:", " ", "No", " ", "suc", "h", " ", "file", " ", "or", " ", "director", "y", "\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "collapse", "user_", "(_", "item_", ")_", "\\u\\u\\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_", "same", "file_", "=_", "os_", "._", "path_", "._", "exists_", "(_", "sto", "w", "\\u", "fpath_", ")_", "and_", "os_", "._", "path_", "._", "same", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "realpath_", "(_", "sto", "w", "\\u", "fpath_", ")_", ",_", "os_", "._", "path_", "._", "realpath_", "(_", "item_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "sto", "w", "\\u", "fpath_", ")_", "and_", "not_", "same", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "w", "Error_", "(_", "\"", "Link", " ", "alr", "ead", "y", " ", "exist", "s", " ", "at", " ", "{", "0", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "collapse", "user_", "(_", "sto", "w", "\\u", "fpath_", ")_", "\\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_", "not_", "same", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mkd", "ir", "\\u", "p_", "(_", "sto", "w", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "move_", "(_", "item_", ",_", "sto", "w", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "symlink_", "(_", "name_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mk", "link_", "(_", "sto", "w", "\\u", "fpath_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "target", "\\u", "cache_", "(_", "self_", "._", "\\u", "cache", "d\\u", "targets_", "(_", ")_", "+_", "[_", "target_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cid", "er_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unlink_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symlinks", "_", "=_", "self_", "._", "read", "\\u", "bootstrap_", "(_", ")_", "._", "get_", "(_", "\"", "symlinks", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "remove", "d\\u", "targets_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "source", "\\u", "glob_", ",_", "target_", "in_", "symlinks", "_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "isl", "ink", "key_", "(_", "source", "\\u", "glob_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "source_", ",_", "target_", "in_", "self_", "._", "expand", "targets_", "(_", "source", "\\u", "glob_", ",_", "target_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "remove", "\\u", "link", "\\u", "target_", "(_", "source_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remove", "d\\u", "targets_", "._", "add_", "(_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "move_", "(_", "source_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tty_", "._", "progress_", "(_", "\"", "Move", "d", " ", "{", "0", "}", " ", "->", " ", "{", "1", "}\"_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "collapse", "user_", "(_", "source_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "collapse", "user_", "(_", "target_", ")_", "\\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_", "if_", "not_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "w", "Error_", "(_", "\"", "No", " ", "symlink", " ", "found", " ", "with", " ", "name", ":", " ", "{", "0", "}\"_", "._", "format_", "(_", "name_", ")_", ")_", "\\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 ", " _", "os_", "._", "rmdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "symlink", "\\u", "dir_", ",_", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "errno_", "!=_", "errno_", "._", "ENO", "TEMP", "TY_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "remove", "\\u", "symlink_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "target", "\\u", "cache_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "set_", "(_", "self_", "._", "\\u", "cache", "d\\u", "targets_", "(_", ")_", ")_", "-_", "remove", "d\\u", "targets_", "\\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_", "\\u", "appl", "y", "\\u", "icon_", "(_", "app_", ",_", "icon_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "path_", "=_", "os", "x_", "._", "path", "\\u", "for", "\\u", "app_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "app", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "App", "Missing", "Error_", "(_", "\"", "Applica", "tion", " ", "not", " ", "found", ":", " ", "'{", "0", "}'\"_", "._", "format_", "(_", "app_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "components_", "=_", "urlparse_", "(_", "icon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "components_", "[_", "\"", "sche", "me", "\"_", "]_", "or_", "components_", "[_", "'", "sche", "me", "'_", "]_", "==_", "\"", "file", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icon", "\\u", "path_", "=_", "components_", "[_", "\"", "path", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tmpdir_", "=_", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "icon", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "basename_", "(_", "components_", "[_", "\"", "path", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tty_", "._", "progress_", "(_", "\"", "Down", "load", "ing", " ", "{", "0", "}", " ", "icon", ":", " ", "{", "1", "}\"_", "._", "format_", "(_", "app_", ",_", "icon_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curl_", "(_", "icon_", ",_", "icon", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icon", "\\u", "path_", "=_", "icon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os", "x_", "._", "set\\u", "icon_", "(_", "app", "\\u", "path_", ",_", "os_", "._", "path_", "._", "expanduser_", "(_", "icon", "\\u", "path_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
chromaway/ngcccbase/ngcccbase/tests/test_deterministic.py
[ { "content": "#!/usr/bin/env python\n\nimport copy\nimport unittest\n\nfrom pycoin.encoding import EncodingError\n\nfrom coloredcoinlib import ColorSet\nfrom coloredcoinlib.tests.test_colorset import MockColorMap\nfrom ngcccbase.address import InvalidAddressError\nfrom ngcccbase.asset import AssetDefinition\nfrom ngcccbase.deterministic import DWalletAddressManager\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestDeterministic(unittest.TestCase):\n\n\n\n\n\n\n", "metadata": "root.TestDeterministic", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def setUp(self):\n self.colormap = MockColorMap()\n d = self.colormap.d\n self.colorset0 = ColorSet(self.colormap, [''])\n self.colorset1 = ColorSet(self.colormap, [d[1]])\n self.colorset1alt = ColorSet(self.colormap, [d[1],d[6]])\n self.colorset2 = ColorSet(self.colormap, [d[2]])\n self.colorset3 = ColorSet(self.colormap, [d[3], d[4]])\n self.def1 = {'monikers': ['test1'],\n 'color_set': self.colorset1.get_data(),\n 'unit':10}\n self.asset1 = AssetDefinition(self.colormap, self.def1)\n self.master_key = '265a1a0ad05e82fa321e3f6f6767679df0c68515797e0e4e24be1afc3272ee658ec53cecb683ab76a8377273347161e123fddf5320cbbce8849b0a00557bd12c'\n self.privkey = '5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF'\n self.pubkey = '1CC3X2gu58d6wXUWMffpuzN9JAfTUWu4Kj'\n c = {\n 'dw_master_key': self.master_key,\n 'dwam': {\n 'genesis_color_sets':[self.colorset1.get_data(),\n self.colorset2.get_data()],\n 'color_set_states':[\n {'color_set':self.colorset0.get_data(), \"max_index\":0},\n {'color_set':self.colorset1.get_data(), \"max_index\":3},\n {'color_set':self.colorset2.get_data(), \"max_index\":2},\n ],\n },\n 'addresses':[{'address_data': self.privkey,\n 'color_set': self.colorset1.get_data(),\n }],\n 'testnet': False,\n }\n self.config = copy.deepcopy(c)\n self.maindwam = DWalletAddressManager(self.colormap, c)", "metadata": "root.TestDeterministic.setUp", "header": "['class', 'TestDeterministic', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_init_new_wallet(self):\n c = copy.deepcopy(self.config)\n del c['dw_master_key']\n del c['dwam']\n newdwam = DWalletAddressManager(self.colormap, c)\n params = newdwam.init_new_wallet()\n self.assertNotEqual(self.config['dw_master_key'],\n newdwam.config['dw_master_key'])\n\n c = copy.deepcopy(self.config)\n c['addresses'][0]['address_data'] = 'notreal'\n self.assertRaises(EncodingError, DWalletAddressManager,\n self.colormap, c)", "metadata": "root.TestDeterministic.test_init_new_wallet", "header": "['class', 'TestDeterministic', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 50 }, { "content": " def test_get_new_address(self):\n self.assertEqual(self.maindwam.get_new_address(self.colorset2).index,\n 3)\n self.assertEqual(self.maindwam.get_new_address(self.asset1).index,\n 4)", "metadata": "root.TestDeterministic.test_get_new_address", "header": "['class', 'TestDeterministic', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_get_new_genesis_address(self):\n addr = self.maindwam.get_new_genesis_address()\n self.assertEqual(addr.index, 2)\n addr2 = self.maindwam.get_new_address(addr.get_color_set())\n self.assertEqual(addr2.index, 0)", "metadata": "root.TestDeterministic.test_get_new_genesis_address", "header": "['class', 'TestDeterministic', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def test_get_update_genesis_address(self):\n addr = self.maindwam.get_genesis_address(0)\n self.maindwam.update_genesis_address(addr, self.colorset1alt)\n self.assertEqual(addr.get_color_set(), self.colorset1alt)", "metadata": "root.TestDeterministic.test_get_update_genesis_address", "header": "['class', 'TestDeterministic', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 76 }, { "content": " def test_get_change_address(self):\n addr = self.maindwam.get_change_address(self.colorset0)\n self.assertEqual(addr.get_color_set().__repr__(),\n self.colorset0.__repr__())\n self.assertEqual(self.maindwam.get_change_address(self.colorset3).index,\n 0)", "metadata": "root.TestDeterministic.test_get_change_address", "header": "['class', 'TestDeterministic', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 81 }, { "content": " def test_get_all_addresses(self):\n addrs = [a.get_address() for a in self.maindwam.get_all_addresses()]\n self.assertTrue(self.pubkey in addrs)", "metadata": "root.TestDeterministic.test_get_all_addresses", "header": "['class', 'TestDeterministic', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 88 } ]
[ { "span": "from ngcccbase.address import InvalidAddressError", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 49 } ]
[]
1
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_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyco", "in_", "._", "encoding_", "import_", "Enco", "ding", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "colore", "dco", "inli", "b_", "import_", "Color", "Set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "colore", "dco", "inli", "b_", "._", "tests_", "._", "test\\u", "colors", "et_", "import_", "Moc", "k", "Color", "Map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ng", "ccc", "base_", "._", "address_", "import_", "Inva", "lid", "Address", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ng", "ccc", "base_", "._", "asset_", "import_", "Asset", "Definition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ng", "ccc", "base_", "._", "deterministic", "_", "import_", "DW", "alle", "t", "Address", "Manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Determini", "stic", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Determini", "stic", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "colormap_", "=_", "Moc", "k", "Color", "Map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "colormap_", "._", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "colors", "et", "0_", "=_", "Color", "Set_", "(_", "self_", "._", "colormap_", ",_", "[_", "''_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "colors", "et", "1_", "=_", "Color", "Set_", "(_", "self_", "._", "colormap_", ",_", "[_", "d_", "[_", "1_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "colors", "et", "1a", "lt_", "=_", "Color", "Set_", "(_", "self_", "._", "colormap_", ",_", "[_", "d_", "[_", "1_", "]_", ",_", "d_", "[_", "6_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "colors", "et", "2_", "=_", "Color", "Set_", "(_", "self_", "._", "colormap_", ",_", "[_", "d_", "[_", "2_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "colors", "et", "3_", "=_", "Color", "Set_", "(_", "self_", "._", "colormap_", ",_", "[_", "d_", "[_", "3_", "]_", ",_", "d_", "[_", "4_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "def", "1_", "=_", "{_", "'", "mon", "ike", "rs", "'_", ":_", "[_", "'", "test", "1", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "color", "\\u", "set", "'_", ":_", "self_", "._", "colors", "et", "1_", "._", "get", "\\u", "data_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unit", "'_", ":_", "10_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "asset", "1_", "=_", "Asset", "Definition_", "(_", "self_", "._", "colormap_", ",_", "self_", "._", "def", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "master", "\\u", "key_", "=_", "'", "265", "a1", "a0", "ad", "05", "e8", "2f", "a3", "21", "e3", "f6", "f6", "767", "679", "df", "0c", "685", "157", "9", "7e", "0e", "4e", "24", "be", "1a", "fc", "327", "2e", "e", "658", "ec", "5", "3c", "ec", "b6", "8", "3a", "b7", "6a", "837", "727", "334", "716", "1e1", "23", "fdd", "f5", "320", "cb", "bce", "884", "9", "b0", "a0", "055", "7b", "d1", "2c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "privkey_", "=_", "'", "5", "Kb", "8", "k", "Lf", "9", "zg", "WQ", "nog", "id", "DA", "7", "6", "Mz", "PL", "6", "Ts", "ZZ", "Y", "3", "6", "h", "WX", "Ms", "s", "Sz", "Ny", "d", "YX", "YB", "9", "KF", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pubkey_", "=_", "'", "1", "CC", "3", "X", "2g", "u", "5", "8d", "6", "w", "XU", "WM", "ff", "pu", "z", "N", "9", "JA", "f", "TU", "Wu", "4", "Kj", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dw", "\\u", "master", "\\u", "key", "'_", ":_", "self_", "._", "master", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dwa", "m", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "genesi", "s", "\\u", "color", "\\u", "sets", "'_", ":_", "[_", "self_", "._", "colors", "et", "1_", "._", "get", "\\u", "data_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "colors", "et", "2_", "._", "get", "\\u", "data_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "color", "\\u", "set\\u", "state", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "color", "\\u", "set", "'_", ":_", "self_", "._", "colors", "et", "0_", "._", "get", "\\u", "data_", "(_", ")_", ",_", "\"", "max", "\\u", "index", "\"_", ":_", "0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "color", "\\u", "set", "'_", ":_", "self_", "._", "colors", "et", "1_", "._", "get", "\\u", "data_", "(_", ")_", ",_", "\"", "max", "\\u", "index", "\"_", ":_", "3_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "color", "\\u", "set", "'_", ":_", "self_", "._", "colors", "et", "2_", "._", "get", "\\u", "data_", "(_", ")_", ",_", "\"", "max", "\\u", "index", "\"_", ":_", "2_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "addresse", "s", "'_", ":_", "[_", "{_", "'", "address", "\\u", "data", "'_", ":_", "self_", "._", "privkey_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "color", "\\u", "set", "'_", ":_", "self_", "._", "colors", "et", "1_", "._", "get", "\\u", "data_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "testn", "et", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "=_", "copy_", "._", "deepcopy_", "(_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "main", "dwa", "m_", "=_", "DW", "alle", "t", "Address", "Manager_", "(_", "self_", "._", "colormap_", ",_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Determini", "stic", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "init", "\\u", "new", "\\u", "wallet_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "c_", "[_", "'", "dw", "\\u", "master", "\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "c_", "[_", "'", "dwa", "m", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newd", "wam", "_", "=_", "DW", "alle", "t", "Address", "Manager_", "(_", "self_", "._", "colormap_", ",_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "newd", "wam", "_", "._", "init", "\\u", "new", "\\u", "wallet_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "self_", "._", "config_", "[_", "'", "dw", "\\u", "master", "\\u", "key", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "newd", "wam", "_", "._", "config_", "[_", "'", "dw", "\\u", "master", "\\u", "key", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "[_", "'", "addresse", "s", "'_", "]_", "[_", "0_", "]_", "[_", "'", "address", "\\u", "data", "'_", "]_", "=_", "'", "not", "real", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Enco", "ding", "Error_", ",_", "DW", "alle", "t", "Address", "Manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "colormap_", ",_", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Determini", "stic", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "new", "\\u", "address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "main", "dwa", "m_", "._", "get", "\\u", "new", "\\u", "address_", "(_", "self_", "._", "colors", "et", "2_", ")_", "._", "index_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "main", "dwa", "m_", "._", "get", "\\u", "new", "\\u", "address_", "(_", "self_", "._", "asset", "1_", ")_", "._", "index_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Determini", "stic", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "new", "\\u", "genesi", "s", "\\u", "address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "self_", "._", "main", "dwa", "m_", "._", "get", "\\u", "new", "\\u", "genesi", "s", "\\u", "address_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "addr_", "._", "index_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr", "2_", "=_", "self_", "._", "main", "dwa", "m_", "._", "get", "\\u", "new", "\\u", "address_", "(_", "addr_", "._", "get", "\\u", "color", "\\u", "set_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "addr", "2_", "._", "index_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Determini", "stic", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "update", "\\u", "genesi", "s", "\\u", "address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "self_", "._", "main", "dwa", "m_", "._", "get", "\\u", "genesi", "s", "\\u", "address_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "main", "dwa", "m_", "._", "update", "\\u", "genesi", "s", "\\u", "address_", "(_", "addr_", ",_", "self_", "._", "colors", "et", "1a", "lt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "addr_", "._", "get", "\\u", "color", "\\u", "set_", "(_", ")_", ",_", "self_", "._", "colors", "et", "1a", "lt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Determini", "stic", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "change", "\\u", "address_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "self_", "._", "main", "dwa", "m_", "._", "get", "\\u", "change", "\\u", "address_", "(_", "self_", "._", "colors", "et", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "addr_", "._", "get", "\\u", "color", "\\u", "set_", "(_", ")_", "._", "\\u\\u", "repr\\u\\u_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "colors", "et", "0_", "._", "\\u\\u", "repr\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "main", "dwa", "m_", "._", "get", "\\u", "change", "\\u", "address_", "(_", "self_", "._", "colors", "et", "3_", ")_", "._", "index_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Determini", "stic", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "all", "\\u", "addresses_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addrs_", "=_", "[_", "a_", "._", "get", "\\u", "address_", "(_", ")_", "for_", "a_", "in_", "self_", "._", "main", "dwa", "m_", "._", "get", "\\u", "all", "\\u", "add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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
VisTrails/VisTrails/vistrails/packages/RemoteQ/init.py
[ { "content": " def job_start(self, params):\n work_dir = params['working_directory']\n self.machine = self.get_machine()\n use_machine(self.machine)\n self.job = Subshell(\"remote\", params['command'], work_dir)\n self.job.run()\n ret = self.job._ret\n if ret:\n try:\n job_id = int(ret.split('\\n')[0])\n except ValueError:\n end_machine()\n raise ModuleError(self, \"Error submitting job: %s\" % ret)\n self.set_job_machine(params, self.machine)\n return params", "metadata": "root.RunJob.job_start", "header": "['class', 'RunJob', '(', 'RQModule', ')', ':', '___EOS___']", "index": 238 }, { "content": " def compute(self):\n machine = self.get_machine()\n if not self.has_input('command'):\n raise ModuleError(self, \"No command specified\")\n command = self.get_input('command').strip()\n working_directory = self.get_input('working_directory') \\\n if self.has_input('working_directory') else '.'\n if not self.has_input('input_directory'):\n raise ModuleError(self, \"No input directory specified\")\n input_directory = self.get_input('input_directory').strip()\n additional_arguments = {'processes': 1, 'time': -1, 'mpi': False,\n 'threads': 1, 'memory':-1, 'diskspace': -1}\n for k in additional_arguments:\n if self.has_input(k):\n additional_arguments[k] = self.get_input(k)\n ## This indicates that the coming commands submitted on the machine\n # trick to select machine without initializing every time\n\n use_machine(machine)\n cdir = CreateDirectory(\"remote\", working_directory)\n trans = TransferFiles(\"remote\", input_directory, working_directory,\n dependencies = [cdir])\n job = PBS(\"remote\", command, working_directory, dependencies = [trans],\n **additional_arguments)\n job.run()\n ret = job._ret\n if ret:\n try:\n job_id = int(ret)\n except ValueError:\n end_machine()\n raise ModuleError(self, \"Error submitting job: %s\" % ret)\n finished = job.finished()\n job_info = job.get_job_info()\n if job_info:\n self.annotate({'job_info': job.get_job_info()})\n if not finished:\n status = job.status()\n # try to get more detailed information about the job\n # this only seems to work on some versions of torque\n if job_info:\n comment = [line for line in job_info.split('\\n') if line.startswith('comment =')]\n if comment:\n status += ': ' + comment[10:]\n end_machine()\n # The PBS class provides the JobHandle interface, i.e. finished()\n raise ModuleSuspended(self, '%s' % status, handle=job)\n # copies the created files to the client\n get_result = TransferFiles(\"local\", input_directory, working_directory,\n dependencies = [cdir])\n get_result.run()\n ## Popping from the machine stack \n end_machine()\n self.set_output(\"stdout\", job.standard_output())\n self.set_output(\"stderr\", job.standard_error())\n files = machine.local.send_command(\"ls -l %s\" % input_directory)\n self.set_output(\"file_list\",\n [f.split(' ')[-1] for f in files.split('\\n')[1:]])", "metadata": "root.PBSJob.compute", "header": "['class', 'PBSJob', '(', 'RQModule', ')', ':', '___EOS___']", "index": 296 }, { "content": " def job_start(self, params):\n work_dir = params['working_directory']\n self.machine = self.get_machine()\n use_machine(self.machine)\n self.cdir = CreateDirectory(\"remote\", work_dir)\n trans = TransferFiles(\"remote\", params['input_directory'], work_dir,\n dependencies = [self.cdir])\n self.job = PBSScript(\"remote\", params['command'], work_dir,\n dependencies = [trans], **params['additional_arguments'])\n self.job.run()\n ret = self.job._ret\n if ret:\n try:\n job_id = int(ret.split('\\n')[0])\n except ValueError:\n end_machine()\n raise ModuleError(self, \"Error submitting job: %s\" % ret)\n self.set_job_machine(params, self.machine)\n return params", "metadata": "root.RunPBSScript.job_start", "header": "['class', 'RunPBSScript', '(', 'RQModule', ')', ':', '___EOS___']", "index": 394 }, { "content": " def compute(self):\n machine = self.get_machine()\n jm = self.job_monitor()\n cache = jm.getCache(self.signature)\n if not cache:\n if not self.has_input('local_directory'):\n raise ModuleError(self, \"No local directory specified\")\n local_directory = self.get_input('local_directory').strip()\n if not self.has_input('remote_directory'):\n raise ModuleError(self, \"No remote directory specified\")\n remote_directory = self.get_input('remote_directory').strip()\n whereto = 'remote'\n if self.has_input('to_local') and self.get_input('to_local'):\n whereto = 'local'\n use_machine(machine)\n to_dir = local_directory if whereto=='local' else remote_directory\n cdir = CreateDirectory(whereto, to_dir)\n job = TransferFiles(whereto, local_directory, remote_directory,\n dependencies = [cdir])\n job.run()\n end_machine()\n d = {}\n self.set_job_machine(d, machine)\n cache = jm.setCache(self.signature, d, self.job_name())\n\n self.set_output(\"machine\", machine)", "metadata": "root.SyncDirectories.compute", "header": "['class', 'SyncDirectories', '(', 'RQModule', ')', ':', '___EOS___']", "index": 451 }, { "content": "def handle_module_upgrade_request(controller, module_id, pipeline):\n # prepend 'hadoop|' to hadoop modules < 0.3.1\n reg = get_module_registry()\n\n hadoop_remaps = ['PythonSourceToFile', 'HDFSPut', 'HDFSGet',\n 'HDFSEnsureNew', 'URICreator', 'HadoopStreaming']\n\n module_remap = {}\n for name in hadoop_remaps:\n module_remap[name] = [(None, '0.3.0', \"hadoop|%s\" % name, {})]\n return UpgradeWorkflowHandler.remap_module(controller,\n module_id,\n pipeline,\n module_remap)", "metadata": "root.handle_module_upgrade_request", "header": "['module', '___EOS___']", "index": 521 } ]
[ { "span": "job_id ", "start_line": 247, "start_column": 16, "end_line": 247, "end_column": 22 }, { "span": "job_id ", "start_line": 324, "start_column": 16, "end_line": 324, "end_column": 22 }, { "span": "job_id ", "start_line": 407, "start_column": 16, "end_line": 407, "end_column": 22 }, { "span": "cache ", "start_line": 474, "start_column": 12, "end_line": 474, "end_column": 17 }, { "span": "reg ", "start_line": 523, "start_column": 4, "end_line": 523, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Run", "Job_", "(_", "RQ", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "job", "\\u", "start_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "work", "\\u", "dir_", "=_", "params_", "[_", "'", "working", "\\u", "director", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "machine_", "=_", "self_", "._", "get", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "machine_", "(_", "self_", "._", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "job_", "=_", "Subs", "hell", "_", "(_", "\"", "remote", "\"_", ",_", "params_", "[_", "'", "command", "'_", "]_", ",_", "work", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "job_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "job_", "._", "\\u", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", ":_", "\\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 ", " _", "job", "\\u", "id_", "=_", "int_", "(_", "ret_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "0_", "]_", ")_", "\\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 ", " _", "end", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Error", " ", "submit", "ting", " ", "job", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "job", "\\u", "machine_", "(_", "params_", ",_", "self_", "._", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PBS", "Job_", "(_", "RQ", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "machine_", "=_", "self_", "._", "get", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "command", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "No", " ", "command", " ", "specified", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "command", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "working", "\\u", "directory_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "working", "\\u", "director", "y", "'_", ")_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "working", "\\u", "director", "y", "'_", ")_", "else_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "input", "\\u", "director", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "No", " ", "input", " ", "director", "y", " ", "specified", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "\\u", "directory_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "input", "\\u", "director", "y", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addition", "al", "\\u", "arguments_", "=_", "{_", "'", "process", "es", "'_", ":_", "1_", ",_", "'", "time", "'_", ":_", "-_", "1_", ",_", "'", "mpi", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "thread", "s", "'_", ":_", "1_", ",_", "'", "memory", "'_", ":_", "-_", "1_", ",_", "'", "disks", "pace", "'_", ":_", "-_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "addition", "al", "\\u", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "input_", "(_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addition", "al", "\\u", "arguments_", "[_", "k_", "]_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "Thi", "s", " ", "indicat", "es", " ", "tha", "t", " ", "the", " ", "comi", "ng", " ", "command", "s", " ", "submitted", " ", "on", " ", "the", " ", "machine_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trick", " ", "to", " ", "select", " ", "machine", " ", "with", "out", " ", "initiali", "zin", "g", " ", "every", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "use", "\\u", "machine_", "(_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cdi", "r_", "=_", "Creat", "e", "Directory_", "(_", "\"", "remote", "\"_", ",_", "working", "\\u", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "=_", "Transfer", "Files_", "(_", "\"", "remote", "\"_", ",_", "input", "\\u", "directory_", ",_", "working", "\\u", "directory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dependencies_", "=_", "[_", "cdi", "r_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "PBS", "_", "(_", "\"", "remote", "\"_", ",_", "command_", ",_", "working", "\\u", "directory_", ",_", "dependencies_", "=_", "[_", "trans_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "addition", "al", "\\u", "arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "job_", "._", "\\u", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", ":_", "\\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 ", " _", "job", "\\u", "id_", "=_", "int_", "(_", "ret_", ")_", "\\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 ", " _", "end", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Error", " ", "submit", "ting", " ", "job", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finished_", "=_", "job_", "._", "finished_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "info_", "=_", "job_", "._", "get", "\\u", "job", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "job", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "annotate_", "(_", "{_", "'", "job", "\\u", "info", "'_", ":_", "job_", "._", "get", "\\u", "job", "\\u", "info_", "(_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "finished_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "job_", "._", "status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "get", " ", "more", " ", "detailed", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "job_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "only", " ", "see", "ms", " ", "to", " ", "work", " ", "on", " ", "some", " ", "version", "s", " ", "of", " ", "torque", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "job", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "comment_", "=_", "[_", "line_", "for_", "line_", "in_", "job", "\\u", "info_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "if_", "line_", "._", "startswith_", "(_", "'", "comment", " ", "='_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "comment_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "status_", "+=_", "':", " ", "'_", "+_", "comment_", "[_", "10_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "PBS", " ", "class", " ", "provide", "s", " ", "the", " ", "Jo", "b", "Handle", " ", "interface", ",", " ", "i", ".", "e", ".", " ", "finish", "ed", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "Modul", "e", "Suspend", "ed_", "(_", "self_", ",_", "'%", "s", "'_", "%_", "status_", ",_", "handle_", "=_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "copie", "s", " ", "the", " ", "created", " ", "files", " ", "to", " ", "the", " ", "client_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "\\u", "result_", "=_", "Transfer", "Files_", "(_", "\"", "local", "\"_", ",_", "input", "\\u", "directory_", ",_", "working", "\\u", "directory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dependencies_", "=_", "[_", "cdi", "r_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "result_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "Pop", "ping", " ", "from", " ", "the", " ", "machine", " ", "stack", " ", " ", " ", " ", " ", " ", " ", "_", "\\u\\u\\uNL\\u\\u\\u_", "end", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "stdout", "\"_", ",_", "job_", "._", "standard", "\\u", "output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "std", "err", "\"_", ",_", "job_", "._", "standard", "\\u", "error_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "machine_", "._", "local_", "._", "send", "\\u", "command_", "(_", "\"", "ls", " ", "-", "l", " ", "%", "s", "\"_", "%_", "input", "\\u", "directory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "file", "\\u", "list", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "f_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "-_", "1_", "]_", "for_", "f_", "in_", "files_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "1_", ":_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Run", "PBS", "Script_", "(_", "RQ", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "job", "\\u", "start_", "(_", "self_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "work", "\\u", "dir_", "=_", "params_", "[_", "'", "working", "\\u", "director", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "machine_", "=_", "self_", "._", "get", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "machine_", "(_", "self_", "._", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cdi", "r_", "=_", "Creat", "e", "Directory_", "(_", "\"", "remote", "\"_", ",_", "work", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trans_", "=_", "Transfer", "Files_", "(_", "\"", "remote", "\"_", ",_", "params_", "[_", "'", "input", "\\u", "director", "y", "'_", "]_", ",_", "work", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dependencies_", "=_", "[_", "self_", "._", "cdi", "r_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "job_", "=_", "PBS", "Script_", "(_", "\"", "remote", "\"_", ",_", "params_", "[_", "'", "command", "'_", "]_", ",_", "work", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dependencies_", "=_", "[_", "trans_", "]_", ",_", "**_", "params_", "[_", "'", "addition", "al", "\\u", "argu", "ment", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "job_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "self_", "._", "job_", "._", "\\u", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", ":_", "\\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 ", " _", "job", "\\u", "id_", "=_", "int_", "(_", "ret_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "0_", "]_", ")_", "\\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 ", " _", "end", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "Error", " ", "submit", "ting", " ", "job", ":", " ", "%", "s", "\"_", "%_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "job", "\\u", "machine_", "(_", "params_", ",_", "self_", "._", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sync", "Director", "ies_", "(_", "RQ", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "machine_", "=_", "self_", "._", "get", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jm", "_", "=_", "self_", "._", "job", "\\u", "monitor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "=_", "jm", "_", "._", "get", "Cache_", "(_", "self_", "._", "signature_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "local", "\\u", "director", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "No", " ", "local", " ", "director", "y", " ", "specified", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "local", "\\u", "directory_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "local", "\\u", "director", "y", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "remote", "\\u", "director", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "No", " ", "remote", " ", "director", "y", " ", "specified", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote", "\\u", "directory_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "remote", "\\u", "director", "y", "'_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "where", "to_", "=_", "'", "remote", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "to", "\\u", "local", "'_", ")_", "and_", "self_", "._", "get", "\\u", "input_", "(_", "'", "to", "\\u", "local", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "where", "to_", "=_", "'", "local", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "use", "\\u", "machine_", "(_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "dir_", "=_", "local", "\\u", "directory_", "if_", "where", "to_", "==_", "'", "local", "'_", "else_", "remote", "\\u", "directory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cdi", "r_", "=_", "Creat", "e", "Directory_", "(_", "where", "to_", ",_", "to", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "=_", "Transfer", "Files_", "(_", "where", "to_", ",_", "local", "\\u", "directory_", ",_", "remote", "\\u", "directory_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dependencies_", "=_", "[_", "cdi", "r_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "machine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "job", "\\u", "machine_", "(_", "d_", ",_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "=_", "jm", "_", "._", "set", "Cache_", "(_", "self_", "._", "signature_", ",_", "d_", ",_", "self_", "._", "job", "\\u", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "machine", "\"_", ",_", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "handle", "\\u", "module", "\\u", "upgrade", "\\u", "request_", "(_", "controller_", ",_", "module", "\\u", "id_", ",_", "pipeline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prepend", " ", "'", "hadoop", "|", "'", " ", "to", " ", "hadoop", " ", "module", "s", " ", "<", " ", "0.", "3.1", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "=_", "get", "\\u", "module", "\\u", "registry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hadoop", "\\u", "remap", "s_", "=_", "[_", "'", "Pyth", "on", "Sou", "rce", "To", "File", "'_", ",_", "'", "HDF", "SP", "ut", "'_", ",_", "'", "HDF", "SG", "et", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HDF", "SE", "nsu", "re", "New", "'_", ",_", "'", "URI", "Creat", "or", "'_", ",_", "'", "Had", "oop", "Stream", "ing", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "remap", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "hadoop", "\\u", "remap", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "\\u", "remap", "_", "[_", "name_", "]_", "=_", "[_", "(_", "None_", ",_", "'", "0.", "3.0", "'_", ",_", "\"", "hadoop", "|", "%", "s", "\"_", "%_", "name_", ",_", "{_", "}_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Upgrade", "Work", "flow", "Handler_", "._", "remap", "\\u", "module_", "(_", "controller_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pipeline_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "remap", "_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
sibson/vncdotool/tests/unit/mock.py
[ { "content": "# mock.py\n# Test tools for mocking and patching.\n# Copyright (C) 2007-2011 Michael Foord & the mock team\n# E-mail: fuzzyman AT voidspace DOT org DOT uk\n\n# mock 0.8.0\n# http://www.voidspace.org.uk/python/mock/\n\n# Released subject to the BSD License\n# Please see http://www.voidspace.org.uk/python/license.shtml\n\n# Scripts maintained at http://www.voidspace.org.uk/python/index.shtml\n# Comments, suggestions and bug reports welcome.\n\n\n__all__ = (\n 'Mock',\n 'MagicMock',\n 'mocksignature',\n 'patch',\n 'sentinel',\n 'DEFAULT',\n 'ANY',\n 'call',\n 'create_autospec',\n 'FILTER_DIR',\n)\n\n\n__version__ = '0.8.0alpha1'\n\n__unittest = True\n\n\nimport sys\n\ntry:\n import inspect\nexcept ImportError:\n # for alternative platforms that\n # may not have inspect\n inspect = None\n\ntry:\n BaseException\nexcept NameError:\n # Python 2.4 compatibility\n BaseException = Exception\n\ntry:\n from functools import wraps\nexcept ImportError:\n # Python 2.4 compatibility\n\ntry:\n unicode\nexcept NameError:\n # Python 3\n basestring = unicode = str\n\ntry:\n long\nexcept NameError:\n # Python 3\n long = int\n\ntry:\n _isidentifier = str.isidentifier\nexcept AttributeError:\n # Python 2.X\n import keyword\n import re\n regex = re.compile(r'^[a-z_][a-z0-9_]*$', re.I)\n\n\ninPy3k = sys.version_info[0] == 3\n\nself = 'im_self'\nbuiltin = '__builtin__'\nif inPy3k:\n self = '__self__'\n builtin = 'builtins'\n\n# hack for Python 3 :-)\n_super = super\n\nFILTER_DIR = True\n\n\n# getsignature and mocksignature heavily \"inspired\" by\n# the decorator module: http://pypi.python.org/pypi/decorator/\n# by Michele Simionato\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nsentinel = Sentinel()\n\nDEFAULT = sentinel.DEFAULT\n\n\nClassType = type(OldStyleClass)\n\n\n\n\nClassTypes = (type,)\nif not inPy3k:\n ClassTypes = (type, ClassType)\n\n_allowed_names = set(['return_value'])\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\npatch.object = _patch_object\npatch.dict = _patch_dict\n\n\n\n\n\n\n\n\nisolate.object = _isolate_object\n\n\nmagic_methods = (\n \"lt le gt ge eq ne \"\n \"getitem setitem delitem \"\n \"len contains iter \"\n \"hash str sizeof \"\n \"enter exit \"\n \"divmod neg pos abs invert \"\n \"complex int float index \"\n \"trunc floor ceil \"\n)\n\nnumerics = \"add sub mul div truediv floordiv mod lshift rshift and xor or pow \"\ninplace = ' '.join('i%s' % n for n in numerics.split())\nright = ' '.join('r%s' % n for n in numerics.split())\nextra = ''\nif inPy3k:\n extra = 'bool next '\nelse:\n extra = 'unicode long nonzero oct hex '\n# __truediv__ and __rtruediv__ not available in Python 3 either\n\n# not including __prepare__, __instancecheck__, __subclasscheck__\n# (as they are metaclass methods)\n# __del__ is not supported at all as it causes problems if it exists\n\n_non_defaults = set('__%s__' % method for method in [\n 'cmp', 'getslice', 'setslice', 'coerce', 'subclasses',\n 'format', 'get', 'set', 'delete', 'reversed',\n 'missing', 'reduce', 'reduce_ex', 'getinitargs',\n 'getnewargs', 'getstate', 'setstate', 'getformat',\n 'setformat', 'repr', 'dir'\n])\n\n\n\n\n_magics = set(\n '__%s__' % method for method in\n ' '.join([magic_methods, numerics, inplace, right, extra]).split()\n)\n\n_all_magics = _magics | _non_defaults\n\n_unsupported_magics = set([\n '__getattr__', '__setattr__',\n '__init__', '__new__', '__prepare__'\n '__instancecheck__', '__subclasscheck__',\n '__del__'\n])\n\n_calculate_return_value = {\n '__hash__': lambda self: object.__hash__(self),\n '__str__': lambda self: object.__str__(self),\n '__sizeof__': lambda self: object.__sizeof__(self),\n '__unicode__': lambda self: unicode(object.__str__(self)),\n}\n\n_side_effect_methods = {\n '__eq__': lambda self: lambda other: self is other,\n '__ne__': lambda self: lambda other: self is not other,\n}\n\n_return_values = {\n '__int__': 1,\n '__contains__': False,\n '__len__': 0,\n '__iter__': iter([]),\n '__exit__': False,\n '__complex__': 1j,\n '__float__': 1.0,\n '__bool__': True,\n '__nonzero__': True,\n '__oct__': '1',\n '__hex__': '0x1',\n '__long__': long(1),\n '__index__': 1,\n}\n\n\n\n\n_side_effect_methods = {\n '__eq__': _get_eq,\n '__ne__': _get_ne,\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nANY = _ANY()\n\n\n\n\ncall = _Call()\n\n\n\n\n\n\n\n\n\n\n\nFunctionTypes = (\n # python function\n type(create_autospec),\n # instance method\n type(ANY.__eq__),\n # unbound method\n type(_ANY.__eq__),\n)\n\nFunctionAttributes = set([\n 'func_closure',\n 'func_code',\n 'func_defaults',\n 'func_dict',\n 'func_globals',\n 'func_name',\n])\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _set_signature(mock, original, skipfirst):\n # creates a function with signature (*args, **kwargs) that delegates to a\n # mock. It still does signature checking by calling a lambda with the same\n # signature as the original. This is effectively mocksignature2.\n if not _callable(original):\n return\n\n skipfirst = isinstance(original, ClassTypes)\n result = _getsignature2(original, skipfirst)\n if result is None:\n # was a C function (e.g. object().__init__ ) that can't be mocked\n return\n\n signature, func = result\n\n src = \"lambda %s: None\" % signature\n context = {'_mock_': mock}\n checksig = eval(src, context)\n _copy_func_details(func, checksig)\n\n name = original.__name__\n import keyword\n if not _isidentifier(name):\n name = funcopy\n context = {'checksig': checksig, 'mock': mock}\n src = \"\"\"def %s(*args, **kwargs):\n checksig(*args, **kwargs)\n return mock(*args, **kwargs)\"\"\" % name\n exec (src, context)\n funcopy = context[name]\n _setup_func(funcopy, mock)\n return funcopy", "metadata": "root._set_signature", "header": "['module', '___EOS___']", "index": 201 } ]
[ { "span": "import keyword", "start_line": 222, "start_column": 4, "end_line": 222, "end_column": 18 } ]
[ { "span": "import keyword", "start_line": 77, "start_column": 4, "end_line": 77, "end_column": 18 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "mock", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tool", "s", " ", "for", " ", "mock", "ing", " ", "and", " ", "patch", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2007", "-", "2011", " ", "Mich", "ael", " ", "Foo", "rd", " ", "&", " ", "the", " ", "mock", " ", "team_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "E-", "mail", ":", " ", "fuzz", "yma", "n", " ", "AT", " ", "voi", "dsp", "ace", " ", "DOT", " ", "org", " ", "DOT", " ", "uk", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mock", " ", "0.", "8.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "voi", "dsp", "ace", ".", "org", ".", "uk", "/", "python", "/", "mock", "/_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Release", "d", " ", "subject", " ", "to", " ", "the", " ", "BS", "D", " ", "License", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ple", "ase", " ", "see", " ", "http", "://", "www", ".", "voi", "dsp", "ace", ".", "org", ".", "uk", "/", "python", "/", "license", ".", "sht", "ml_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Script", "s", " ", "maintain", "ed", " ", "at", " ", "http", "://", "www", ".", "voi", "dsp", "ace", ".", "org", ".", "uk", "/", "python", "/", "index", ".", "sht", "ml_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Comme", "nts", ",", " ", "suggestions", " ", "and", " ", "bug", " ", "report", "s", " ", "welcome", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mag", "ic", "Moc", "k", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mock", "signa", "ture", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "patch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sentinel", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DEF", "AUL", "T", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ANY", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "call", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "create", "\\u", "autos", "pec", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "FILTER", "\\u", "DIR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "0.", "8.0", "alpha", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "unittest_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "alternative", " ", "platform", "s", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "may", " ", "not", " ", "have", " ", "inspect_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inspect_", "=_", "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 ", " _", "Base", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.4", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base", "Exception_", "=_", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "functools_", "import_", "wraps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.4", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basestring_", "=_", "unicode_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long_", "=_", "int_", "\\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 ", " _", "\\u", "isi", "denti", "fier", "_", "=_", "str_", "._", "isi", "denti", "fier", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2", ".", "X_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "keyword_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regex_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "[", "a", "-", "z", "\\u]", "[", "a", "-", "z", "0", "-", "9", "\\u]*", "$'_", ",_", "re_", "._", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Py", "3", "k_", "=_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "=_", "'", "im", "\\u", "self", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builtin_", "=_", "'\\u", "\\u", "bui", "lti", "n", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "in", "Py", "3", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "'\\u", "\\u", "self", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builtin_", "=_", "'", "bui", "lti", "ns", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hack", " ", "for", " ", "Pyth", "on", " ", "3", " ", ":-", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "super_", "=_", "super_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FILTER", "\\u", "DIR_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gets", "ign", "ature", " ", "and", " ", "mock", "signa", "ture", " ", "heav", "il", "y", " ", "\"", "inspire", "d", "\"", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "decorat", "or", " ", "module", ":", " ", "http", "://", "pypi", ".", "python", ".", "org", "/", "pypi", "/", "decorat", "or", "/_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "Mich", "ele", " ", "Sim", "iona", "to_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "sentinel_", "=_", "Senti", "nel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEFAULT_", "=_", "sentinel_", "._", "DEFAULT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Class", "Type_", "=_", "type_", "(_", "Old", "Style", "Class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Class", "Types_", "=_", "(_", "type_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "in", "Py", "3", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Class", "Types_", "=_", "(_", "type_", ",_", "Class", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "allow", "ed", "\\u", "names_", "=_", "set_", "(_", "[_", "'", "return", "\\u", "value", "'_", "]_", ")_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "patch_", "._", "object_", "=_", "\\u", "patch", "\\u", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "._", "dict_", "=_", "\\u", "patch", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "isolate", "_", "._", "object_", "=_", "\\u", "isolate", "\\u", "object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "magic", "\\u", "methods_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lt", " ", "le", " ", "gt", " ", "ge", " ", "eq", " ", "ne", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "getitem", " ", "setitem", " ", "deli", "tem", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "len", " ", "contain", "s", " ", "iter", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hash", " ", "str", " ", "size", "of", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "enter", " ", "exit", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "div", "mod", " ", "neg", " ", "pos", " ", "abs", " ", "invert", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "complex", " ", "int", " ", "float", " ", "index", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "trunc", " ", "floor", " ", "ceil", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "numeri", "cs_", "=_", "\"", "add", " ", "sub", " ", "mul", " ", "div", " ", "true", "div", " ", "floor", "div", " ", "mod", " ", "lsh", "ift", " ", "rshi", "ft", " ", "and", " ", "xor", " ", "or", " ", "pow", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inplace_", "=_", "'", " ", "'_", "._", "join_", "(_", "'", "i", "%", "s", "'_", "%_", "n_", "for_", "n_", "in_", "numeri", "cs_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right_", "=_", "'", " ", "'_", "._", "join_", "(_", "'", "r", "%", "s", "'_", "%_", "n_", "for_", "n_", "in_", "numeri", "cs_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "in", "Py", "3", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra_", "=_", "'", "bool", " ", "next", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extra_", "=_", "'", "unicode", " ", "long", " ", "nonzero", " ", "oct", " ", "hex", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "\\u\\u", "true", "div", "\\u\\u", " ", "and", " ", "\\u\\u", "rtr", "ued", "iv", "\\u\\u", " ", "not", " ", "avail", "able", " ", "in", " ", "Pyth", "on", " ", "3", " ", "eit", "her_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "inclu", "ding", " ", "\\u\\u", "prepar", "e\\u", "\\u", ",", " ", "\\u\\u", "instance", "check", "\\u\\u", ",", " ", "\\u\\u", "subclass", "check", "\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "as", " ", "the", "y", " ", "are", " ", "metaclass", " ", "method", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u\\u", "del", "\\u\\u", " ", "is", " ", "not", " ", "support", "ed", " ", "at", " ", "all", " ", "as", " ", "it", " ", "caus", "es", " ", "problem", "s", " ", "if", " ", "it", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "non", "\\u", "defaults_", "=_", "set_", "(_", "'\\u", "\\u", "%", "s", "\\u\\u'_", "%_", "method_", "for_", "method_", "in_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cmp", "'_", ",_", "'", "gets", "lice", "'_", ",_", "'", "sets", "lice", "'_", ",_", "'", "coerce", "'_", ",_", "'", "subclasses", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format", "'_", ",_", "'", "get", "'_", ",_", "'", "set", "'_", ",_", "'", "delete", "'_", ",_", "'", "reverse", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "missi", "ng", "'_", ",_", "'", "reduce", "'_", ",_", "'", "reduce", "\\u", "ex", "'_", ",_", "'", "getin", "ita", "rg", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "getne", "war", "gs", "'_", ",_", "'", "getstate", "'_", ",_", "'", "setstate", "'_", ",_", "'", "getf", "ormat", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "setf", "ormat", "'_", ",_", "'", "repr", "'_", ",_", "'", "dir", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "magic", "s_", "=_", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "%", "s", "\\u\\u'_", "%_", "method_", "for_", "method_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "'_", "._", "join_", "(_", "[_", "magic", "\\u", "methods_", ",_", "numeri", "cs_", ",_", "inplace_", ",_", "right_", ",_", "extra_", "]_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "all", "\\u", "magic", "s_", "=_", "\\u", "magic", "s_", "|_", "\\u", "non", "\\u", "defaults_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "unsup", "porte", "d\\u", "magic", "s_", "=_", "set_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "getattr", "\\u\\u'_", ",_", "'\\u", "\\u", "setattr", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "init", "\\u\\u'_", ",_", "'\\u", "\\u", "new", "\\u\\u'_", ",_", "'\\u", "\\u", "prepar", "e\\u", "\\u'_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "instance", "check", "\\u\\u'_", ",_", "'\\u", "\\u", "subclass", "check", "\\u\\u'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "del", "\\u\\u'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "calcul", "ate", "\\u", "return", "\\u", "value_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "hash", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "object_", "._", "\\u\\u", "hash\\u\\u_", "(_", "self_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "str", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "object_", "._", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "size", "of", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "object_", "._", "\\u\\u", "size", "of", "\\u\\u_", "(_", "self_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "unicode", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "unicode_", "(_", "object_", "._", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "side", "\\u", "effect", "\\u", "methods_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "eq", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "lambda_", "other_", ":_", "self_", "is_", "other_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "ne", "\\u\\u'_", ":_", "lambda_", "self_", ":_", "lambda_", "other_", ":_", "self_", "is_", "not_", "other_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "return", "\\u", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "int\\u", "\\u'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "contain", "s", "\\u\\u'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "len", "\\u\\u'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "iter", "\\u\\u'_", ":_", "iter_", "(_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "exit", "\\u\\u'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "complex", "\\u\\u'_", ":_", "1j_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "float", "\\u\\u'_", ":_", "1.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "bool\\u", "\\u'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "nonzero\\u", "\\u'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "oct", "\\u\\u'_", ":_", "'", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "hex", "\\u\\u'_", ":_", "'", "0x1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "long", "\\u\\u'_", ":_", "long_", "(_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "index", "\\u\\u'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "side", "\\u", "effect", "\\u", "methods_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "eq", "\\u\\u'_", ":_", "\\u", "get", "\\u", "eq_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "\\u", "ne", "\\u\\u'_", ":_", "\\u", "get", "\\u", "ne_", ",_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ANY_", "=_", "\\u", "ANY_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "call_", "=_", "\\u", "Call_", "(_", ")_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Function", "Types_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "create", "\\u", "autospec_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instance", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "ANY_", "._", "\\u\\u", "eq\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unbound", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "(_", "\\u", "ANY_", "._", "\\u\\u", "eq\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Function", "Attributes_", "=_", "set_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "func", "\\u", "clos", "ure", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "func", "\\u", "code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "func", "\\u", "default", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "func", "\\u", "dict", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "func", "\\u", "globals", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "func", "\\u", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "signature_", "(_", "mock_", ",_", "original_", ",_", "skip", "first_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", "s", " ", "a", " ", "function", " ", "with", " ", "signa", "ture", " ", "(*", "args", ",", " ", "**", "kwarg", "s", ")", " ", "tha", "t", " ", "delegate", "s", " ", "to", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mock", ".", " ", "It", " ", "still", " ", "doe", "s", " ", "signa", "ture", " ", "checking", " ", "by", " ", "calling", " ", "a", " ", "lambda", " ", "with", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "signa", "ture", " ", "as", " ", "the", " ", "original", ".", " ", "Thi", "s", " ", "is", " ", "effective", "ly", " ", "mock", "signa", "ture", "2._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "\\u", "callable_", "(_", "original_", ")_", ":_", "\\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_", "skip", "first_", "=_", "isinstance_", "(_", "original_", ",_", "Class", "Types_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "\\u", "gets", "ign", "ature", "2_", "(_", "original_", ",_", "skip", "first_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "was", " ", "a", " ", "C", " ", "function", " ", "(", "e", ".", "g", ".", " ", "object", "()", ".\\u", "\\u", "init", "\\u\\u", " ", ")", " ", "tha", "t", " ", "can", "'", "t", " ", "be", " ", "mocked", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "signature_", ",_", "func_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "src_", "=_", "\"", "lambda", " ", "%", "s", ":", " ", "Non", "e", "\"_", "%_", "signature_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "{_", "'\\u", "mock", "\\u'_", ":_", "mock_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checks", "ig_", "=_", "eval_", "(_", "src_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "copy", "\\u", "func", "\\u", "details_", "(_", "func_", ",_", "checks", "ig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "original_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "keyword_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "isi", "denti", "fier", "_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "func", "opy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "{_", "'", "checks", "ig", "'_", ":_", "checks", "ig_", ",_", "'", "mock", "'_", ":_", "mock_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "=_", "\"\"\"", "def", " ", "%", "s", "(*", "args", ",", " ", "**", "kwarg", "s", "):", "\\", "10", ";", " ", " ", " ", " ", "checks", "ig", "(*", "args", ",", " ", "**", "kwarg", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "mock", "(*", "args", ",", " ", "**", "kwarg", "s", ")\"\"\"_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "src_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "func", "opy_", "=_", "context_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "setup", "\\u", "func_", "(_", "func", "opy_", ",_", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "func", "opy_", "\\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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
Debian/debile/debile/master/server.py
[ { "content": "def check_shutdown():\n with session() as s:\n shutdown = not s.query(exists().where(\n (Job.assigned_at != None) & (Job.finished_at == None))\n ).scalar()\n if shutdown:\n raise SystemExit(0)", "metadata": "root.check_shutdown", "header": "['module', '___EOS___']", "index": 41 } ]
[ { "span": "Job.finished_at == None)", "start_line": 44, "start_column": 41, "end_line": 44, "end_column": 64 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "\\u", "shutdown_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "session_", "(_", ")_", "as_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutdown_", "=_", "not_", "s_", "._", "query_", "(_", "exists_", "(_", ")_", "._", "where_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "Job_", "._", "assign", "ed", "\\u", "at_", "!=_", "None_", ")_", "&_", "(_", "Job_", "._", "finish", "ed", "\\u", "at_", "==_", "None_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "scalar_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutdown_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "System", "Exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
fp7-ofelia/ocf/vt_manager/src/python/vt_manager/communication/sfa/rspecs/.oldversions/ocfvtv1.py
[ { "content": "from copy import deepcopy\nfrom StringIO import StringIO\nfrom vt_manager.communication.sfa.util.xrn import Xrn\nfrom vt_manager.communication.sfa.rspecs.version import RSpecVersion\n#from vt_manager.communication.sfa.rspecs.versions.pgv2 import PGv2\n#from vt_manager.communication.sfa.rspecs.elements.versions.pgv2Link import PGv2Link\n#from vt_manager.communication.sfa.rspecs.elements.versions.pgv2Node import PGv2Node\n#from vt_manager.communication.sfa.rspecs.elements.versions.pgv2SliverType import PGv2SliverType\n\nfrom vt_manager.communication.sfa.rspecs.elements.versions.ocfvtNode import OcfVtNode\n \n\n\n\n\n \n\n\nif __name__ == '__main__':\n from vt_manager.communication.sfa.rspecs.rspec import RSpec\n from vt_manager.communication.sfa.rspecs.rspec_elements import *\n r = RSpec('/tmp/ocf.rspec')\n r.load_rspec_elements(OcfVt.elements)\n print r.get(RSpecElements.NODE)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class OcfVt(RSpecVersion):\n type = 'OcfVt'\n content_type = 'ad'\n version = '1'\n schema = '/opt/ofelia/vt_manager/src/python/vt_manager/communication/sfa/tests/vm_schema.xsd'#'http://www.protogeni.net/resources/rspec/2/ad.xsd'\n #namespace = 'http://www.protogeni.net/resources/rspec/2'\n namespace = None\n content = '*'\n extensions = {}\n namespaces = None #dict(extensions.items() + [('default', namespace)])\n\n # Networks\n\n # Nodes\n\n\n\n \n\n # Slivers\n \n\n\n\n\n\n\n\n # Links\n\n\n\n\n\n # Leases\n\n\n\n # Utility\n\n \n \n", "metadata": "root.OcfVt", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def get_networks(self):\n network_names = set()\n nodes = self.xml.xpath('//default:node[@component_manager_id] | //node[@component_manager_id]', namespaces=self.namespaces)\n for node in nodes:\n if 'component_manager_id' in node.attrib:\n network_urn = node.get('component_manager_id')\n if network_urn.startswith(\"urn:\"):\n network_hrn = Xrn(network_urn).get_hrn()\n else:\n # some component_manager_ids are hrns instead of urns??\n network_hrn = network_urn\n network_names.add(network_hrn)\n network_names = list(network_names)\n networks = [{\"name\": x} for x in network_names]\n return networks", "metadata": "root.OcfVt.get_networks", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 23 }, { "content": " def get_nodes(self, filter=None):\n return PGv2Node.get_nodes(self.xml, filter)", "metadata": "root.OcfVt.get_nodes", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 41 }, { "content": " def get_nodes_with_slivers(self):\n return OcfVtNode.get_nodes_with_slivers(self.xml)", "metadata": "root.OcfVt.get_nodes_with_slivers", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 44 }, { "content": " def add_nodes(self, nodes, check_for_dupes=False):\n return OcfVtNode.add_nodes(self.xml, nodes)", "metadata": "root.OcfVt.add_nodes", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 47 }, { "content": " def merge_node(self, source_node_tag):\n # this is untested\n self.xml.root.append(deepcopy(source_node_tag))", "metadata": "root.OcfVt.merge_node", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 50 }, { "content": " def get_sliver_attributes(self,node):\n\t#XXX:I will get node[slivers] and the node ids to get all the information to create a vm.\n\tattribs = dict()\n\tattribs.update({'slivers':node['slivers'],'component_id':node['component_id'],'component_name':node['component_name']})\n\n\n return attribs", "metadata": "root.OcfVt.get_sliver_attributes", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 56 }, { "content": " def get_slice_attributes(self, network=None):\n\tslice_attributes= list()\n nodes_with_slivers = self.get_nodes_with_slivers() #TODO: Ensure this method works\n #default_ns_prefix = self.namespaces['default']\n for node in nodes_with_slivers: #TODO: Ensure this method works\n sliver_attributes = self.get_sliver_attributes(node)\n\t slice_attributes.append(sliver_attributes)\n return slice_attributes", "metadata": "root.OcfVt.get_slice_attributes", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 64 }, { "content": " def attributes_list(self, elem):\n opts = []\n if elem is not None:\n for e in elem:\n opts.append((e.tag, str(e.text).strip(), e.attrib))\n return opts", "metadata": "root.OcfVt.attributes_list", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 73 }, { "content": " def get_default_sliver_attributes(self, network=None):\n return []", "metadata": "root.OcfVt.get_default_sliver_attributes", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 80 }, { "content": " def add_default_sliver_attribute(self, name, value, network=None):\n pass", "metadata": "root.OcfVt.add_default_sliver_attribute", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 83 }, { "content": " def add_slivers(self, hostnames, attributes=[], sliver_urn=None, append=False):\n # all nodes hould already be present in the rspec. Remove all\n # nodes that done have slivers\n for hostname in hostnames:\n node_elems = self.get_nodes({'component_id': '*%s*' % hostname})\n if not node_elems:\n continue\n node_elem = node_elems[0]\n \n # determine sliver types for this node\n valid_sliver_types = ['emulab-openvz', 'raw-pc', 'plab-vserver', 'plab-vnode']\n requested_sliver_type = None\n for sliver_type in node_elem.get('slivers', []):\n if sliver_type.get('type') in valid_sliver_types:\n requested_sliver_type = sliver_type['type']\n \n if not requested_sliver_type:\n continue\n sliver = {'type': requested_sliver_type,\n 'pl_tags': attributes}\n\n # remove available element\n for available_elem in node_elem.xpath('./default:available | ./available'):\n node_elem.remove(available_elem)\n \n # remove interface elements\n for interface_elem in node_elem.xpath('./default:interface | ./interface'):\n node_elem.remove(interface_elem)\n \n # remove existing sliver_type elements\n for sliver_type in node_elem.get('slivers', []):\n node_elem.element.remove(sliver_type.element)\n\n # set the client id\n node_elem.element.set('client_id', hostname)\n if sliver_urn:\n pass\n # TODO\n # set the sliver id\n #slice_id = sliver_info.get('slice_id', -1)\n #node_id = sliver_info.get('node_id', -1)\n #sliver_id = Xrn(xrn=sliver_urn, type='slice', id=str(node_id)).get_urn()\n #node_elem.set('sliver_id', sliver_id)\n\n # add the sliver type elemnt \n PGv2SliverType.add_slivers(node_elem.element, sliver) \n\n # remove all nodes without slivers\n if not append:\n for node_elem in self.get_nodes():\n if not node_elem['client_id']:\n parent = node_elem.element.getparent()\n parent.remove(node_elem.element)", "metadata": "root.OcfVt.add_slivers", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 86 }, { "content": " def remove_slivers(self, slivers, network=None, no_dupes=False):\n PGv2Node.remove_slivers(self.xml, slivers) ", "metadata": "root.OcfVt.remove_slivers", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 140 }, { "content": " def get_links(self, network=None):\n return PGv2Link.get_links(self.xml)", "metadata": "root.OcfVt.get_links", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 145 }, { "content": " def get_link_requests(self):\n return PGv2Link.get_link_requests(self.xml) ", "metadata": "root.OcfVt.get_link_requests", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 148 }, { "content": " def add_links(self, links):\n PGv2Link.add_links(self.xml.root, links)", "metadata": "root.OcfVt.add_links", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 151 }, { "content": " def add_link_requests(self, link_tuples, append=False):\n PGv2Link.add_link_requests(self.xml.root, link_tuples, append)", "metadata": "root.OcfVt.add_link_requests", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 154 }, { "content": " def get_leases(self, filter=None):\n pass", "metadata": "root.OcfVt.get_leases", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 159 }, { "content": " def add_leases(self, leases, network = None, no_dupes=False):\n pass", "metadata": "root.OcfVt.add_leases", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 162 }, { "content": " def merge(self, in_rspec):\n \"\"\"\n Merge contents for specified rspec with current rspec\n \"\"\"\n from vt_manager.communication.sfa.rspecs.rspec import RSpec\n # just copy over all the child elements under the root element\n if isinstance(in_rspec, basestring):\n in_rspec = RSpec(in_rspec)\n\n nodes = in_rspec.version.get_nodes()\n # protogeni rspecs need to advertise the availabel sliver types\n for node in nodes:\n if not node.has_key('sliver') or not node['sliver']:\n node['sliver'] = {'name': 'plab-vserver'}\n \n self.add_nodes(nodes)\n self.add_links(in_rspec.version.get_links())\n \n #\n #rspec = RSpec(in_rspec)\n #for child in rspec.xml.iterchildren():\n # self.xml.root.append(child)", "metadata": "root.OcfVt.merge", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 167 }, { "content": " def cleanup(self):\n # remove unncecessary elements, attributes\n if self.type in ['request', 'manifest']:\n # remove 'available' element from remaining node elements\n self.xml.remove_element('//default:available | //available')", "metadata": "root.OcfVt.cleanup", "header": "['class', 'OcfVt', '(', 'RSpecVersion', ')', ':', '___EOS___']", "index": 192 }, { "content": "class OcfVtAd(OcfVt):\n enabled = True\n content_type = 'ad'\n schema = '/opt/ofelia/vt_manager/src/python/vt_manager/communication/sfa/tests/vm_schema.xsd'#'http://www.protogeni.net/resources/rspec/2/ad.xsd'\n template = '<rspec type=\"advertisement\" xmlns=\"http://www.protogeni.net/resources/rspec/2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.protogeni.net/resources/rspec/2 http://www.protogeni.net/resources/rspec/2/ad.xsd /opt/ofelia/vt_manager/src/python/vt_manager/communication/sfa/tests/vm_schema.xsd\"/>'", "metadata": "root.OcfVtAd", "header": "['module', '___EOS___']", "index": 198 }, { "content": "class OcfVtRequest(OcfVt):\n enabled = True\n content_type = 'request'\n schema = '/opt/ofelia/vt_manager/src/python/vt_manager/communication/sfa/tests/vm_schema.xsd'#'http://www.protogeni.net/resources/rspec/2/ad.xsd'\n template = '<rspec type=\"advertisement\" xmlns=\"http://www.protogeni.net/resources/rspec/2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.protogeni.net/resources/rspec/2 http://www.protogeni.net/resources/rspec/2/ad.xsd /opt/ofelia/vt_manager/src/python/vt_manager/communication/sfa/tests/vm_schema.xsd\"/>'\n\n #schema = 'http://www.protogeni.net/resources/rspec/2/request.xsd'\n #template = '<rspec type=\"request\" xmlns=\"http://www.protogeni.net/resources/rspec/2\" xmlns:flack=\"http://www.protogeni.net/resources/rspec/ext/flack/1\" xmlns:plos=\"http://www.planet-lab.org/resources/sfa/ext/plos/1\" xmlns:planetlab=\"http://www.planet-lab.org/resources/sfa/ext/planetlab/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.protogeni.net/resources/rspec/2 http://www.protogeni.net/resources/rspec/2/request.xsd http://www.planet-lab.org/resources/sfa/ext/planetlab/1 http://www.planet-lab.org/resources/sfa/ext/planetlab/1/planetlab.xsd http://www.planet-lab.org/resources/sfa/ext/plos/1 http://www.planet-lab.org/resources/sfa/ext/plos/1/plos.xsd\"/>'", "metadata": "root.OcfVtRequest", "header": "['module', '___EOS___']", "index": 204 }, { "content": "class OcfVtManifest(OcfVt):\n enabled = True\n content_type = 'manifest'\n schema = 'http://www.protogeni.net/resources/rspec/2/manifest.xsd'\n template = '<rspec type=\"manifest\" xmlns=\"http://www.protogeni.net/resources/rspec/2\" xmlns:plos=\"http://www.planet-lab.org/resources/sfa/ext/plos/1\" xmlns:flack=\"http://www.protogeni.net/resources/rspec/ext/flack/1\" xmlns:planetlab=\"http://www.planet-lab.org/resources/sfa/ext/planetlab/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.protogeni.net/resources/rspec/2 http://www.protogeni.net/resources/rspec/2/manifest.xsd http://www.planet-lab.org/resources/sfa/ext/planetlab/1 http://www.planet-lab.org/resources/sfa/ext/planetlab/1/planetlab.xsd http://www.planet-lab.org/resources/sfa/ext/plos/1 http://www.planet-lab.org/resources/sfa/ext/plos/1/plos.xsd\"/>'", "metadata": "root.OcfVtManifest", "header": "['module', '___EOS___']", "index": 213 } ]
[ { "span": "from StringIO import StringIO", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vt", "\\u", "manager_", "._", "communication", "_", "._", "sfa", "_", "._", "util_", "._", "xr", "n_", "import_", "Xr", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vt", "\\u", "manager_", "._", "communication", "_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "version_", "import_", "RS", "pec", "Version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "vt", "\\u", "manage", "r", ".", "communication", ".", "sfa", ".", "rsp", "ecs", ".", "version", "s", ".", "pg", "v2", " ", "import", " ", "PG", "v2_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "vt", "\\u", "manage", "r", ".", "communication", ".", "sfa", ".", "rsp", "ecs", ".", "element", "s", ".", "version", "s", ".", "pg", "v2", "Link", " ", "import", " ", "PG", "v2", "Link_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "vt", "\\u", "manage", "r", ".", "communication", ".", "sfa", ".", "rsp", "ecs", ".", "element", "s", ".", "version", "s", ".", "pg", "v2", "Node", " ", "import", " ", "PG", "v2", "Node_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "vt", "\\u", "manage", "r", ".", "communication", ".", "sfa", ".", "rsp", "ecs", ".", "element", "s", ".", "version", "s", ".", "pg", "v2", "Sli", "ver", "Type", " ", "import", " ", "PG", "v2", "Sli", "ver", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "vt", "\\u", "manager_", "._", "communication", "_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "elements_", "._", "versions_", "._", "oc", "fv", "t", "Node_", "import_", "Oc", "f", "Vt", "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_", "\\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\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "vt", "\\u", "manager_", "._", "communication", "_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "rsp", "ec_", "import_", "RS", "pec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vt", "\\u", "manager_", "._", "communication", "_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "rsp", "ec", "\\u", "elements_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "RS", "pec_", "(_", "'/", "tmp", "/", "oc", "f", ".", "rsp", "ec", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "._", "load", "\\u", "rsp", "ec", "\\u", "elements_", "(_", "Oc", "f", "Vt", "_", "._", "elements_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "r_", "._", "get_", "(_", "RS", "pec", "Elements_", "._", "NODE_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "type_", "=_", "'", "Oc", "f", "Vt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "'", "ad", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "'", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "'/", "opt", "/", "of", "eli", "a", "/", "vt", "\\u", "manage", "r", "/", "src", "/", "python", "/", "vt", "\\u", "manage", "r", "/", "communication", "/", "sfa", "/", "tests", "/", "vm", "\\u", "schema", ".", "xsd", "'_", "#'", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "/", "ad", ".", "xsd", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "namespace", " ", "=", " ", "'", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "'_", "\\u\\u\\uNL\\u\\u\\u_", "namespace_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "'*'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extensions_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "namespaces_", "=_", "None_", "#", "dict", "(", "extensi", "ons", ".", "items", "()", " ", "+", " ", "[(", "'", "default", "',", " ", "namespace", ")])", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Network", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nodes_", "\\u\\u\\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_", "#", " ", "Sli", "vers_", "\\u\\u\\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_", "#", " ", "Links_", "\\u\\u\\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_", "#", " ", "Leas", "es_", "\\u\\u\\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_", "#", " ", "Utility_", "\\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_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "networks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "names_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes_", "=_", "self_", "._", "xml_", "._", "xpath_", "(_", "'//", "default", ":", "node", "[", "@", "component", "\\u", "manage", "r", "\\u", "id", "]", " ", "|", " ", "//", "node", "[", "@", "component", "\\u", "manage", "r", "\\u", "id", "]'_", ",_", "namespaces_", "=_", "self_", "._", "namespaces_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "component", "\\u", "manage", "r", "\\u", "id", "'_", "in_", "node_", "._", "attrib_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "urn_", "=_", "node_", "._", "get_", "(_", "'", "component", "\\u", "manage", "r", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "network", "\\u", "urn_", "._", "startswith_", "(_", "\"", "urn", ":\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "network", "\\u", "hr", "n_", "=_", "Xr", "n_", "(_", "network", "\\u", "urn_", ")_", "._", "get", "\\u", "hr", "n_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "some", " ", "component", "\\u", "manage", "r", "\\u", "ids", " ", "are", " ", "hr", "ns", " ", "inst", "ead", " ", "of", " ", "urn", "s", "??", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "network", "\\u", "hr", "n_", "=_", "network", "\\u", "urn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "network", "\\u", "names_", "._", "add_", "(_", "network", "\\u", "hr", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "network", "\\u", "names_", "=_", "list_", "(_", "network", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "[_", "{_", "\"", "name", "\"_", ":_", "x_", "}_", "for_", "x_", "in_", "network", "\\u", "names_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "networks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "nodes_", "(_", "self_", ",_", "filter_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "PG", "v2", "Node_", "._", "get", "\\u", "nodes_", "(_", "self_", "._", "xml_", ",_", "filter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "nodes", "\\u", "with", "\\u", "sli", "vers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Oc", "f", "Vt", "Node_", "._", "get", "\\u", "nodes", "\\u", "with", "\\u", "sli", "vers_", "(_", "self_", "._", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "nodes_", "(_", "self_", ",_", "nodes_", ",_", "check", "\\u", "for", "\\u", "dupe", "s_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Oc", "f", "Vt", "Node_", "._", "add", "\\u", "nodes_", "(_", "self_", "._", "xml_", ",_", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge", "\\u", "node_", "(_", "self_", ",_", "source", "\\u", "node", "\\u", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "unt", "este", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xml_", "._", "root_", "._", "append_", "(_", "deepcopy_", "(_", "source", "\\u", "node", "\\u", "tag_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "sli", "ver", "\\u", "attributes_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "XX", "X", ":", "I", " ", "will", " ", "get", " ", "node", "[", "sli", "vers", "]", " ", "and", " ", "the", " ", "node", " ", "ids", " ", "to", " ", "get", " ", "all", " ", "the", " ", "informati", "on", " ", "to", " ", "create", " ", "a", " ", "vm", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "attribs_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attribs_", "._", "update_", "(_", "{_", "'", "sli", "vers", "'_", ":_", "node_", "[_", "'", "sli", "vers", "'_", "]_", ",_", "'", "component", "\\u", "id", "'_", ":_", "node_", "[_", "'", "component", "\\u", "id", "'_", "]_", ",_", "'", "component", "\\u", "name", "'_", ":_", "node_", "[_", "'", "component", "\\u", "name", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "attribs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "slice", "\\u", "attributes_", "(_", "self_", ",_", "network_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "slice", "\\u", "attributes_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes", "\\u", "with", "\\u", "sli", "vers_", "=_", "self_", "._", "get", "\\u", "nodes", "\\u", "with", "\\u", "sli", "vers_", "(_", ")_", "#", "TOD", "O", ":", " ", "Ensur", "e", " ", "this", " ", "method", " ", "works_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "default", "\\u", "ns", "\\u", "prefix", " ", "=", " ", "self", ".", "namespace", "s", "['", "default", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node_", "in_", "nodes", "\\u", "with", "\\u", "sli", "vers_", ":_", "#", "TOD", "O", ":", " ", "Ensur", "e", " ", "this", " ", "method", " ", "works_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sli", "ver", "\\u", "attributes_", "=_", "self_", "._", "get", "\\u", "sli", "ver", "\\u", "attributes_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slice", "\\u", "attributes_", "._", "append_", "(_", "sli", "ver", "\\u", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "slice", "\\u", "attributes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "attribute", "s", "\\u", "list_", "(_", "self_", ",_", "elem_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "elem_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "e_", "in_", "elem_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opts_", "._", "append_", "(_", "(_", "e_", "._", "tag_", ",_", "str_", "(_", "e_", "._", "text_", ")_", "._", "strip_", "(_", ")_", ",_", "e_", "._", "attrib_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "default", "\\u", "sli", "ver", "\\u", "attributes_", "(_", "self_", ",_", "network_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "default", "\\u", "sli", "ver", "\\u", "attribute_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "network_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "sli", "vers_", "(_", "self_", ",_", "hostnames", "_", ",_", "attributes_", "=_", "[_", "]_", ",_", "sli", "ver", "\\u", "urn_", "=_", "None_", ",_", "append_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "all", " ", "nodes", " ", "hou", "ld", " ", "alr", "ead", "y", " ", "be", " ", "presen", "t", " ", "in", " ", "the", " ", "rsp", "ec", ".", " ", "Remove", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nodes", " ", "tha", "t", " ", "don", "e", " ", "have", " ", "sli", "vers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "hostname_", "in_", "hostnames", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "\\u", "elems_", "=_", "self_", "._", "get", "\\u", "nodes_", "(_", "{_", "'", "component", "\\u", "id", "'_", ":_", "'*", "%", "s", "*'_", "%_", "hostname_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "node", "\\u", "elems_", ":_", "\\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_", "node", "\\u", "elem_", "=_", "node", "\\u", "elems_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dete", "rmin", "e", " ", "sli", "ver", " ", "types", " ", "for", " ", "this", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "sli", "ver", "\\u", "types_", "=_", "[_", "'", "emu", "lab", "-", "openv", "z", "'_", ",_", "'", "raw", "-", "pc", "'_", ",_", "'", "pla", "b", "-", "vserver", "'_", ",_", "'", "pla", "b", "-", "vn", "ode", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "ed", "\\u", "sli", "ver", "\\u", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sli", "ver", "\\u", "type_", "in_", "node", "\\u", "elem_", "._", "get_", "(_", "'", "sli", "vers", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sli", "ver", "\\u", "type_", "._", "get_", "(_", "'", "type", "'_", ")_", "in_", "valid", "\\u", "sli", "ver", "\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "request", "ed", "\\u", "sli", "ver", "\\u", "type_", "=_", "sli", "ver", "\\u", "type_", "[_", "'", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "request", "ed", "\\u", "sli", "ver", "\\u", "type_", ":_", "\\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_", "sli", "ver_", "=_", "{_", "'", "type", "'_", ":_", "request", "ed", "\\u", "sli", "ver", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pl", "\\u", "tags", "'_", ":_", "attributes_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "avail", "able", " ", "element_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "avail", "able", "\\u", "elem_", "in_", "node", "\\u", "elem_", "._", "xpath_", "(_", "'./", "default", ":", "avail", "able", " ", "|", " ", "./", "avail", "able", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "\\u", "elem_", "._", "remove_", "(_", "avail", "able", "\\u", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "interface", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "interface", "\\u", "elem_", "in_", "node", "\\u", "elem_", "._", "xpath_", "(_", "'./", "default", ":", "interface", " ", "|", " ", "./", "interface", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "\\u", "elem_", "._", "remove_", "(_", "interface", "\\u", "elem_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "exist", "ing", " ", "sli", "ver", "\\u", "type", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sli", "ver", "\\u", "type_", "in_", "node", "\\u", "elem_", "._", "get_", "(_", "'", "sli", "vers", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "\\u", "elem_", "._", "element_", "._", "remove_", "(_", "sli", "ver", "\\u", "type_", "._", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "client", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node", "\\u", "elem_", "._", "element_", "._", "set_", "(_", "'", "client", "\\u", "id", "'_", ",_", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sli", "ver", "\\u", "urn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "the", " ", "sli", "ver", " ", "id_", "\\u\\u\\uNL\\u\\u\\u_", "#", "slice", "\\u", "id", " ", "=", " ", "sli", "ver", "\\u", "info", ".", "get", "('", "slice", "\\u", "id", "',", " ", "-1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "node", "\\u", "id", " ", "=", " ", "sli", "ver", "\\u", "info", ".", "get", "('", "node", "\\u", "id", "',", " ", "-1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "sli", "ver", "\\u", "id", " ", "=", " ", "Xr", "n", "(", "xr", "n", "=", "sli", "ver", "\\u", "urn", ",", " ", "type", "='", "slice", "',", " ", "id", "=", "str", "(", "node", "\\u", "id", "))", ".", "get", "\\u", "urn", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "node", "\\u", "elem", ".", "set", "('", "sli", "ver", "\\u", "id", "',", " ", "sli", "ver", "\\u", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "the", " ", "sli", "ver", " ", "type", " ", "elem", "nt", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "PG", "v2", "Sli", "ver", "Type_", "._", "add", "\\u", "sli", "vers_", "(_", "node", "\\u", "elem_", "._", "element_", ",_", "sli", "ver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "all", " ", "nodes", " ", "with", "out", " ", "sli", "vers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "append_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "\\u", "elem_", "in_", "self_", "._", "get", "\\u", "nodes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "node", "\\u", "elem_", "[_", "'", "client", "\\u", "id", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "parent_", "=_", "node", "\\u", "elem_", "._", "element_", "._", "getpar", "ent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "remove_", "(_", "node", "\\u", "elem_", "._", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\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_", "remove", "\\u", "sli", "vers_", "(_", "self_", ",_", "sli", "vers_", ",_", "network_", "=_", "None_", ",_", "no", "\\u", "dupe", "s_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PG", "v2", "Node_", "._", "remove", "\\u", "sli", "vers_", "(_", "self_", "._", "xml_", ",_", "sli", "vers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "links_", "(_", "self_", ",_", "network_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "PG", "v2", "Link_", "._", "get", "\\u", "links_", "(_", "self_", "._", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "link", "\\u", "requests_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "PG", "v2", "Link_", "._", "get", "\\u", "link", "\\u", "requests_", "(_", "self_", "._", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "links_", "(_", "self_", ",_", "links_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PG", "v2", "Link_", "._", "add", "\\u", "links_", "(_", "self_", "._", "xml_", "._", "root_", ",_", "links_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "link", "\\u", "requests_", "(_", "self_", ",_", "link", "\\u", "tuples_", ",_", "append_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PG", "v2", "Link_", "._", "add", "\\u", "link", "\\u", "requests_", "(_", "self_", "._", "xml_", "._", "root_", ",_", "link", "\\u", "tuples_", ",_", "append_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "lease", "s_", "(_", "self_", ",_", "filter_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "lease", "s_", "(_", "self_", ",_", "lease", "s_", ",_", "network_", "=_", "None_", ",_", "no", "\\u", "dupe", "s_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge_", "(_", "self_", ",_", "in", "\\u", "rsp", "ec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Merge", " ", "content", "s", " ", "for", " ", "specified", " ", "rsp", "ec", " ", "with", " ", "current", " ", "rsp", "ec", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vt", "\\u", "manager_", "._", "communication", "_", "._", "sfa", "_", "._", "rsp", "ecs_", "._", "rsp", "ec_", "import_", "RS", "pec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "just", " ", "copy", " ", "over", " ", "all", " ", "the", " ", "child", " ", "element", "s", " ", "under", " ", "the", " ", "root", " ", "element_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "in", "\\u", "rsp", "ec_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "\\u", "rsp", "ec_", "=_", "RS", "pec_", "(_", "in", "\\u", "rsp", "ec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nodes_", "=_", "in", "\\u", "rsp", "ec_", "._", "version_", "._", "get", "\\u", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "proto", "geni", " ", "rsp", "ecs", " ", "need", " ", "to", " ", "advertise", " ", "the", " ", "avail", "abel", " ", "sli", "ver", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node_", "in_", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "node_", "._", "has", "\\u", "key_", "(_", "'", "sli", "ver", "'_", ")_", "or_", "not_", "node_", "[_", "'", "sli", "ver", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "[_", "'", "sli", "ver", "'_", "]_", "=_", "{_", "'", "name", "'_", ":_", "'", "pla", "b", "-", "vserver", "'_", "}_", "\\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_", "._", "add", "\\u", "nodes_", "(_", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "links_", "(_", "in", "\\u", "rsp", "ec_", "._", "version_", "._", "get", "\\u", "links_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "rsp", "ec", " ", "=", " ", "RS", "pec", "(", "in", "\\u", "rsp", "ec", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "child", " ", "in", " ", "rsp", "ec", ".", "xml", ".", "iter", "child", "ren", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "xml", ".", "root", ".", "append", "(", "child", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Oc", "f", "Vt", "_", "(_", "RS", "pec", "Version_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cleanup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "unn", "cec", "essa", "ry", " ", "element", "s", ",", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "type_", "in_", "[_", "'", "request", "'_", ",_", "'", "manifest", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "'", "avail", "able", "'", " ", "element", " ", "from", " ", "rema", "inin", "g", " ", "node", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "xml_", "._", "remove", "\\u", "element_", "(_", "'//", "default", ":", "avail", "able", " ", "|", " ", "//", "avail", "able", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Oc", "f", "Vt", "Ad", "_", "(_", "Oc", "f", "Vt", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "'", "ad", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "'/", "opt", "/", "of", "eli", "a", "/", "vt", "\\u", "manage", "r", "/", "src", "/", "python", "/", "vt", "\\u", "manage", "r", "/", "communication", "/", "sfa", "/", "tests", "/", "vm", "\\u", "schema", ".", "xsd", "'_", "#'", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "/", "ad", ".", "xsd", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "'<", "rsp", "ec", " ", "type", "=\"", "advertise", "ment", "\"", " ", "xml", "ns", "=\"", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "\"", " ", "xml", "ns", ":", "xsi", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "-", "instance", "\"", " ", "xsi", ":", "schema", "Locat", "ion", "=\"", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", " ", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "/", "ad", ".", "xsd", " ", "/", "opt", "/", "of", "eli", "a", "/", "vt", "\\u", "manage", "r", "/", "src", "/", "python", "/", "vt", "\\u", "manage", "r", "/", "communication", "/", "sfa", "/", "tests", "/", "vm", "\\u", "schema", ".", "xsd", "\"/>'_", "\\u\\u\\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_", "Oc", "f", "Vt", "Request_", "(_", "Oc", "f", "Vt", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "'", "request", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "'/", "opt", "/", "of", "eli", "a", "/", "vt", "\\u", "manage", "r", "/", "src", "/", "python", "/", "vt", "\\u", "manage", "r", "/", "communication", "/", "sfa", "/", "tests", "/", "vm", "\\u", "schema", ".", "xsd", "'_", "#'", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "/", "ad", ".", "xsd", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "'<", "rsp", "ec", " ", "type", "=\"", "advertise", "ment", "\"", " ", "xml", "ns", "=\"", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "\"", " ", "xml", "ns", ":", "xsi", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "-", "instance", "\"", " ", "xsi", ":", "schema", "Locat", "ion", "=\"", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", " ", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "/", "ad", ".", "xsd", " ", "/", "opt", "/", "of", "eli", "a", "/", "vt", "\\u", "manage", "r", "/", "src", "/", "python", "/", "vt", "\\u", "manage", "r", "/", "communication", "/", "sfa", "/", "tests", "/", "vm", "\\u", "schema", ".", "xsd", "\"/>'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "schema", " ", "=", " ", "'", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "/", "request", ".", "xsd", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "template", " ", "=", " ", "'<", "rsp", "ec", " ", "type", "=\"", "request", "\"", " ", "xml", "ns", "=\"", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "\"", " ", "xml", "ns", ":", "flac", "k", "=\"", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "ext", "/", "flac", "k", "/", "1", "\"", " ", "xml", "ns", ":", "plo", "s", "=\"", "http", "://", "www", ".", "planet", "-", "lab", ".", "org", "/", "resource", "s", "/", "sfa", "/", "ext", "/", "plo", "s", "/", "1", "\"", " ", "xml", "ns", ":", "planet", "lab", "=\"", "http", "://", "www", ".", "planet", "-", "lab", ".", "org", "/", "resource", "s", "/", "sfa", "/", "ext", "/", "planet", "lab", "/", "1", "\"", " ", "xml", "ns", ":", "xsi", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "-", "instance", "\"", " ", "xsi", ":", "schema", "Locat", "ion", "=\"", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", " ", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "/", "request", ".", "xsd", " ", "http", "://", "www", ".", "planet", "-", "lab", ".", "org", "/", "resource", "s", "/", "sfa", "/", "ext", "/", "planet", "lab", "/", "1", " ", "http", "://", "www", ".", "planet", "-", "lab", ".", "org", "/", "resource", "s", "/", "sfa", "/", "ext", "/", "planet", "lab", "/", "1", "/", "planet", "lab", ".", "xsd", " ", "http", "://", "www", ".", "planet", "-", "lab", ".", "org", "/", "resource", "s", "/", "sfa", "/", "ext", "/", "plo", "s", "/", "1", " ", "http", "://", "www", ".", "planet", "-", "lab", ".", "org", "/", "resource", "s", "/", "sfa", "/", "ext", "/", "plo", "s", "/", "1", "/", "plo", "s", ".", "xsd", "\"/>'_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Oc", "f", "Vt", "Manifest", "_", "(_", "Oc", "f", "Vt", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "'", "manifest", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "'", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "/", "manifest", ".", "xsd", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "'<", "rsp", "ec", " ", "type", "=\"", "manifest", "\"", " ", "xml", "ns", "=\"", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "\"", " ", "xml", "ns", ":", "plo", "s", "=\"", "http", "://", "www", ".", "planet", "-", "lab", ".", "org", "/", "resource", "s", "/", "sfa", "/", "ext", "/", "plo", "s", "/", "1", "\"", " ", "xml", "ns", ":", "flac", "k", "=\"", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "ext", "/", "flac", "k", "/", "1", "\"", " ", "xml", "ns", ":", "planet", "lab", "=\"", "http", "://", "www", ".", "planet", "-", "lab", ".", "org", "/", "resource", "s", "/", "sfa", "/", "ext", "/", "planet", "lab", "/", "1", "\"", " ", "xml", "ns", ":", "xsi", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "-", "instance", "\"", " ", "xsi", ":", "schema", "Locat", "ion", "=\"", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", " ", "http", "://", "www", ".", "proto", "geni", ".", "net", "/", "resource", "s", "/", "rsp", "ec", "/", "2", "/", "manifest", ".", "xsd", " ", "http", "://", "www", ".", "planet", "-", "lab", ".", "org", "/", "resource", "s", "/", "sfa", "/", "ext", "/", "planet", "lab", "/", "1", " ", "http", "://", "www", ".", "planet", "-", "lab", ".", "org", "/", "resource", "s", "/", "sfa", "/", "ext", "/", "planet", "lab", "/", "1", "/", "planet", "lab", ".", "xsd", " ", "http", "://", "www", ".", "planet", "-", "lab", ".", "org", "/", "resource", "s", "/", "sfa", "/", "ext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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Esri/solutions-geoprocessing-toolbox/data_management/toolboxes/scripts/AddUniqueRowID.py
[ { "content": "#------------------------------------------------------------------------------\n# Copyright 2014 Esri\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# AddUniqueRowID.py\n# --------------------------------------------------\n# Built for ArcGIS 10.1\n# --------------------------------------------------\n# Adds a new field of unique row numbers to a table\n# ==================================================\n\n# IMPORTS ==========================================\nimport os, sys, traceback\nimport arcpy\nfrom arcpy import da\n\n# ARGUMENTS ========================================\ndataset = arcpy.GetParameterAsText(0)\nfieldName = arcpy.GetParameterAsText(1)\n\n# LOCALS ===========================================\ncounter = 1\n\n# ==================================================\ntry:\n \n # add unique ID field\n arcpy.AddMessage(\"Adding field \" + str(fieldName))\n arcpy.AddField_management(dataset,fieldName,\"LONG\")\n\n # add unique numbers to each row\n fields = [str(fieldName)]\n arcpy.AddMessage(\"Adding unique row IDs\")\n rows = arcpy.da.UpdateCursor(dataset,fields)\n for row in rows:\n row[0] = counter\n rows.updateRow(row)\n counter += 1\n del rows\n \n # set output\n arcpy.SetParameter(0,dataset)\n \n\nexcept arcpy.ExecuteError:\n error = True\n # Get the tool error messages \n msgs = arcpy.GetMessages() \n arcpy.AddError(msgs) \n #print msgs #UPDATE\n print(msgs)\n\nexcept:\n # Get the traceback object\n error = True\n tb = sys.exc_info()[2]\n tbinfo = traceback.format_tb(tb)[0]\n\n # Concatenate information together concerning the error into a message string\n pymsg = \"PYTHON ERRORS:\\nTraceback info:\\n\" + tbinfo + \"\\nError Info:\\n\" + str(sys.exc_info()[1])\n msgs = \"ArcPy ERRORS:\\n\" + arcpy.GetMessages() + \"\\n\"\n\n # Return python error messages for use in script tool or Python Window\n arcpy.AddError(pymsg)\n arcpy.AddError(msgs)\n\n # Print Python error messages for use in Python / Python Window\n #print pymsg + \"\\n\" #UPDATE\n print(pymsg + \"\\n\")\n #print msgs #UPDATE\n print(msgs)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os, sys, traceback", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 25 }, { "span": "from arcpy import da", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 20 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Es", "ri_", "\\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_", "#", " ", "Add", "Unique", "Row", "ID", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bu", "ilt", " ", "for", " ", "Arc", "GI", "S", " ", "10.1", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "s", " ", "a", " ", "new", " ", "field", " ", "of", " ", "unique", " ", "row", " ", "numbers", " ", "to", " ", "a", " ", "table_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "=======", "=_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPORT", "S", " ", "==============", "==============", "==============", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "arcpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "arcpy_", "import_", "da_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARGUMENT", "S", " ", "==============", "==============", "============", "_", "\\u\\u\\uNL\\u\\u\\u_", "dataset_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "Name_", "=_", "arcpy_", "._", "Get", "Parameter", "As", "Text_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LOCAL", "S", " ", "==============", "==============", "==============", "=_", "\\u\\u\\uNL\\u\\u\\u_", "counter_", "=_", "1_", "\\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\\uNL\\u\\u\\u_", "#", " ", "add", " ", "unique", " ", "ID", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Add", "ing", " ", "field", " ", "\"_", "+_", "str_", "(_", "field", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Field", "\\u", "management_", "(_", "dataset_", ",_", "field", "Name_", ",_", "\"", "LONG", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "unique", " ", "numbers", " ", "to", " ", "each", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "[_", "str_", "(_", "field", "Name_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Message_", "(_", "\"", "Add", "ing", " ", "unique", " ", "row", " ", "ID", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "arcpy_", "._", "da_", "._", "Update", "Cursor_", "(_", "dataset_", ",_", "fields_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "[_", "0_", "]_", "=_", "counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "._", "update", "Row_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counter_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "rows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Set", "Parameter_", "(_", "0_", ",_", "dataset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "arcpy_", "._", "Execut", "e", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "tool", " ", "error", " ", "message", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "msgs_", "=_", "arcpy_", "._", "Get", "Messages_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "msgs", " ", "#", "UPDATE_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "msgs_", ")_", "\\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_", "#", " ", "Get", " ", "the", " ", "traceback", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tb", "info_", "=_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Concat", "enat", "e", " ", "informati", "on", " ", "tog", "ether", " ", "concern", "ing", " ", "the", " ", "error", " ", "int", "o", " ", "a", " ", "message", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "pym", "sg_", "=_", "\"", "PYTHON", " ", "ERRORS", ":\\\\", "n", "Trace", "back", " ", "info", ":\\\\", "n", "\"_", "+_", "tb", "info_", "+_", "\"\\\\", "n", "Error", " ", "Info", ":\\\\", "n", "\"_", "+_", "str_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs_", "=_", "\"", "Arc", "Py", " ", "ERRORS", ":\\\\", "n", "\"_", "+_", "arcpy_", "._", "Get", "Messages_", "(_", ")_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "python", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "script", " ", "tool", " ", "or", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "pym", "sg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arcpy_", "._", "Add", "Error_", "(_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Print", " ", "Pyth", "on", " ", "error", " ", "message", "s", " ", "for", " ", "use", " ", "in", " ", "Pyth", "on", " ", "/", " ", "Pyth", "on", " ", "Window_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "pym", "sg", " ", "+", " ", "\"\\\\", "n", "\"", " ", "#", "UPDATE_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "pym", "sg_", "+_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "msgs", " ", "#", "UPDATE_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "msgs_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
unlimitedlabs/orchestra/orchestra/tests/test_task_lifecycle.py
[ { "content": " def test_get_new_task_assignment_entry_level(self):\n # Entry-level assignment\n self.assertEquals(Task.objects\n .filter(status=Task.Status.AWAITING_PROCESSING)\n .count(),\n 1)\n\n with self.assertRaises(WorkerCertificationError):\n get_new_task_assignment(self.workers[5],\n Task.Status.PENDING_REVIEW)\n\n # assign a new task to a worker\n assignment = get_new_task_assignment(self.workers[5],\n Task.Status.AWAITING_PROCESSING)\n self.assertTrue(assignment is not None)\n\n self.assertEquals(assignment.task.status,\n Task.Status.PROCESSING)\n\n # No more tasks left in AWAITING_PROCESSING\n with self.assertRaises(NoTaskAvailable):\n get_new_task_assignment(self.workers[5],\n Task.Status.AWAITING_PROCESSING)\n\n # Worker should not be served machine tasks\n workflow_version = self.workflow_versions['test_workflow_2']\n simple_machine = self.workflow_steps[\n workflow_version.slug]['simple_machine']\n project = Project.objects.create(workflow_version=workflow_version,\n short_description='',\n priority=0,\n task_class=0)\n Task.objects.create(project=project,\n status=Task.Status.AWAITING_PROCESSING,\n step=simple_machine)\n\n with self.assertRaises(NoTaskAvailable):\n get_new_task_assignment(self.workers[5],\n Task.Status.AWAITING_PROCESSING)", "metadata": "root.BasicTaskLifeCycleTestCase.test_get_new_task_assignment_entry_level", "header": "['class', 'BasicTaskLifeCycleTestCase', '(', 'OrchestraTestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def test_get_new_task_assignment_reviewer(self):\n # Reviewer assignment\n self.assertEquals(Task.objects\n .filter(status=Task.Status.PENDING_REVIEW)\n .count(),\n 1)\n\n # assign a review task to worker\n assignment = get_new_task_assignment(self.workers[7],\n Task.Status.PENDING_REVIEW)\n self.assertTrue(assignment is not None)\n self.assertEquals(assignment.task.status,\n Task.Status.REVIEWING)\n\n self.assertEquals(assignment.in_progress_task_data,\n {'test_key': 'test_value'})\n\n # No tasks in state PENDING_REVIEW\n # No more tasks left in AWAITING_PROCESSING\n with self.assertRaises(NoTaskAvailable):\n get_new_task_assignment(self.workers[7],\n Task.Status.PENDING_REVIEW)\n\n # Assign an entry-level task to reviewer\n assignment = get_new_task_assignment(self.workers[7],\n Task.Status.AWAITING_PROCESSING)\n with self.assertRaises(NoTaskAvailable):\n get_new_task_assignment(self.workers[7],\n Task.Status.AWAITING_PROCESSING)", "metadata": "root.BasicTaskLifeCycleTestCase.test_get_new_task_assignment_reviewer", "header": "['class', 'BasicTaskLifeCycleTestCase', '(', 'OrchestraTestCase', ')', ':', '___EOS___']", "index": 108 }, { "content": " def test_sampled_get_next_task_status(self):\n task = self.tasks['awaiting_processing']\n step = task.step\n step.review_policy = {'policy': 'sampled_review',\n 'rate': 0.5,\n 'max_reviews': 1}\n step.save()\n task.status = Task.Status.PROCESSING\n complete_count = 0\n for i in range(0, 1000):\n next_status = get_next_task_status(\n task, Iteration.Status.REQUESTED_REVIEW)\n complete_count += next_status == Task.Status.COMPLETE\n self.assertTrue(complete_count > 400)\n self.assertTrue(complete_count < 600)", "metadata": "root.BasicTaskLifeCycleTestCase.test_sampled_get_next_task_status", "header": "['class', 'BasicTaskLifeCycleTestCase', '(', 'OrchestraTestCase', ')', ':', '___EOS___']", "index": 352 } ]
[ { "span": "self.assertTrue(assignment is not None)", "start_line": 82, "start_column": 8, "end_line": 82, "end_column": 47 }, { "span": "self.assertTrue(assignment is not None)", "start_line": 118, "start_column": 8, "end_line": 118, "end_column": 47 }, { "span": "self.assertTrue(complete_count > 400)", "start_line": 365, "start_column": 8, "end_line": 365, "end_column": 45 }, { "span": "self.assertTrue(complete_count < 600)", "start_line": 366, "start_column": 8, "end_line": 366, "end_column": 45 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Basic", "Task", "Life", "Cycle", "Test", "Case_", "(_", "Orc", "hes", "tra", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "new", "\\u", "task", "\\u", "assign", "ment", "\\u", "entry", "\\u", "level_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Entr", "y", "-", "level", " ", "assignment_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "Task_", "._", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "._", "filter_", "(_", "status_", "=_", "Task_", "._", "Status_", "._", "AWA", "ITI", "NG", "\\u", "PROCESS", "ING_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "count_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Worke", "r", "Certificat", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "new", "\\u", "task", "\\u", "assignment_", "(_", "self_", "._", "workers_", "[_", "5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Task_", "._", "Status_", "._", "PEND", "ING", "\\u", "REVI", "EW", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assign", " ", "a", " ", "new", " ", "task", " ", "to", " ", "a", " ", "worker_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assignment_", "=_", "get", "\\u", "new", "\\u", "task", "\\u", "assignment_", "(_", "self_", "._", "workers_", "[_", "5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Task_", "._", "Status_", "._", "AWA", "ITI", "NG", "\\u", "PROCESS", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "assignment_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "assignment_", "._", "task_", "._", "status_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Task_", "._", "Status_", "._", "PROCESS", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", " ", "more", " ", "task", "s", " ", "left", " ", "in", " ", "AWA", "ITI", "NG", "\\u", "PROCESS", "ING_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "No", "Task", "Available_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "new", "\\u", "task", "\\u", "assignment_", "(_", "self_", "._", "workers_", "[_", "5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Task_", "._", "Status_", "._", "AWA", "ITI", "NG", "\\u", "PROCESS", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Worke", "r", " ", "shou", "ld", " ", "not", " ", "be", " ", "serve", "d", " ", "machine", " ", "tasks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "workf", "low", "\\u", "version_", "=_", "self_", "._", "workf", "low", "\\u", "versions_", "[_", "'", "test\\u", "workf", "low", "\\u", "2", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simple", "\\u", "machine_", "=_", "self_", "._", "workf", "low", "\\u", "steps_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "workf", "low", "\\u", "version_", "._", "slug_", "]_", "[_", "'", "simple", "\\u", "machine", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "Project_", "._", "objects_", "._", "create_", "(_", "workf", "low", "\\u", "version_", "=_", "workf", "low", "\\u", "version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "short", "\\u", "description_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "priority_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "class_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Task_", "._", "objects_", "._", "create_", "(_", "project_", "=_", "project_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "Task_", "._", "Status_", "._", "AWA", "ITI", "NG", "\\u", "PROCESS", "ING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "step_", "=_", "simple", "\\u", "machine_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "No", "Task", "Available_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "new", "\\u", "task", "\\u", "assignment_", "(_", "self_", "._", "workers_", "[_", "5_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Task_", "._", "Status_", "._", "AWA", "ITI", "NG", "\\u", "PROCESS", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Task", "Life", "Cycle", "Test", "Case_", "(_", "Orc", "hes", "tra", "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", "new", "\\u", "task", "\\u", "assign", "ment", "\\u", "reviewer", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Review", "er", " ", "assignment_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equals_", "(_", "Task_", "._", "objects_", "\\u\\u\\uNL\\u\\u\\u_", "._", "filter_", "(_", "status_", "=_", "Task_", "._", "Status_", "._", "PEND", "ING", "\\u", "REVI", "EW", "_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "count_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assign", " ", "a", " ", "review", " ", "task", " ", "to", " ", "worker_", "\\u\\u\\uNL\\u\\u\\u_", "assignment_", "=_", "get", "\\u", "new", "\\u", "task", "\\u", "assignment_", "(_", "self_", "._", "workers_", "[_", "7_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Task_", "._", "Status_", "._", "PEND", "ING", "\\u", "REVI", "EW", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "assignment_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "assignment_", "._", "task_", "._", "status_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Task_", "._", "Status_", "._", "REVI", "EW", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "assignment_", "._", "in", "\\u", "progress", "\\u", "task", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "test\\u", "key", "'_", ":_", "'", "test\\u", "value", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", " ", "task", "s", " ", "in", " ", "state", " ", "PEND", "ING", "\\u", "REVI", "EW", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", " ", "more", " ", "task", "s", " ", "left", " ", "in", " ", "AWA", "ITI", "NG", "\\u", "PROCESS", "ING_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "No", "Task", "Available_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "new", "\\u", "task", "\\u", "assignment_", "(_", "self_", "._", "workers_", "[_", "7_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Task_", "._", "Status_", "._", "PEND", "ING", "\\u", "REVI", "EW", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assign", " ", "an", " ", "entry", "-", "level", " ", "task", " ", "to", " ", "reviewer", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assignment_", "=_", "get", "\\u", "new", "\\u", "task", "\\u", "assignment_", "(_", "self_", "._", "workers_", "[_", "7_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Task_", "._", "Status_", "._", "AWA", "ITI", "NG", "\\u", "PROCESS", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "No", "Task", "Available_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "new", "\\u", "task", "\\u", "assignment_", "(_", "self_", "._", "workers_", "[_", "7_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Task_", "._", "Status_", "._", "AWA", "ITI", "NG", "\\u", "PROCESS", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Task", "Life", "Cycle", "Test", "Case_", "(_", "Orc", "hes", "tra", "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", "sample", "d\\u", "get", "\\u", "next", "\\u", "task", "\\u", "status_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "self_", "._", "tasks_", "[_", "'", "await", "ing", "\\u", "process", "ing", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "=_", "task_", "._", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "review", "\\u", "policy_", "=_", "{_", "'", "policy", "'_", ":_", "'", "sample", "d\\u", "review", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rate", "'_", ":_", "0.5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "review", "s", "'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "status_", "=_", "Task_", "._", "Status_", "._", "PROCESS", "ING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "1000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "status_", "=_", "get", "\\u", "next", "\\u", "task", "\\u", "status_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task_", ",_", "Iteration_", "._", "Status_", "._", "REQUEST", "ED", "\\u", "REVI", "EW", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complete", "\\u", "count_", "+=_", "next", "\\u", "status_", "==_", "Task_", "._", "Status_", "._", "COMPLETE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "complete", "\\u", "count_", ">_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "complete", "\\u", "count_", "<_", "600_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
agiliq/django-socialnews/socialnews/load.py
[ { "content": "from django.core.management import setup_environ\nimport settings\n\nsetup_environ(settings)\n\nfrom news import models, tests\n\nimport random\n\nrun_name = ''.join([random.choice('abcdefghijklmnop') for i in xrange(10)])\n\nb= B()\n\nuser = models.User.objects.create_user(username=\"load%s\"%run_name, email=\"[email protected]\", password=\"demo\")\nuser.save()\nb.user = user\nprofile = models.UserProfile(user = user, karma = 10000)\nprofile.save()\ntopic = models.Topic.objects.create_new_topic(user = b.user, topic_name = 'cpp%s'%run_name, full_name='CPP primer')\nb.topic = topic\n \n\nnum_user = 1000\nnum_links = 3000\nnum_votes = 100\n#Create 10 users\nusers = []\nfor i in xrange(num_user):\n user = models.UserProfile.objects.create_user(user_name='%s%s'%(run_name, i), email='[email protected]', password='demo')\n users.append(user)\n\nprofile = b.user.get_profile()\nprofile.karma = 10000\nprofile.save()\nb.user = models.User.objects.get(id = b.user.id)\nlinks = [] \nfor i in xrange(num_links):\n link = models.Link.objects.create_link(user = b.user, topic = b.topic, url='http://%s%s.com'% (run_name, i), text=str(i) )\n links.append(link)\n \nfor user in users:\n votes = random.randint(2, num_votes)\n for i in xrange(votes):\n link = random.choice(links)\n print i, link, user\n link.upvote(user)\n \n\n \n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class B:\n pass", "metadata": "root.B", "header": "['module', '___EOS___']", "index": 7 } ]
[ { "span": "from news import models, tests", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 30 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "import_", "setup", "\\u", "environ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup", "\\u", "environ_", "(_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "news_", "import_", "models_", ",_", "tests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run", "\\u", "name_", "=_", "''_", "._", "join_", "(_", "[_", "random_", "._", "choice_", "(_", "'", "abcdefg", "hij", "kl", "mn", "op", "'_", ")_", "for_", "i_", "in_", "xrange_", "(_", "10_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "=_", "B_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "models_", "._", "User_", "._", "objects_", "._", "create", "\\u", "user_", "(_", "username_", "=_", "\"", "load", "%", "s", "\"_", "%_", "run", "\\u", "name_", ",_", "email_", "=_", "\"", "demo", "@", "demo", ".", "com", "\"_", ",_", "password_", "=_", "\"", "demo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "user_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile_", "=_", "models_", "._", "User", "Profile_", "(_", "user_", "=_", "user_", ",_", "karma", "_", "=_", "10000_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic_", "=_", "models_", "._", "Topic_", "._", "objects_", "._", "create", "\\u", "new", "\\u", "topic_", "(_", "user_", "=_", "b_", "._", "user_", ",_", "topic", "\\u", "name_", "=_", "'", "cpp", "%", "s", "'_", "%_", "run", "\\u", "name_", ",_", "full", "\\u", "name_", "=_", "'", "CPP", " ", "primer", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "topic_", "=_", "topic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "user_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "links_", "=_", "3000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "votes_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "Creat", "e", " ", "10", " ", "users_", "\\u\\u\\uNL\\u\\u\\u_", "users_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "num", "\\u", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "models_", "._", "User", "Profile_", "._", "objects_", "._", "create", "\\u", "user_", "(_", "user", "\\u", "name_", "=_", "'%", "s", "%", "s", "'_", "%_", "(_", "run", "\\u", "name_", ",_", "i_", ")_", ",_", "email_", "=_", "'", "demo", "@", "demo", ".", "com", "'_", ",_", "password_", "=_", "'", "demo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", "._", "append_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "profile_", "=_", "b_", "._", "user_", "._", "get", "\\u", "profile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile_", "._", "karma", "_", "=_", "10000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "user_", "=_", "models_", "._", "User_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "b_", "._", "user_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "links_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "num", "\\u", "links_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "link_", "=_", "models_", "._", "Link_", "._", "objects_", "._", "create", "\\u", "link_", "(_", "user_", "=_", "b_", "._", "user_", ",_", "topic_", "=_", "b_", "._", "topic_", ",_", "url_", "=_", "'", "http", "://", "%", "s", "%", "s", ".", "com", "'_", "%_", "(_", "run", "\\u", "name_", ",_", "i_", ")_", ",_", "text_", "=_", "str_", "(_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "links_", "._", "append_", "(_", "link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "user_", "in_", "users_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "votes_", "=_", "random_", "._", "randint_", "(_", "2_", ",_", "num", "\\u", "votes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "votes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "link_", "=_", "random_", "._", "choice_", "(_", "links_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "i_", ",_", "link_", ",_", "user_", "\\u\\u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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
karesansui/karesansui/karesansui/lib/parser/eml.py
[ { "content": " def source_file(self):\n try:\n retval = self.get_source_file()\n except:\n retval = []\n\n return retval", "metadata": "root.emlParser.source_file", "header": "['class', 'emlParser', '(', 'Parser', ')', ':', '___EOS___']", "index": 55 }, { "content": " def _parse_mail(self,mail):\n retval = {}\n try:\n body = mail.get_payload()\n boundary = mail.get_boundary()\n charsets = mail.get_charsets() # ['iso-8859-1']\n content_charset = mail.get_content_charset() # 'iso-8859-1'\n content_maintype = mail.get_content_maintype() # 'text'\n content_subtype = mail.get_content_subtype() # 'plain'\n content_type = mail.get_content_type() # 'text/plain'\n default_type = mail.get_default_type() # 'text/plain'\n filename = mail.get_filename() # ??\n params = mail.get_params() # [('text/plain', ''), ('charset', 'iso-8859-1')]\n is_multipart = mail.is_multipart() # False\n if type(body) is list:\n new_body = []\n for _mail in body:\n new_body.append(self._parse_mail(_mail))\n body = new_body\n retval = {}\n retval['body'] = body\n retval['boundary'] = boundary\n retval['charsets'] = charsets\n retval['content_charset'] = content_charset\n retval['content_maintype'] = content_maintype\n retval['content_subtype'] = content_subtype\n retval['content_type'] = content_type\n retval['default_type'] = default_type\n retval['filename'] = filename\n retval['params'] = params\n retval['is_multipart'] = is_multipart\n except:\n pass\n\n #preprint_r(retval)\n return retval", "metadata": "root.emlParser._parse_mail", "header": "['class', 'emlParser', '(', 'Parser', ')', ':', '___EOS___']", "index": 63 }, { "content": " def parse(self,file=None,message=None):\n retval = {}\n try:\n if file is not None and os.path.exists(file):\n message = open(file).read()\n\n mail = email.Parser.Parser().parsestr(message)\n\n headers = mail._headers\n msgs = self._parse_mail(mail)\n\n if type(msgs['body']) is list:\n rawbody = \"\"\n\n if file is not None and os.path.exists(file):\n f = open(file)\n line = f.readline()\n while line:\n line = f.readline()\n if line.rstrip() == \"\":\n rawbody += line\n rawbody += ''.join(f.readlines())\n break\n f.close\n else:\n in_body = False\n for line in message.split(\"\\n\"):\n if line.rstrip() == \"\":\n in_body = True\n if in_body is True:\n rawbody += line + \"\\n\"\n\n elif type(msgs['body']) is str:\n rawbody = msgs['body']\n\n retval[\"headers\"] = headers\n retval[\"msgs\"] = msgs\n retval[\"rawbody\"] = rawbody\n\n except:\n pass\n\n #preprint_r(retval)\n return retval", "metadata": "root.emlParser.parse", "header": "['class', 'emlParser', '(', 'Parser', ')', ':', '___EOS___']", "index": 100 }, { "content": " def read_conf(self,extra_args=None):\n retval = {}\n\n self.dop.addconf(self._module,{})\n\n try:\n self.set_source_file(extra_args[\"file\"])\n\n for _file in self.source_file():\n if os.path.exists(_file):\n mail = self.parse(file=_file)\n\n headers = mail['headers']\n msgs = mail['msgs']\n rawbody = mail['rawbody']\n\n self.dop.add(self._module,[_file,'@msgs'] ,msgs)\n self.dop.add(self._module,[_file,'@headers'],headers)\n for _header in headers:\n self.dop.add(self._module,[_file,'header',_header[0]],_header[1])\n self.dop.add(self._module,[_file,'rawbody'] ,rawbody)\n\n except:\n pass\n\n try:\n message = extra_args[\"message\"]\n\n try:\n message = message.encode(self.encoding)\n except:\n pass\n\n if message != \"\" and message is not None:\n mail = self.parse(message=message)\n\n headers = mail['headers']\n msgs = mail['msgs']\n rawbody = mail['rawbody']\n\n self.dop.add(self._module,[\"@message\",'@msgs'] ,msgs)\n self.dop.add(self._module,[\"@message\",'@headers'],headers)\n for _header in headers:\n self.dop.add(self._module,[\"@message\",'header',_header[0]],_header[1])\n self.dop.add(self._module,[\"@message\",'rawbody'] ,rawbody)\n except:\n pass\n\n\n return self.dop.getconf(self._module)", "metadata": "root.emlParser.read_conf", "header": "['class', 'emlParser', '(', 'Parser', ')', ':', '___EOS___']", "index": 145 } ]
[ { "span": "except:", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 15 }, { "span": "except:", "start_line": 94, "start_column": 8, "end_line": 94, "end_column": 15 }, { "span": "except:", "start_line": 139, "start_column": 8, "end_line": 139, "end_column": 15 }, { "span": "except:", "start_line": 167, "start_column": 8, "end_line": 167, "end_column": 15 }, { "span": "except:", "start_line": 175, "start_column": 12, "end_line": 175, "end_column": 19 }, { "span": "except:", "start_line": 190, "start_column": 8, "end_line": 190, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "em", "l", "Parser_", "(_", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "source", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "self_", "._", "get", "\\u", "source", "\\u", "file_", "(_", ")_", "\\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 ", " _", "retval_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "em", "l", "Parser_", "(_", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "parse", "\\u", "mail_", "(_", "self_", ",_", "mail_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "body_", "=_", "mail_", "._", "get", "\\u", "payload_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boundary_", "=_", "mail_", "._", "get", "\\u", "boundary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "charset", "s_", "=_", "mail_", "._", "get", "\\u", "charset", "s_", "(_", ")_", "#", " ", "['", "iso", "-", "8859", "-1", "']", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "charset_", "=_", "mail_", "._", "get", "\\u", "content", "\\u", "charset_", "(_", ")_", "#", " ", "'", "iso", "-", "8859", "-1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "maint", "ype_", "=_", "mail_", "._", "get", "\\u", "content", "\\u", "maint", "ype_", "(_", ")_", "#", " ", "'", "text", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "subtype_", "=_", "mail_", "._", "get", "\\u", "content", "\\u", "subtype_", "(_", ")_", "#", " ", "'", "plain", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "mail_", "._", "get", "\\u", "content", "\\u", "type_", "(_", ")_", "#", " ", "'", "text", "/", "plain", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "type_", "=_", "mail_", "._", "get", "\\u", "default", "\\u", "type_", "(_", ")_", "#", " ", "'", "text", "/", "plain", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "mail_", "._", "get", "\\u", "filename_", "(_", ")_", "#", " ", "??", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "mail_", "._", "get", "\\u", "params_", "(_", ")_", "#", " ", "[(", "'", "text", "/", "plain", "',", " ", "''", "),", " ", "('", "charset", "',", " ", "'", "iso", "-", "8859", "-1", "')]", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "multipart_", "=_", "mail_", "._", "is", "\\u", "multipart_", "(_", ")_", "#", " ", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "body_", ")_", "is_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "body_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "mail_", "in_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "body_", "._", "append_", "(_", "self_", "._", "\\u", "parse", "\\u", "mail_", "(_", "\\u", "mail_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "body_", "=_", "new", "\\u", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "retval_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "'", "body", "'_", "]_", "=_", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "'", "bound", "ary", "'_", "]_", "=_", "boundary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "'", "charset", "s", "'_", "]_", "=_", "charset", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "'", "content", "\\u", "charset", "'_", "]_", "=_", "content", "\\u", "charset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "'", "content", "\\u", "maint", "ype", "'_", "]_", "=_", "content", "\\u", "maint", "ype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "'", "content", "\\u", "subt", "ype", "'_", "]_", "=_", "content", "\\u", "subtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "'", "content", "\\u", "type", "'_", "]_", "=_", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "'", "default", "\\u", "type", "'_", "]_", "=_", "default", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "'", "filename", "'_", "]_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "'", "params", "'_", "]_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "'", "is", "\\u", "multip", "art", "'_", "]_", "=_", "is", "\\u", "multipart_", "\\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\\uNL\\u\\u\\u_", "#", "prep", "rint", "\\u", "r", "(", "ret", "val", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "em", "l", "Parser_", "(_", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "file_", "=_", "None_", ",_", "message_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file_", "is_", "not_", "None_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "open_", "(_", "file_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mail_", "=_", "email_", "._", "Parser_", "._", "Parser_", "(_", ")_", "._", "parse", "str_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "mail_", "._", "\\u", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs_", "=_", "self_", "._", "\\u", "parse", "\\u", "mail_", "(_", "mail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "type_", "(_", "msgs_", "[_", "'", "body", "'_", "]_", ")_", "is_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "body_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "file_", "is_", "not_", "None_", "and_", "os_", "._", "path_", "._", "exists_", "(_", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "f_", "=_", "open_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "f_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "line_", "=_", "f_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "line_", "._", "rstrip_", "(_", ")_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raw", "body_", "+=_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "body_", "+=_", "''_", "._", "join_", "(_", "f_", "._", "readlines_", "(_", ")_", ")_", "\\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_", "f_", "._", "close_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "in", "\\u", "body_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "message_", "._", "split_", "(_", "\"\\\\", "n", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "line_", "._", "rstrip_", "(_", ")_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "in", "\\u", "body_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "in", "\\u", "body_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raw", "body_", "+=_", "line_", "+_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "msgs_", "[_", "'", "body", "'_", "]_", ")_", "is_", "str_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "body_", "=_", "msgs_", "[_", "'", "body", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "retval_", "[_", "\"", "header", "s", "\"_", "]_", "=_", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "\"", "msgs", "\"_", "]_", "=_", "msgs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "\"", "raw", "body", "\"_", "]_", "=_", "raw", "body_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "prep", "rint", "\\u", "r", "(", "ret", "val", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "em", "l", "Parser_", "(_", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read", "\\u", "conf_", "(_", "self_", ",_", "extra", "\\u", "args_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dop", "_", "._", "addc", "onf_", "(_", "self_", "._", "\\u", "module_", ",_", "{_", "}_", ")_", "\\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_", "._", "set\\u", "source", "\\u", "file_", "(_", "extra", "\\u", "args_", "[_", "\"", "file", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "\\u", "file_", "in_", "self_", "._", "source", "\\u", "file_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "os_", "._", "path_", "._", "exists_", "(_", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mail_", "=_", "self_", "._", "parse_", "(_", "file_", "=_", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "mail_", "[_", "'", "header", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs_", "=_", "mail_", "[_", "'", "msgs", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "body_", "=_", "mail_", "[_", "'", "raw", "body", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dop", "_", "._", "add_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\\u", "file_", ",_", "'@", "msgs", "'_", "]_", ",_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dop", "_", "._", "add_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\\u", "file_", ",_", "'@", "header", "s", "'_", "]_", ",_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "header_", "in_", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "dop", "_", "._", "add_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\\u", "file_", ",_", "'", "header", "'_", ",_", "\\u", "header_", "[_", "0_", "]_", "]_", ",_", "\\u", "header_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dop", "_", "._", "add_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\\u", "file_", ",_", "'", "raw", "body", "'_", "]_", ",_", "raw", "body_", ")_", "\\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_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "extra", "\\u", "args_", "[_", "\"", "message", "\"_", "]_", "\\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 ", " _", "message_", "=_", "message_", "._", "encode_", "(_", "self_", "._", "encoding_", ")_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "message_", "!=_", "\"\"_", "and_", "message_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mail_", "=_", "self_", "._", "parse_", "(_", "message_", "=_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "mail_", "[_", "'", "header", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msgs_", "=_", "mail_", "[_", "'", "msgs", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "body_", "=_", "mail_", "[_", "'", "raw", "body", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dop", "_", "._", "add_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\"@", "message", "\"_", ",_", "'@", "msgs", "'_", "]_", ",_", "msgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dop", "_", "._", "add_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\"@", "message", "\"_", ",_", "'@", "header", "s", "'_", "]_", ",_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "header_", "in_", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "dop", "_", "._", "add_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\"@", "message", "\"_", ",_", "'", "header", "'_", ",_", "\\u", "header_", "[_", "0_", "]_", "]_", ",_", "\\u", "header_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dop", "_", "._", "add_", "(_", "self_", "._", "\\u", "module_", ",_", "[_", "\"@", "message", "\"_", ",_", "'", "raw", "body", "'_", "]_", ",_", "raw", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "dop", "_", "._", "getcon", "f_", "(_", "self_", "._", "\\u", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
wesabe/fixofx/lib/ofxtools/qif_converter.py
[ { "content": " def _clean_txn_amount(self, txn):\n txn_amount = txn.get(\"Amount\", \"00.00\")\n txn_amount2 = txn.get(\"Amount2\", \"00.00\")\n\n # Home Depot Credit Card seems to send two transaction records for each\n # transaction. They're out of order (that is, the second record is not\n # directly after the first, nor even necessarily after it at all), and\n # the second one *sometimes* appears to be a memo field on the first one\n # (e.g., a credit card payment will show up with an amount and date, and\n # then the next transaction will have the same date and a payee that\n # reads, \"Thank you for your payment!\"), and *sometimes* is the real\n # payee (e.g., the first will say \"Home Depot\" and the second will say\n # \"Seasonal/Garden\"). One of the two transaction records will have a\n # transaction amount of \"-\", and the other will have the real\n # transaction amount. Ideally, we would pull out the memo and attach it\n # to the right transaction, but unless the two transactions are the only\n # transactions on that date, there doesn't seem to be a good clue (order\n # in statement, amount, etc.) as to how to associate them. So, instead,\n # we're throwing a ValueError, which means this transaction should be removed\n # from the statement and not displayed to the user. The result is that\n # for Home Depot cards, sometimes we lose the memo (which isn't that big\n # a deal), and sometimes we make the memo into the payee (which sucks).\n if txn_amount == \"-\" or txn_amount == \" \":\n raise ValueError(\"Transaction amount is undefined.\")\n\n # Some QIF sources put the amount in Amount2 instead, for unknown\n # reasons. Here we ignore Amount2 unless Amount is unknown.\n if txn_amount == \"00.00\":\n txn_amount = txn_amount2\n\n # Okay, now strip out whitespace padding.\n txn_amount = txn_amount.strip()\n\n # Some QIF files have dollar signs in the amount. Hey, why not?\n txn_amount = txn_amount.replace('$', '', 1)\n\n # Some QIF files (usually from non-US banks) put the minus sign at\n # the end of the amount, rather than at the beginning. Let's fix that.\n if txn_amount[-1] == \"-\":\n txn_amount = \"-\" + txn_amount[:-1]\n\n # Some QIF sources put three digits after the decimal, and the Ruby\n # code thinks that means we're in Europe. So.....let's deal with\n # that now.\n try:\n txn_amount = str(Decimal(txn_amount).quantize(Decimal('.01')))\n except:\n # Just keep truckin'.\n pass\n\n txn[\"Amount\"] = txn_amount", "metadata": "root.QifConverter._clean_txn_amount", "header": "['class', 'QifConverter', ':', '___EOS___']", "index": 287 } ]
[ { "span": "except:", "start_line": 333, "start_column": 8, "end_line": 333, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Qi", "f", "Converter_", ":_", "\\u\\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", "clean", "\\u", "tx", "n", "\\u", "amount_", "(_", "self_", ",_", "txn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tx", "n", "\\u", "amount_", "=_", "txn_", "._", "get_", "(_", "\"", "Amo", "unt", "\"_", ",_", "\"", "00", ".00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "n", "\\u", "amo", "unt", "2_", "=_", "txn_", "._", "get_", "(_", "\"", "Amo", "unt", "2", "\"_", ",_", "\"", "00", ".00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Home", " ", "Dep", "ot", " ", "Credit", " ", "Card", " ", "see", "ms", " ", "to", " ", "send", " ", "two", " ", "transaction", " ", "record", "s", " ", "for", " ", "each_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transaction", ".", " ", "The", "y", "'", "re", " ", "out", " ", "of", " ", "order", " ", "(", "tha", "t", " ", "is", ",", " ", "the", " ", "second", " ", "record", " ", "is", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "direct", "ly", " ", "after", " ", "the", " ", "first", ",", " ", "nor", " ", "even", " ", "necessar", "il", "y", " ", "after", " ", "it", " ", "at", " ", "all", "),", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "second", " ", "one", " ", "*", "somet", "imes", "*", " ", "appear", "s", " ", "to", " ", "be", " ", "a", " ", "memo", " ", "field", " ", "on", " ", "the", " ", "first", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "e", ".", "g", ".,", " ", "a", " ", "credit", " ", "card", " ", "pay", "ment", " ", "will", " ", "show", " ", "up", " ", "with", " ", "an", " ", "amo", "unt", " ", "and", " ", "date", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "then", " ", "the", " ", "next", " ", "transaction", " ", "will", " ", "have", " ", "the", " ", "same", " ", "date", " ", "and", " ", "a", " ", "paye", "e", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reads", ",", " ", "\"", "Than", "k", " ", "you", " ", "for", " ", "your", " ", "pay", "ment", "!\"", "),", " ", "and", " ", "*", "somet", "imes", "*", " ", "is", " ", "the", " ", "real_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "paye", "e", " ", "(", "e", ".", "g", ".,", " ", "the", " ", "first", " ", "will", " ", "say", " ", "\"", "Home", " ", "Dep", "ot", "\"", " ", "and", " ", "the", " ", "second", " ", "will", " ", "say_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "Season", "al", "/", "Gar", "den", "\")", ".", " ", "One", " ", "of", " ", "the", " ", "two", " ", "transaction", " ", "record", "s", " ", "will", " ", "have", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transaction", " ", "amo", "unt", " ", "of", " ", "\"-", "\",", " ", "and", " ", "the", " ", "other", " ", "will", " ", "have", " ", "the", " ", "real_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transaction", " ", "amo", "unt", ".", " ", "Ideal", "ly", ",", " ", "we", " ", "wou", "ld", " ", "pull", " ", "out", " ", "the", " ", "memo", " ", "and", " ", "attach", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "right", " ", "transaction", ",", " ", "but", " ", "unl", "ess", " ", "the", " ", "two", " ", "transaction", "s", " ", "are", " ", "the", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transaction", "s", " ", "on", " ", "tha", "t", " ", "date", ",", " ", "there", " ", "doe", "sn", "'", "t", " ", "see", "m", " ", "to", " ", "be", " ", "a", " ", "good", " ", "clue", " ", "(", "order_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "statem", "ent", ",", " ", "amo", "unt", ",", " ", "etc", ".)", " ", "as", " ", "to", " ", "how", " ", "to", " ", "associate", " ", "them", ".", " ", "So", ",", " ", "inst", "ead", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "throw", "ing", " ", "a", " ", "Value", "Error", ",", " ", "whi", "ch", " ", "means", " ", "this", " ", "transaction", " ", "shou", "ld", " ", "be", " ", "removed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "the", " ", "statem", "ent", " ", "and", " ", "not", " ", "displaye", "d", " ", "to", " ", "the", " ", "user", ".", " ", "The", " ", "result", " ", "is", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "Home", " ", "Dep", "ot", " ", "cards", ",", " ", "somet", "imes", " ", "we", " ", "lose", " ", "the", " ", "memo", " ", "(", "whi", "ch", " ", "isn", "'", "t", " ", "tha", "t", " ", "big_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "deal", "),", " ", "and", " ", "somet", "imes", " ", "we", " ", "make", " ", "the", " ", "memo", " ", "int", "o", " ", "the", " ", "paye", "e", " ", "(", "whi", "ch", " ", "suc", "ks", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tx", "n", "\\u", "amount_", "==_", "\"-\"_", "or_", "tx", "n", "\\u", "amount_", "==_", "\"", " ", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Transa", "ction", " ", "amo", "unt", " ", "is", " ", "undefined", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Some", " ", "QI", "F", " ", "source", "s", " ", "put", " ", "the", " ", "amo", "unt", " ", "in", " ", "Amo", "unt", "2", " ", "inst", "ead", ",", " ", "for", " ", "unknown_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reasons", ".", " ", " ", "Her", "e", " ", "we", " ", "ignore", " ", "Amo", "unt", "2", " ", "unl", "ess", " ", "Amo", "unt", " ", "is", " ", "unknown", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tx", "n", "\\u", "amount_", "==_", "\"", "00", ".00", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tx", "n", "\\u", "amount_", "=_", "tx", "n", "\\u", "amo", "unt", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ok", "ay", ",", " ", "now", " ", "strip", " ", "out", " ", "whitespace", " ", "padd", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tx", "n", "\\u", "amount_", "=_", "tx", "n", "\\u", "amount_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Some", " ", "QI", "F", " ", "files", " ", "have", " ", "dollar", " ", "signs", " ", "in", " ", "the", " ", "amo", "unt", ".", " ", " ", "He", "y", ",", " ", "wh", "y", " ", "not", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "tx", "n", "\\u", "amount_", "=_", "tx", "n", "\\u", "amount_", "._", "replace_", "(_", "'$'_", ",_", "''_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Some", " ", "QI", "F", " ", "files", " ", "(", "usual", "ly", " ", "from", " ", "non", "-", "US", " ", "banks", ")", " ", "put", " ", "the", " ", "minu", "s", " ", "sign", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "end", " ", "of", " ", "the", " ", "amo", "unt", ",", " ", "rat", "her", " ", "than", " ", "at", " ", "the", " ", "beginn", "ing", ".", " ", "Let", "'", "s", " ", "fix", " ", "tha", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tx", "n", "\\u", "amount_", "[_", "-_", "1_", "]_", "==_", "\"-\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tx", "n", "\\u", "amount_", "=_", "\"-\"_", "+_", "tx", "n", "\\u", "amount_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Some", " ", "QI", "F", " ", "source", "s", " ", "put", " ", "three", " ", "digit", "s", " ", "after", " ", "the", " ", "decima", "l", ",", " ", "and", " ", "the", " ", "Rub", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "code", " ", "think", "s", " ", "tha", "t", " ", "means", " ", "we", "'", "re", " ", "in", " ", "Euro", "pe", ".", " ", " ", "So", ".....", "let", "'", "s", " ", "deal", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "now", "._", "\\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 ", " _", "tx", "n", "\\u", "amount_", "=_", "str_", "(_", "Decimal_", "(_", "tx", "n", "\\u", "amount_", ")_", "._", "quantize", "_", "(_", "Decimal_", "(_", "'.", "01", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "keep", " ", "tru", "ck", "in", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "txn_", "[_", "\"", "Amo", "unt", "\"_", "]_", "=_", "tx", "n", "\\u", "amount_", "\\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, 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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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
First parameter of a method is not named 'self'
francelabs/datafari/windows/python/Lib/idlelib/idle_test/test_autocomplete.py
[ { "content": " def complete():\n return", "metadata": "root.AutoCompleteWindow.complete", "header": "['class', 'AutoCompleteWindow', ':', '___EOS___']", "index": 11 } ]
[ { "span": "def complete():", "start_line": 11, "start_column": 4, "end_line": 11, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Auto", "Complete", "Window_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "complete_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2 ]
Unused import
chili-epfl/shape_learning/scripts/visualize_dataset.py
[ { "content": "#!/usr/bin/env python\n# coding: utf-8\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.widgets import Slider, Button\nfrom shape_learning.shape_modeler import ShapeModeler\n\nimport argparse\n\n\nparser = argparse.ArgumentParser(description='Displays all the characters in the given dataset')\nparser.add_argument('shapes', action=\"store\", nargs='?', default = \"[a-z]\",\n help='A regexp the shapes name should match to be visualised')\nparser.add_argument('--dataset_directory', action=\"store\", nargs='?',\n help='The directory of the dataset to find the shape dataset')\nparser.add_argument('--parameters', action=\"store\", nargs='?',\n help='A predefined set of principle parameters to use')\n\n\naxcolor = 'lightgoldenrodyellow'\nsliders = None\nmainPlot = None\nfig = None\n\n\n\n\n\nif __name__ == \"__main__\":\n\n #parse arguments\n args = parser.parse_args()\n datasetDirectory = args.dataset_directory\n regexp = args.shapes\n \n initial_params = {}\n if args.parameters:\n initial_params = parse_parameters(args.parameters)\n print(\"Got initial params for letters %s\" % initial_params.keys())\n\n if(not datasetDirectory):\n import inspect\n fileName = inspect.getsourcefile(ShapeModeler)\n installDirectory = fileName.split('/lib')[0]\n datasetDirectory = installDirectory + '/share/shape_learning/letter_model_datasets/uji_pen_chars2'\n\n shapes = prepareShapesModel(datasetDirectory, regexp)\n\n print(\"I will display the following shapes:\\n%s\" % \" \".join(shapes.keys()))\n\n for n, k in enumerate(sorted(shapes.keys())):\n\n shape = shapes[k].meanShape\n\n plt.subplot(5, len(shapes)/5 + 1, n+1)\n\n numPointsInShape = len(shape)/2\n x_shape = shape[0:numPointsInShape]\n y_shape = shape[numPointsInShape:]\n\n plt.plot(x_shape, -y_shape, c='k')\n \n if k in initial_params:\n shape = shapes[k].makeShape(initial_params[k])\n x_shape = shape[0:numPointsInShape]\n y_shape = shape[numPointsInShape:]\n\n plt.plot(x_shape, -y_shape, c='r')\n \n plt.title(\"%s (%d samples)\" % (k, shapes[k].numShapesInDataset ))\n frame1 = plt.gca()\n frame1.axes.get_xaxis().set_visible(False)\n frame1.axes.get_yaxis().set_visible(False)\n plt.show()\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def prepareShapesModel(datasetDirectory, regexp=\".*\"):\n\n import glob\n import os.path\n import re\n\n shapes = {}\n\n nameFilter = re.compile(regexp)\n \n datasets = glob.glob(datasetDirectory + '/*.dat')\n\n for dataset in datasets:\n if \"params\" not in dataset:\n name = os.path.splitext(os.path.basename(dataset))[0]\n\n if nameFilter.match(name):\n shapeModeler = ShapeModeler(init_filename = dataset, num_principle_components = 5)\n shapes[name] = shapeModeler\n\n return shapes", "metadata": "root.prepareShapesModel", "header": "['module', '___EOS___']", "index": 27 }, { "content": "def parse_parameters(filename):\n\n params = {}\n with open(filename) as f:\n\n key = None\n for l in f.readlines():\n if l.startswith(\"#\") or l.rstrip()==\"\": continue\n if l.startswith(\"[\"): key = l[1:-2]\n else: params[key] = np.array([[float(p)] for p in l.split(',')])\n\n return params", "metadata": "root.parse_parameters", "header": "['module', '___EOS___']", "index": 49 } ]
[ { "span": "from matplotlib.widgets import Slider, Button", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "codi", "ng", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "matplotlib_", "._", "widgets_", "import_", "Slider_", ",_", "Button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "shape", "\\u", "learning_", "._", "shape", "\\u", "model", "er_", "import_", "Shape", "Model", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "'", "Display", "s", " ", "all", " ", "the", " ", "character", "s", " ", "in", " ", "the", " ", "give", "n", " ", "dataset", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "shape", "s", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "nargs_", "=_", "'?'_", ",_", "default_", "=_", "\"[", "a", "-", "z", "]\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "A", " ", "regexp", " ", "the", " ", "shape", "s", " ", "name", " ", "shou", "ld", " ", "match", " ", "to", " ", "be", " ", "visuali", "sed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "dataset", "\\u", "director", "y", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "nargs_", "=_", "'?'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "The", " ", "director", "y", " ", "of", " ", "the", " ", "dataset", " ", "to", " ", "find", " ", "the", " ", "shape", " ", "dataset", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "parameter", "s", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "nargs_", "=_", "'?'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "A", " ", "prede", "fined", " ", "set", " ", "of", " ", "princ", "ipl", "e", " ", "parameter", "s", " ", "to", " ", "use", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax", "color_", "=_", "'", "lightg", "old", "enr", "ody", "ello", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slide", "rs_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "Plot_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", "parse", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "Directory_", "=_", "args_", "._", "dataset", "\\u", "directory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regexp_", "=_", "args_", "._", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "initial", "\\u", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "parameters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "params_", "=_", "parse", "\\u", "parameters_", "(_", "args_", "._", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "Got", " ", "initial", " ", "params", " ", "for", " ", "letter", "s", " ", "%", "s", "\"_", "%_", "initial", "\\u", "params_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "not_", "dataset", "Directory_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Name_", "=_", "inspect_", "._", "gets", "ource", "file_", "(_", "Shape", "Model", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "install", "Directory_", "=_", "file", "Name_", "._", "split_", "(_", "'/", "lib", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dataset", "Directory_", "=_", "install", "Directory_", "+_", "'/", "share", "/", "shape", "\\u", "learn", "ing", "/", "letter", "\\u", "model", "\\u", "dataset", "s", "/", "uj", "i", "\\u", "pen", "\\u", "char", "s2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shapes_", "=_", "prepar", "e", "Shapes", "Model_", "(_", "dataset", "Directory_", ",_", "regexp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "I", " ", "will", " ", "display", " ", "the", " ", "follow", "ing", " ", "shape", "s", ":\\\\", "n", "%", "s", "\"_", "%_", "\"", " ", "\"_", "._", "join_", "(_", "shapes_", "._", "keys_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", ",_", "k_", "in_", "enumerate_", "(_", "sorted_", "(_", "shapes_", "._", "keys_", "(_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shape_", "=_", "shapes_", "[_", "k_", "]_", "._", "mean", "Shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "subplot_", "(_", "5_", ",_", "len_", "(_", "shapes_", ")_", "/_", "5_", "+_", "1_", ",_", "n_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "Point", "s", "In", "Shape_", "=_", "len_", "(_", "shape_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "shape_", "=_", "shape_", "[_", "0_", ":_", "num", "Point", "s", "In", "Shape_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "shape_", "=_", "shape_", "[_", "num", "Point", "s", "In", "Shape_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "plot_", "(_", "x", "\\u", "shape_", ",_", "-_", "y", "\\u", "shape_", ",_", "c_", "=_", "'", "k", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "k_", "in_", "initial", "\\u", "params_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shape_", "=_", "shapes_", "[_", "k_", "]_", "._", "make", "Shape_", "(_", "initial", "\\u", "params_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "shape_", "=_", "shape_", "[_", "0_", ":_", "num", "Point", "s", "In", "Shape_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "shape_", "=_", "shape_", "[_", "num", "Point", "s", "In", "Shape_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "plot_", "(_", "x", "\\u", "shape_", ",_", "-_", "y", "\\u", "shape_", ",_", "c_", "=_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"%", "s", " ", "(%", "d", " ", "samples", ")\"_", "%_", "(_", "k_", ",_", "shapes_", "[_", "k_", "]_", "._", "num", "Shapes", "In", "Dataset_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame1_", "=_", "plt_", "._", "gca_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame1_", "._", "axes_", "._", "get", "\\u", "xaxis_", "(_", ")_", "._", "set\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame1_", "._", "axes_", "._", "get", "\\u", "yaxis_", "(_", ")_", "._", "set\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "plt_", "._", "show_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "prepar", "e", "Shapes", "Model_", "(_", "dataset", "Directory_", ",_", "regexp_", "=_", "\".*", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "glob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "shapes_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name", "Filter_", "=_", "re_", "._", "compile_", "(_", "regexp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "datasets_", "=_", "glob_", "._", "glob_", "(_", "dataset", "Directory_", "+_", "'/*", ".", "dat", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "dataset_", "in_", "datasets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "params", "\"_", "not_", "in_", "dataset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "dataset_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "name", "Filter_", "._", "match_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shape", "Model", "er_", "=_", "Shape", "Model", "er_", "(_", "init", "\\u", "filename_", "=_", "dataset_", ",_", "num", "\\u", "princ", "ipl", "e\\u", "components_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shapes_", "[_", "name_", "]_", "=_", "shape", "Model", "er_", "\\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_", "shapes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "parameters_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "l_", "in_", "f_", "._", "readlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "l_", "._", "startswith_", "(_", "\"#\"_", ")_", "or_", "l_", "._", "rstrip_", "(_", ")_", "==_", "\"\"_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "l_", "._", "startswith_", "(_", "\"[\"_", ")_", ":_", "key_", "=_", "l_", "[_", "1_", ":_", "-_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "params_", "[_", "key_", "]_", "=_", "np_", "._", "array_", "(_", "[_", "[_", "float_", "(_", "p_", ")_", "]_", "for_", "p_", "in_", "l_", "._", "split_", "(_", "','_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\u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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
crypt3lx2k/Tripcode-Dictionary-Tools/tdt/web/WebCache.py
[ { "content": "import socket\nimport threading\nimport time\n\nimport zlib\n\nimport httplib\nimport urllib2\nimport urlparse\n\ntry:\n import cPickle as pickle\nexcept ImportError:\n import pickle\n\nfrom . import UniformRetryStrategy\n\nimport logging\nlogger = logging.getLogger(__name__)\nlogger.addHandler(logging.NullHandler())\n\n__all__ = ['WebCache']\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class WebCache (object):\n \"\"\"\n Allows for thread-safe cached downloads, honors last-modified.\n\n WebCache can also write and read the cache to and from disk.\n \"\"\"\n # default retry parameters\n retry_times = 3\n retry_lower = 5\n retry_upper = 15\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.WebCache", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __init__ (self, cache_file=None, sleeper=None):\n \"\"\"\n Initializes an instance from an optional cache_file, an optional\n retrier, and an optional sleeper.\n\n The cache_file parameter may either be a filename or an open file-like\n object.\n If the cache_file parameter is not given the cache is initialized to be\n empty.\n\n The sleeper parameter must be a function that takes the number of\n seconds to sleep (as a floating point number).\n If the sleeper parameter is not given it is initialized as time.sleep.\n \"\"\"\n if cache_file is None:\n self.cache = {}\n else:\n self.load(cache_file)\n\n if sleeper is None:\n self.sleeper = time.sleep\n\n self.cache_lock = threading.Lock()\n self.set_online_mode()", "metadata": "root.WebCache.__init__", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 34 }, { "content": " def download (self, url, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, bypass_cache=False):\n \"\"\"\n Downloads the contents from the URL, if something goes wrong it\n registers the exception with the retrier and asks for a sleep time.\n \"\"\"\n retry = 0.0\n\n retrier = UniformRetryStrategy ( \n self.retry_times,\n self.retry_lower,\n self.retry_upper\n )\n\n while retry is not None:\n if retry:\n logger.debug('sleeping on %s for %s seconds', url, retry)\n self.sleeper(retry)\n\n try:\n return self.downloader(url, timeout=timeout, bypass_cache=bypass_cache)\n except Exception as e:\n logger.debug('got on %s exception %s', url, e)\n retrier.register_error(e)\n\n retry = retrier.seconds()\n\n return ''", "metadata": "root.WebCache.download", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 59 }, { "content": " def download_offline (self, url, timeout=None, bypass_cache=False):\n \"\"\"\n Simulates downloading contents from URL while only looking it up in the\n cache.\n \"\"\"\n contents = None\n key = self.url_to_key(url)\n\n if bypass_cache:\n raise ValueError ('Cache bypass doesn\\'t make sense in offline mode.')\n\n if self.has_key(key):\n _, contents = self.get_values(key)\n return zlib.decompress(contents)\n\n raise urllib2.URLError(OSError('not in cache'))", "metadata": "root.WebCache.download_offline", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 87 }, { "content": " def download_online (self, url, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, bypass_cache=False):\n \"\"\"\n Downloads contents from the URL, using the internal cache if applicable.\n \"\"\"\n contents = None\n key = self.url_to_key(url)\n\n if not bypass_cache and self.has_key(key):\n lastmodified, contents = self.get_values(key)\n\n url = urllib2.Request(url)\n url.add_header('if-modified-since', lastmodified)\n\n try:\n connection = urllib2.urlopen(url, timeout=timeout)\n lastmodified = connection.headers.get('last-modified')\n contents = connection.read()\n connection.close()\n except urllib2.HTTPError as e:\n if e.code == 304:\n logger.debug (\n 'cache hit %r not modified since %s',\n key, lastmodified\n )\n return zlib.decompress(contents)\n raise\n\n if not bypass_cache:\n self.set_values(key, lastmodified, zlib.compress(contents))\n\n return contents", "metadata": "root.WebCache.download_online", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 104 }, { "content": " def dump (self, outfile):\n \"\"\"\n Writes internal cache to outfile.\n\n outfile may be a filename or an open file-like object.\n \"\"\"\n if isinstance(outfile, str):\n outfile = open(outfile, 'w')\n\n pickle.dump(self.cache, outfile, protocol=-1)", "metadata": "root.WebCache.dump", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 136 }, { "content": " def get_values (self, key):\n \"\"\"\n Returns the values referred to by key in a thread-safe manner.\n \"\"\"\n with self.cache_lock:\n logger.debug('getting %r from cache', key)\n return self.cache[key]", "metadata": "root.WebCache.get_values", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 147 }, { "content": " def has_key (self, key):\n \"\"\"\n Returns if the cache contains entries for key.\n \"\"\"\n logger.debug('looking for %r in cache', key)\n return key in self.cache", "metadata": "root.WebCache.has_key", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 155 }, { "content": " def keys (self):\n \"\"\"\n Makes a copy of the list of keys and returns it.\n \"\"\"\n return self.cache.keys()", "metadata": "root.WebCache.keys", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 162 }, { "content": " def load (self, infile):\n \"\"\"\n Loads internal cache from infile.\n\n infile may be a filename or an open file-like object.\n \"\"\"\n try:\n if isinstance(infile, str):\n infile = open(infile)\n\n self.cache = pickle.load(infile)\n except IOError:\n self.cache = {}", "metadata": "root.WebCache.load", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 168 }, { "content": " def url_to_key (self, url):\n \"\"\"\n Takes an url and returns a key for use in the cache.\n \"\"\"\n return urlparse.urlparse(url).path", "metadata": "root.WebCache.url_to_key", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 182 }, { "content": " def remove_key (self, key):\n \"\"\"\n Removes an entry from the cache, not thread-safe.\n \"\"\"\n del self.cache[key]", "metadata": "root.WebCache.remove_key", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 188 }, { "content": " def set_offline_mode (self):\n \"\"\"\n Sets offline mode for the webcache.\n \"\"\"\n self.downloader = self.download_offline", "metadata": "root.WebCache.set_offline_mode", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 194 }, { "content": " def set_online_mode (self):\n \"\"\"\n Sets online mode for the webcache.\n \"\"\"\n self.downloader = self.download_online", "metadata": "root.WebCache.set_online_mode", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 200 }, { "content": " def set_values (self, key, *args):\n \"\"\"\n Sets values in a thread-safe manner.\n \"\"\" \n with self.cache_lock:\n logger.debug('storing %r in cache', key)\n self.cache[key] = args", "metadata": "root.WebCache.set_values", "header": "['class', 'WebCache', '(', 'object', ')', ':', '___EOS___']", "index": 206 } ]
[ { "span": "import httplib", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "._", "import_", "Uniform", "Retr", "y", "Strategy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "add", "Handler_", "(_", "logging_", "._", "Null", "Handler_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Web", "Cache", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "All", "ow", "s", " ", "for", " ", "thread", "-", "safe", " ", "cache", "d", " ", "download", "s", ",", " ", "honor", "s", " ", "last", "-", "modifi", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Web", "Cache", " ", "can", " ", "als", "o", " ", "write", " ", "and", " ", "read", " ", "the", " ", "cache", " ", "to", " ", "and", " ", "from", " ", "disk", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "default", " ", "retr", "y", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "retr", "y", "\\u", "times_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retr", "y", "\\u", "lower_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retr", "y", "\\u", "upper_", "=_", "15_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "cache", "\\u", "file_", "=_", "None_", ",_", "sleep", "er_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "es", " ", "an", " ", "instance", " ", "from", " ", "an", " ", "option", "al", " ", "cache", "\\u", "file", ",", " ", "an", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "retrie", "r", ",", " ", "and", " ", "an", " ", "option", "al", " ", "sleep", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "cache", "\\u", "file", " ", "parameter", " ", "may", " ", "eit", "her", " ", "be", " ", "a", " ", "filename", " ", "or", " ", "an", " ", "open", " ", "file", "-", "like", "\\", "10", ";", " ", " ", " ", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "cache", "\\u", "file", " ", "parameter", " ", "is", " ", "not", " ", "give", "n", " ", "the", " ", "cache", " ", "is", " ", "initialize", "d", " ", "to", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "empty", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "sleep", "er", " ", "parameter", " ", "must", " ", "be", " ", "a", " ", "function", " ", "tha", "t", " ", "take", "s", " ", "the", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "second", "s", " ", "to", " ", "sleep", " ", "(", "as", " ", "a", " ", "float", "ing", " ", "point", " ", "number", ").", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "sleep", "er", " ", "parameter", " ", "is", " ", "not", " ", "give", "n", " ", "it", " ", "is", " ", "initialize", "d", " ", "as", " ", "time", ".", "sleep", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cache", "\\u", "file_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "=_", "{_", "}_", "\\u\\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_", "._", "load_", "(_", "cache", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sleep", "er_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sleep", "er_", "=_", "time_", "._", "sleep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cache", "\\u", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "onli", "ne", "\\u", "mode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download_", "(_", "self_", ",_", "url_", ",_", "timeout_", "=_", "socket_", "._", "\\u", "GLOB", "AL", "\\u", "DEF", "AUL", "T", "\\u", "TIMEOUT_", ",_", "bypass", "\\u", "cache_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Down", "load", "s", " ", "the", " ", "content", "s", " ", "from", " ", "the", " ", "URL", ",", " ", "if", " ", "somet", "hing", " ", "go", "es", " ", "wrong", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "register", "s", " ", "the", " ", "exception", " ", "with", " ", "the", " ", "retrie", "r", " ", "and", " ", "asks", " ", "for", " ", "a", " ", "sleep", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retry_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "retrie", "r_", "=_", "Uniform", "Retr", "y", "Strategy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "retr", "y", "\\u", "times_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "retr", "y", "\\u", "lower_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "retr", "y", "\\u", "upper_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "retry_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "retry_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "sleep", "ing", " ", "on", " ", "%", "s", " ", "for", " ", "%", "s", " ", "second", "s", "'_", ",_", "url_", ",_", "retry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sleep", "er_", "(_", "retry_", ")_", "\\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_", "self_", "._", "downloader_", "(_", "url_", ",_", "timeout_", "=_", "timeout_", ",_", "bypass", "\\u", "cache_", "=_", "bypass", "\\u", "cache_", ")_", "\\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 ", " _", "logger_", "._", "debug_", "(_", "'", "got", " ", "on", " ", "%", "s", " ", "exception", " ", "%", "s", "'_", ",_", "url_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retrie", "r_", "._", "register", "\\u", "error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "retry_", "=_", "retrie", "r_", "._", "seconds_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download", "\\u", "offline_", "(_", "self_", ",_", "url_", ",_", "timeout_", "=_", "None_", ",_", "bypass", "\\u", "cache_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Simulate", "s", " ", "download", "ing", " ", "content", "s", " ", "from", " ", "URL", " ", "whi", "le", " ", "only", " ", "look", "ing", " ", "it", " ", "up", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "cache", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "self_", "._", "url", "\\u", "to", "\\u", "key_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bypass", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Cache", " ", "bypass", " ", "doe", "sn", "\\\\'", "t", " ", "make", " ", "sense", " ", "in", " ", "offline", " ", "mode", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "key_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "contents_", "=_", "self_", "._", "get", "\\u", "values_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "zlib_", "._", "decompress_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "urllib2_", "._", "URL", "Error_", "(_", "OSE", "rror_", "(_", "'", "not", " ", "in", " ", "cache", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download", "\\u", "online_", "(_", "self_", ",_", "url_", ",_", "timeout_", "=_", "socket_", "._", "\\u", "GLOB", "AL", "\\u", "DEF", "AUL", "T", "\\u", "TIMEOUT_", ",_", "bypass", "\\u", "cache_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Down", "load", "s", " ", "content", "s", " ", "from", " ", "the", " ", "URL", ",", " ", "usi", "ng", " ", "the", " ", "internal", " ", "cache", " ", "if", " ", "applica", "ble", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "self_", "._", "url", "\\u", "to", "\\u", "key_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "bypass", "\\u", "cache_", "and_", "self_", "._", "has", "\\u", "key_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lastm", "odi", "fied", "_", ",_", "contents_", "=_", "self_", "._", "get", "\\u", "values_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "._", "add", "\\u", "header_", "(_", "'", "if", "-", "modifi", "ed", "-", "sinc", "e", "'_", ",_", "lastm", "odi", "fied", "_", ")_", "\\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 ", " _", "connection_", "=_", "urllib2_", "._", "urlopen_", "(_", "url_", ",_", "timeout_", "=_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lastm", "odi", "fied", "_", "=_", "connection_", "._", "headers_", "._", "get_", "(_", "'", "last", "-", "modifi", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "connection_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "code_", "==_", "304_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cache", " ", "hit", " ", "%", "r", " ", "not", " ", "modifi", "ed", " ", "sinc", "e", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", ",_", "lastm", "odi", "fied", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "zlib_", "._", "decompress_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "bypass", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "values_", "(_", "key_", ",_", "lastm", "odi", "fied", "_", ",_", "zlib_", "._", "compress_", "(_", "contents_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "contents_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dump_", "(_", "self_", ",_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Write", "s", " ", "internal", " ", "cache", " ", "to", " ", "outfile", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "outfile", " ", "may", " ", "be", " ", "a", " ", "filename", " ", "or", " ", "an", " ", "open", " ", "file", "-", "like", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "outfile_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "=_", "open_", "(_", "outfile_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pickle_", "._", "dump_", "(_", "self_", "._", "cache_", ",_", "outfile_", ",_", "protocol_", "=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "values_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "values", " ", "referred", " ", "to", " ", "by", " ", "key", " ", "in", " ", "a", " ", "thread", "-", "safe", " ", "manner", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "cache", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "getti", "ng", " ", "%", "r", " ", "from", " ", "cache", "'_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "cache_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "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_", "has", "\\u", "key_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "if", " ", "the", " ", "cache", " ", "contain", "s", " ", "entri", "es", " ", "for", " ", "key", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "'", "look", "ing", " ", "for", " ", "%", "r", " ", "in", " ", "cache", "'_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "key_", "in_", "self_", "._", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "keys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", "s", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "list", " ", "of", " ", "keys", " ", "and", " ", "return", "s", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "cache_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "load_", "(_", "self_", ",_", "infile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", "s", " ", "internal", " ", "cache", " ", "from", " ", "infile", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "infile", " ", "may", " ", "be", " ", "a", " ", "filename", " ", "or", " ", "an", " ", "open", " ", "file", "-", "like", " ", "object", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "infile_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "infile_", "=_", "open_", "(_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cache_", "=_", "pickle_", "._", "load_", "(_", "infile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "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_", "url", "\\u", "to", "\\u", "key_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tak", "es", " ", "an", " ", "url", " ", "and", " ", "return", "s", " ", "a", " ", "key", " ", "for", " ", "use", " ", "in", " ", "the", " ", "cache", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "urlparse_", "._", "urlparse_", "(_", "url_", ")_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "key_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Remove", "s", " ", "an", " ", "entry", " ", "from", " ", "the", " ", "cache", ",", " ", "not", " ", "thread", "-", "safe", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "cache_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "offline", "\\u", "mode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "offline", " ", "mode", " ", "for", " ", "the", " ", "webca", "che", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "downloader_", "=_", "self_", "._", "download", "\\u", "offline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "onli", "ne", "\\u", "mode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "onli", "ne", " ", "mode", " ", "for", " ", "the", " ", "webca", "che", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "downloader_", "=_", "self_", "._", "download", "\\u", "online_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Web", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "values_", "(_", "self_", ",_", "key_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "values", " ", "in", " ", "a", " ", "thread", "-", "safe", " ", "manner", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "cache", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "debug_", "(_", "'", "stor", "ing", " ", "%", "r", " ", "in", " ", "cache", "'_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache_", "[_", "key_", "]_", "=_", "args_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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2, 2, 2, 2, 2 ]
Unused import
baudren/montepython_public/wrapper_wmap/waf_tools/cfitsio.py
[ { "content": "import autoinstall_lib as atl\nfrom waflib import Logs\nfrom waflib import Utils,Errors\nimport waflib\n\nimport os.path as osp\n \n \ntwice = False\n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def options(ctx):\n atl.add_lib_option(\"cfitsio\",ctx,install=True)", "metadata": "root.options", "header": "['module', '___EOS___']", "index": 7 }, { "content": "def configure(ctx):\n atl.conf_lib(ctx,\"cfitsio\",[\"cfitsio\"],\"fits_init_cfitsio\",\"fitsio.h\",msg=\"\",opt_name=\"cfitsio\",uselib=[\"cshlib\"],install=install_cfitsio)\n ctx.env.th = False", "metadata": "root.configure", "header": "['module', '___EOS___']", "index": 11 }, { "content": "def install_cfitsio(ctx):\n atl.installsmthg_pre(ctx,\"ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3280.tar.gz\",\"cfitsio3280.tar.gz\")\n CCMACRO = \"\\\"%s %s\\\"\"%(ctx.env.CC[0],ctx.env.mopt)\n CCMACRO = \"CC=%s CXX=%s \"%(CCMACRO,CCMACRO)\n CPPMACRO = \"CPP=\\\"%s -E\\\" CXXCPP=\\\"g++ -E\\\" \"%(ctx.env.CC[0])\n cmdline = \"cd build/%s; ./configure --prefix=%s %s %s %s; make clean;make -j %d ;make -j %d shared;make install\"%(\"cfitsio\",ctx.env.mprefix,\"\",CCMACRO, CPPMACRO,ctx.options.jobs,ctx.options.jobs)\n Logs.pprint(\"PINK\",cmdline)\n if ctx.exec_command(cmdline)!=0:\n raise Errors.WafError(\"Cannot build %s\"%\"cfitsio\")", "metadata": "root.install_cfitsio", "header": "['module', '___EOS___']", "index": 15 } ]
[ { "span": "from waflib import Utils,Errors", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 31 }, { "span": "import waflib", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 13 }, { "span": "import os.path as osp", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 21 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "autoi", "nstal", "l\\u", "lib_", "as_", "atl", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "waf", "lib_", "import_", "Logs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "waf", "lib_", "import_", "Utils_", ",_", "Errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "waf", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "._", "path_", "as_", "osp_", "\\u\\u\\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_", "twi", "ce_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "options_", "(_", "ctx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atl", "_", "._", "add", "\\u", "lib", "\\u", "option_", "(_", "\"", "cfi", "tsi", "o", "\"_", ",_", "ctx_", ",_", "install_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "configure_", "(_", "ctx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atl", "_", "._", "conf", "\\u", "lib_", "(_", "ctx_", ",_", "\"", "cfi", "tsi", "o", "\"_", ",_", "[_", "\"", "cfi", "tsi", "o", "\"_", "]_", ",_", "\"", "fits", "\\u", "init", "\\u", "cfi", "tsi", "o", "\"_", ",_", "\"", "fits", "io", ".", "h", "\"_", ",_", "msg_", "=_", "\"\"_", ",_", "opt", "\\u", "name_", "=_", "\"", "cfi", "tsi", "o", "\"_", ",_", "usel", "ib_", "=_", "[_", "\"", "csh", "lib", "\"_", "]_", ",_", "install_", "=_", "install", "\\u", "cfi", "tsi", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "._", "th_", "=_", "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_", "install", "\\u", "cfi", "tsi", "o_", "(_", "ctx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atl", "_", "._", "install", "smt", "hg", "\\u", "pre_", "(_", "ctx_", ",_", "\"", "ftp", "://", "he", "asa", "rc", ".", "gs", "fc", ".", "nasa", ".", "gov", "/", "software", "/", "fits", "io", "/", "c", "/", "cfi", "tsi", "o3", "280", ".", "tar", ".", "gz", "\"_", ",_", "\"", "cfi", "tsi", "o3", "280", ".", "tar", ".", "gz", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CC", "MAC", "RO", "_", "=_", "\"\\\\\"", "%", "s", " ", "%", "s", "\\\\\"\"_", "%_", "(_", "ctx_", "._", "env_", "._", "CC_", "[_", "0_", "]_", ",_", "ctx_", "._", "env_", "._", "mop", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CC", "MAC", "RO", "_", "=_", "\"", "CC", "=", "%", "s", " ", "CXX", "=", "%", "s", " ", "\"_", "%_", "(_", "CC", "MAC", "RO", "_", ",_", "CC", "MAC", "RO", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CPP", "MAC", "RO", "_", "=_", "\"", "CPP", "=\\\\\"", "%", "s", " ", "-", "E", "\\\\\"", " ", "CXX", "CPP", "=\\\\\"", "g", "++", " ", "-", "E", "\\\\\"", " ", "\"_", "%_", "(_", "ctx_", "._", "env_", "._", "CC_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmdline_", "=_", "\"", "cd", " ", "build", "/", "%", "s", ";", " ", "./", "configur", "e", " ", "--", "prefix", "=", "%", "s", " ", "%", "s", " ", " ", "%", "s", " ", "%", "s", ";", " ", "make", " ", "clean", ";", "make", " ", "-", "j", " ", "%", "d", " ", ";", "make", " ", "-", "j", " ", "%", "d", " ", "shared", ";", "make", " ", "install", "\"_", "%_", "(_", "\"", "cfi", "tsi", "o", "\"_", ",_", "ctx_", "._", "env_", "._", "mpr", "efi", "x_", ",_", "\"\"_", ",_", "CC", "MAC", "RO", "_", ",_", "CPP", "MAC", "RO", "_", ",_", "ctx_", "._", "options_", "._", "jobs_", ",_", "ctx_", "._", "options_", "._", "jobs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Logs_", "._", "pprint_", "(_", "\"", "PIN", "K", "\"_", ",_", "cmdline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ctx_", "._", "exec", "\\u", "command_", "(_", "cmdline_", ")_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Errors_", "._", "Wa", "f", "Error_", "(_", "\"", "Cann", "ot", " ", "build", " ", "%", "s", "\"_", "%_", "\"", "cfi", "tsi", "o", "\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kemayo/sublime-text-git/git/history.py
[ { "content": "from __future__ import absolute_import, unicode_literals, print_function, division\n\nimport functools\nimport re\n\nimport sublime\nimport sublime_plugin\nfrom . import GitTextCommand, GitWindowCommand, plugin_file\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GitBlameCommand(GitTextCommand):\n\n\n", "metadata": "root.GitBlameCommand", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def run(self, edit):\n # somewhat custom blame command:\n # -w: ignore whitespace changes\n # -M: retain blame when moving lines\n # -C: retain blame when copying lines between files\n command = ['git', 'blame', '-w', '-M', '-C']\n\n lines = self.get_lines()\n if lines:\n command.extend(('-L', str(lines[0]) + ',' + str(lines[1])))\n callback = self.blame_done\n else:\n callback = functools.partial(self.blame_done,\n focused_line=self.get_current_line())\n\n command.append(self.get_file_name())\n self.run_command(command, callback)", "metadata": "root.GitBlameCommand.run", "header": "['class', 'GitBlameCommand', '(', 'GitTextCommand', ')', ':', '___EOS___']", "index": 11 }, { "content": " def get_current_line(self):\n (current_line, column) = self.view.rowcol(self.view.sel()[0].a)\n # line is 1 based\n return current_line + 1", "metadata": "root.GitBlameCommand.get_current_line", "header": "['class', 'GitBlameCommand', '(', 'GitTextCommand', ')', ':', '___EOS___']", "index": 29 }, { "content": " def get_lines(self):\n selection = self.view.sel()[0] # todo: multi-select support?\n if selection.empty():\n return False\n # just the lines we have a selection on\n begin_line, begin_column = self.view.rowcol(selection.begin())\n end_line, end_column = self.view.rowcol(selection.end())\n # blame will fail if last line is empty and is included in the selection\n if end_line > begin_line and end_column == 0:\n end_line -= 1\n # add one to each, to line up sublime's index with git's\n return begin_line + 1, end_line + 1", "metadata": "root.GitBlameCommand.get_lines", "header": "['class', 'GitBlameCommand', '(', 'GitTextCommand', ')', ':', '___EOS___']", "index": 34 }, { "content": " def blame_done(self, result, focused_line=1):\n view = self.scratch(result, title=\"Git Blame\", focused_line=focused_line,\n syntax=plugin_file(\"syntax/Git Blame.tmLanguage\"))", "metadata": "root.GitBlameCommand.blame_done", "header": "['class', 'GitBlameCommand', '(', 'GitTextCommand', ')', ':', '___EOS___']", "index": 47 }, { "content": "class GitLog(object):\n\n\n\n\n", "metadata": "root.GitLog", "header": "['module', '___EOS___']", "index": 52 }, { "content": " def run(self, edit=None):\n fn = self.get_file_name()\n return self.run_log(fn != '', '--', fn)", "metadata": "root.GitLog.run", "header": "['class', 'GitLog', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def run_log(self, follow, *args):\n # the ASCII bell (\\a) is just a convenient character I'm pretty sure\n # won't ever come up in the subject of the commit (and if it does then\n # you positively deserve broken output...)\n # 9000 is a pretty arbitrarily chosen limit; picked entirely because\n # it's about the size of the largest repo I've tested this on... and\n # there's a definite hiccup when it's loading that\n command = ['git', 'log', '--no-color', '--pretty=%s (%h)\\a%an <%aE>\\a%ad (%ar)',\n '--date=local', '--max-count=9000', '--follow' if follow else None]\n command.extend(args)\n self.run_command(\n command,\n self.log_done)", "metadata": "root.GitLog.run_log", "header": "['class', 'GitLog', '(', 'object', ')', ':', '___EOS___']", "index": 57 }, { "content": " def log_done(self, result):\n self.results = [r.split('\\a', 2) for r in result.strip().split('\\n')]\n self.quick_panel(self.results, self.log_panel_done)", "metadata": "root.GitLog.log_done", "header": "['class', 'GitLog', '(', 'object', ')', ':', '___EOS___']", "index": 71 }, { "content": " def log_panel_done(self, picked):\n if 0 > picked < len(self.results):\n return\n item = self.results[picked]\n # the commit hash is the last thing on the first line, in brackets\n ref = item[0].split(' ')[-1].strip('()')\n self.log_result(ref)", "metadata": "root.GitLog.log_panel_done", "header": "['class', 'GitLog', '(', 'object', ')', ':', '___EOS___']", "index": 75 }, { "content": " def log_result(self, ref):\n # I'm not certain I should have the file name here; it restricts the\n # details to just the current file. Depends on what the user expects...\n # which I'm not sure of.\n self.run_command(\n ['git', 'log', '--no-color', '-p', '-1', ref, '--', self.get_file_name()],\n self.details_done)", "metadata": "root.GitLog.log_result", "header": "['class', 'GitLog', '(', 'object', ')', ':', '___EOS___']", "index": 83 }, { "content": " def details_done(self, result):\n self.scratch(result, title=\"Git Commit Details\",\n syntax=plugin_file(\"syntax/Git Commit View.tmLanguage\"))", "metadata": "root.GitLog.details_done", "header": "['class', 'GitLog', '(', 'object', ')', ':', '___EOS___']", "index": 91 }, { "content": "class GitLogCommand(GitLog, GitTextCommand):\n pass", "metadata": "root.GitLogCommand", "header": "['module', '___EOS___']", "index": 96 }, { "content": "class GitLogAllCommand(GitLog, GitWindowCommand):\n pass", "metadata": "root.GitLogAllCommand", "header": "['module', '___EOS___']", "index": 100 }, { "content": "class GitShow(object):\n\n\n", "metadata": "root.GitShow", "header": "['module', '___EOS___']", "index": 104 }, { "content": " def run(self, edit=None):\n # GitLog Copy-Past\n self.run_command(\n ['git', 'log', '--no-color', '--pretty=%s (%h)\\a%an <%aE>\\a%ad (%ar)',\n '--date=local', '--max-count=9000', '--', self.get_file_name()],\n self.show_done)", "metadata": "root.GitShow.run", "header": "['class', 'GitShow', '(', 'object', ')', ':', '___EOS___']", "index": 105 }, { "content": " def show_done(self, result):\n # GitLog Copy-Past\n self.results = [r.split('\\a', 2) for r in result.strip().split('\\n')]\n self.quick_panel(self.results, self.panel_done)", "metadata": "root.GitShow.show_done", "header": "['class', 'GitShow', '(', 'object', ')', ':', '___EOS___']", "index": 112 }, { "content": " def panel_done(self, picked):\n if 0 > picked < len(self.results):\n return\n item = self.results[picked]\n # the commit hash is the last thing on the first line, in brackets\n ref = item[0].split(' ')[-1].strip('()')\n self.run_command(\n ['git', 'show', '%s:%s' % (ref, self.get_relative_file_name())],\n self.details_done,\n ref=ref)", "metadata": "root.GitShow.panel_done", "header": "['class', 'GitShow', '(', 'object', ')', ':', '___EOS___']", "index": 117 }, { "content": " def details_done(self, result, ref):\n syntax = self.view.settings().get('syntax')\n self.scratch(result, title=\"%s:%s\" % (ref, self.get_file_name()), syntax=syntax)", "metadata": "root.GitShow.details_done", "header": "['class', 'GitShow', '(', 'object', ')', ':', '___EOS___']", "index": 128 }, { "content": "class GitShowCommand(GitShow, GitTextCommand):\n pass", "metadata": "root.GitShowCommand", "header": "['module', '___EOS___']", "index": 133 }, { "content": "class GitShowAllCommand(GitShow, GitWindowCommand):\n pass", "metadata": "root.GitShowAllCommand", "header": "['module', '___EOS___']", "index": 137 }, { "content": "class GitGraph(object):\n", "metadata": "root.GitGraph", "header": "['module', '___EOS___']", "index": 141 }, { "content": " def run(self, edit=None):\n filename = self.get_file_name()\n self.run_command(\n ['git', 'log', '--graph', '--pretty=%h -%d (%cr) (%ci) <%an> %s', '--abbrev-commit', '--no-color', '--decorate', '--date=relative', '--follow' if filename else None, '--', filename],\n self.log_done\n )", "metadata": "root.GitGraph.run", "header": "['class', 'GitGraph', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": " def log_done(self, result):\n self.scratch(result, title=\"Git Log Graph\", syntax=plugin_file(\"syntax/Git Graph.tmLanguage\"))", "metadata": "root.GitGraph.log_done", "header": "['class', 'GitGraph', '(', 'object', ')', ':', '___EOS___']", "index": 149 }, { "content": "class GitGraphCommand(GitGraph, GitTextCommand):\n pass", "metadata": "root.GitGraphCommand", "header": "['module', '___EOS___']", "index": 153 }, { "content": "class GitGraphAllCommand(GitGraph, GitWindowCommand):\n pass", "metadata": "root.GitGraphAllCommand", "header": "['module', '___EOS___']", "index": 157 }, { "content": "class GitOpenFileCommand(GitLog, GitWindowCommand):\n\n\n\n\n\n", "metadata": "root.GitOpenFileCommand", "header": "['module', '___EOS___']", "index": 161 }, { "content": " def run(self):\n self.run_command(['git', 'branch', '-a', '--no-color'], self.branch_done)", "metadata": "root.GitOpenFileCommand.run", "header": "['class', 'GitOpenFileCommand', '(', 'GitLog', ',', 'GitWindowCommand', ')', ':', '___EOS___']", "index": 162 }, { "content": " def branch_done(self, result):\n self.results = result.rstrip().split('\\n')\n self.quick_panel(self.results, self.branch_panel_done,\n sublime.MONOSPACE_FONT)", "metadata": "root.GitOpenFileCommand.branch_done", "header": "['class', 'GitOpenFileCommand', '(', 'GitLog', ',', 'GitWindowCommand', ')', ':', '___EOS___']", "index": 165 }, { "content": " def branch_panel_done(self, picked):\n if 0 > picked < len(self.results):\n return\n self.branch = self.results[picked].split(' ')[-1]\n self.run_log(False, self.branch)", "metadata": "root.GitOpenFileCommand.branch_panel_done", "header": "['class', 'GitOpenFileCommand', '(', 'GitLog', ',', 'GitWindowCommand', ')', ':', '___EOS___']", "index": 170 }, { "content": " def log_result(self, result_hash):\n self.ref = result_hash\n self.run_command(\n ['git', 'ls-tree', '-r', '--full-tree', self.ref],\n self.ls_done)", "metadata": "root.GitOpenFileCommand.log_result", "header": "['class', 'GitOpenFileCommand', '(', 'GitLog', ',', 'GitWindowCommand', ')', ':', '___EOS___']", "index": 176 }, { "content": " def ls_done(self, result):\n # Last two items are the ref and the file name\n # p.s. has to be a list of lists; tuples cause errors later\n self.results = [[match.group(2), match.group(1)] for match in re.finditer(r\"\\S+\\s(\\S+)\\t(.+)\", result)]\n\n self.quick_panel(self.results, self.ls_panel_done)", "metadata": "root.GitOpenFileCommand.ls_done", "header": "['class', 'GitOpenFileCommand', '(', 'GitLog', ',', 'GitWindowCommand', ')', ':', '___EOS___']", "index": 182 }, { "content": " def ls_panel_done(self, picked):\n if 0 > picked < len(self.results):\n return\n item = self.results[picked]\n\n self.filename = item[0]\n self.fileRef = item[1]\n\n self.run_command(\n ['git', 'show', self.fileRef],\n self.show_done)", "metadata": "root.GitOpenFileCommand.ls_panel_done", "header": "['class', 'GitOpenFileCommand', '(', 'GitLog', ',', 'GitWindowCommand', ')', ':', '___EOS___']", "index": 189 }, { "content": " def show_done(self, result):\n self.scratch(result, title=\"%s:%s\" % (self.fileRef, self.filename))", "metadata": "root.GitOpenFileCommand.show_done", "header": "['class', 'GitOpenFileCommand', '(', 'GitLog', ',', 'GitWindowCommand', ')', ':', '___EOS___']", "index": 201 }, { "content": "class GitDocumentCommand(GitBlameCommand):\n\n", "metadata": "root.GitDocumentCommand", "header": "['module', '___EOS___']", "index": 205 }, { "content": " def get_lines(self):\n selection = self.view.sel()[0] # todo: multi-select support?\n # just the lines we have a selection on\n begin_line, begin_column = self.view.rowcol(selection.begin())\n end_line, end_column = self.view.rowcol(selection.end())\n # blame will fail if last line is empty and is included in the selection\n if end_line > begin_line and end_column == 0:\n end_line -= 1\n # add one to each, to line up sublime's index with git's\n return begin_line + 1, end_line + 1", "metadata": "root.GitDocumentCommand.get_lines", "header": "['class', 'GitDocumentCommand', '(', 'GitBlameCommand', ')', ':', '___EOS___']", "index": 206 }, { "content": " def blame_done(self, result, focused_line=1):\n shas = set((sha for sha in re.findall(r'^[0-9a-f]+', result, re.MULTILINE) if not re.match(r'^0+$', sha)))\n command = ['git', 'show', '-s', '-z', '--no-color', '--date=iso']\n command.extend(shas)\n\n self.run_command(command, self.show_done)", "metadata": "root.GitDocumentCommand.blame_done", "header": "['class', 'GitDocumentCommand', '(', 'GitBlameCommand', ')', ':', '___EOS___']", "index": 217 }, { "content": " def show_done(self, result):\n commits = []\n for commit in result.split('\\0'):\n match = re.search(r'^Date:\\s+(.+)$', commit, re.MULTILINE)\n if match:\n commits.append((match.group(1), commit))\n commits.sort(reverse=True)\n commits = [commit for d, commit in commits]\n\n self.scratch('\\n\\n'.join(commits), title=\"Git Commit Documentation\",\n syntax=plugin_file(\"syntax/Git Commit View.tmLanguage\"))", "metadata": "root.GitDocumentCommand.show_done", "header": "['class', 'GitDocumentCommand', '(', 'GitBlameCommand', ')', ':', '___EOS___']", "index": 224 }, { "content": "class GitGotoCommit(GitTextCommand):\n\n", "metadata": "root.GitGotoCommit", "header": "['module', '___EOS___']", "index": 237 }, { "content": " def run(self, edit):\n view = self.view\n line = view.substr(view.line(view.sel()[0].a))\n commit = line.split(\" \")[0]\n if not commit or commit == \"00000000\":\n return\n working_dir = view.settings().get(\"git_root_dir\")\n self.run_command(['git', 'show', commit], self.show_done, working_dir=working_dir)", "metadata": "root.GitGotoCommit.run", "header": "['class', 'GitGotoCommit', '(', 'GitTextCommand', ')', ':', '___EOS___']", "index": 238 }, { "content": " def show_done(self, result):\n self.scratch(result, title=\"Git Commit View\",\n syntax=plugin_file(\"syntax/Git Commit View.tmLanguage\"))", "metadata": "root.GitGotoCommit.show_done", "header": "['class', 'GitGotoCommit', '(', 'GitTextCommand', ')', ':', '___EOS___']", "index": 247 }, { "content": " def is_enabled(self):\n return True", "metadata": "root.GitGotoCommit.is_enabled", "header": "['class', 'GitGotoCommit', '(', 'GitTextCommand', ')', ':', '___EOS___']", "index": 251 } ]
[ { "span": "import sublime_plugin", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 21 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "unicode", "\\u", "literals_", ",_", "print", "\\u", "function_", ",_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sublime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sublim", "e\\u", "plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "Git", "Text", "Command_", ",_", "Git", "Window", "Command_", ",_", "plugin", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Git", "Bla", "me", "Command_", "(_", "Git", "Text", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Git", "Bla", "me", "Command_", "(_", "Git", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ",_", "edit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "some", "what", " ", "custom", " ", "bla", "me", " ", "command", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "w", ":", " ", "ignore", " ", "whitespace", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "M", ":", " ", "retain", " ", "bla", "me", " ", "whe", "n", " ", "movin", "g", " ", "lines_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", "C", ":", " ", "retain", " ", "bla", "me", " ", "whe", "n", " ", "copy", "ing", " ", "lines", " ", "bet", "ween", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "[_", "'", "git", "'_", ",_", "'", "bla", "me", "'_", ",_", "'-", "w", "'_", ",_", "'-", "M", "'_", ",_", "'-", "C", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "self_", "._", "get", "\\u", "lines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "._", "extend_", "(_", "(_", "'-", "L", "'_", ",_", "str_", "(_", "lines_", "[_", "0_", "]_", ")_", "+_", "','_", "+_", "str_", "(_", "lines_", "[_", "1_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "=_", "self_", "._", "bla", "me", "\\u", "done_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "callback_", "=_", "functools_", "._", "partial_", "(_", "self_", "._", "bla", "me", "\\u", "done_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "focused", "\\u", "line_", "=_", "self_", "._", "get", "\\u", "current", "\\u", "line_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "command_", "._", "append_", "(_", "self_", "._", "get", "\\u", "file", "\\u", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "command_", "(_", "command_", ",_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Bla", "me", "Command_", "(_", "Git", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "current", "\\u", "line_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "current", "\\u", "line_", ",_", "column_", ")_", "=_", "self_", "._", "view_", "._", "rowco", "l_", "(_", "self_", "._", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", "._", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "line", " ", "is", " ", "1", " ", "based", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "current", "\\u", "line_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Bla", "me", "Command_", "(_", "Git", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "lines_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selection_", "=_", "self_", "._", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", "#", " ", "todo", ":", " ", "multi", "-", "select", " ", "support", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "selection_", "._", "empty_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "just", " ", "the", " ", "lines", " ", "we", " ", "have", " ", "a", " ", "selection", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "begin", "\\u", "line_", ",_", "begin", "\\u", "column_", "=_", "self_", "._", "view_", "._", "rowco", "l_", "(_", "selection_", "._", "begin_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "line_", ",_", "end", "\\u", "column_", "=_", "self_", "._", "view_", "._", "rowco", "l_", "(_", "selection_", "._", "end_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bla", "me", " ", "will", " ", "fail", " ", "if", " ", "last", " ", "line", " ", "is", " ", "empty", " ", "and", " ", "is", " ", "include", "d", " ", "in", " ", "the", " ", "selection_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "end", "\\u", "line_", ">_", "begin", "\\u", "line_", "and_", "end", "\\u", "column_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "line_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "one", " ", "to", " ", "each", ",", " ", "to", " ", "line", " ", "up", " ", "sublim", "e", "'", "s", " ", "index", " ", "with", " ", "git", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "begin", "\\u", "line_", "+_", "1_", ",_", "end", "\\u", "line_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Bla", "me", "Command_", "(_", "Git", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bla", "me", "\\u", "done_", "(_", "self_", ",_", "result_", ",_", "focused", "\\u", "line_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "=_", "self_", "._", "scratch", "_", "(_", "result_", ",_", "title_", "=_", "\"", "Git", " ", "Bla", "me", "\"_", ",_", "focused", "\\u", "line_", "=_", "focused", "\\u", "line_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "syntax_", "=_", "plugin", "\\u", "file_", "(_", "\"", "synta", "x", "/", "Git", " ", "Bla", "me", ".", "tm", "Lang", "ua", "ge", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Git", "Log_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Git", "Log_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ",_", "edit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fn_", "=_", "self_", "._", "get", "\\u", "file", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "run", "\\u", "log_", "(_", "fn_", "!=_", "''_", ",_", "'--'_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Log_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "log_", "(_", "self_", ",_", "follow_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "ASCII", " ", "bell", " ", "(\\\\", "a", ")", " ", "is", " ", "just", " ", "a", " ", "convenien", "t", " ", "character", " ", "I", "'", "m", " ", "pretty", " ", "sure", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "won", "'", "t", " ", "ever", " ", "come", " ", "up", " ", "in", " ", "the", " ", "subject", " ", "of", " ", "the", " ", "commit", " ", "(", "and", " ", "if", " ", "it", " ", "doe", "s", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "posit", "ively", " ", "deser", "ve", " ", "broken", " ", "output", "...)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "9000", " ", "is", " ", "a", " ", "pretty", " ", "arbitra", "ri", "ly", " ", "chosen", " ", "limit", ";", " ", "picked", " ", "entire", "ly", " ", "bec", "aus", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "abo", "ut", " ", "the", " ", "size", " ", "of", " ", "the", " ", "large", "st", " ", "repo", " ", "I", "'", "ve", " ", "tested", " ", "this", " ", "on", "...", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", "'", "s", " ", "a", " ", "definit", "e", " ", "hic", "cup", " ", "whe", "n", " ", "it", "'", "s", " ", "load", "ing", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "[_", "'", "git", "'_", ",_", "'", "log", "'_", ",_", "'--", "no", "-", "color", "'_", ",_", "'--", "pretty", "=", "%", "s", " ", "(%", "h", ")\\\\", "a", "%", "an", " ", "<", "%", "a", "E", ">\\\\", "a", "%", "ad", " ", "(%", "ar", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "date", "=", "local", "'_", ",_", "'--", "max", "-", "count", "=", "9000", "'_", ",_", "'--", "follow", "'_", "if_", "follow_", "else_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "._", "extend_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "command_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "log", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Log_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log", "\\u", "done_", "(_", "self_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "results_", "=_", "[_", "r_", "._", "split_", "(_", "'\\\\", "a", "'_", ",_", "2_", ")_", "for_", "r_", "in_", "result_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quick", "\\u", "panel_", "(_", "self_", "._", "results_", ",_", "self_", "._", "log", "\\u", "panel", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Log_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log", "\\u", "panel", "\\u", "done_", "(_", "self_", ",_", "picked", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "0_", ">_", "picked", "_", "<_", "len_", "(_", "self_", "._", "results_", ")_", ":_", "\\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_", "item_", "=_", "self_", "._", "results_", "[_", "picked", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "commit", " ", "hash", " ", "is", " ", "the", " ", "last", " ", "thing", " ", "on", " ", "the", " ", "first", " ", "line", ",", " ", "in", " ", "brackets", "_", "\\u\\u\\uNL\\u\\u\\u_", "ref_", "=_", "item_", "[_", "0_", "]_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "-_", "1_", "]_", "._", "strip_", "(_", "'()'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "result_", "(_", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Log_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log", "\\u", "result_", "(_", "self_", ",_", "ref_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "I", "'", "m", " ", "not", " ", "cert", "ain", " ", "I", " ", "shou", "ld", " ", "have", " ", "the", " ", "file", " ", "name", " ", "here", ";", " ", "it", " ", "restrict", "s", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "deta", "il", "s", " ", "to", " ", "just", " ", "the", " ", "current", " ", "file", ".", " ", "Depend", "s", " ", "on", " ", "what", " ", "the", " ", "user", " ", "expect", "s", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "I", "'", "m", " ", "not", " ", "sure", " ", "of", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "git", "'_", ",_", "'", "log", "'_", ",_", "'--", "no", "-", "color", "'_", ",_", "'-", "p", "'_", ",_", "'-", "1", "'_", ",_", "ref_", ",_", "'--'_", ",_", "self_", "._", "get", "\\u", "file", "\\u", "name_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "deta", "il", "s", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Log_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deta", "il", "s", "\\u", "done_", "(_", "self_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "scratch", "_", "(_", "result_", ",_", "title_", "=_", "\"", "Git", " ", "Commi", "t", " ", "Det", "ail", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "syntax_", "=_", "plugin", "\\u", "file_", "(_", "\"", "synta", "x", "/", "Git", " ", "Commi", "t", " ", "View", ".", "tm", "Lang", "ua", "ge", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Git", "Log", "Command_", "(_", "Git", "Log_", ",_", "Git", "Text", "Command_", ")_", ":_", "\\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_", "Git", "Log", "All", "Command_", "(_", "Git", "Log_", ",_", "Git", "Window", "Command_", ")_", ":_", "\\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_", "Git", "Show_", "(_", "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_", "Git", "Show_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ",_", "edit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Git", "Log", " ", "Copy", "-", "Past", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "git", "'_", ",_", "'", "log", "'_", ",_", "'--", "no", "-", "color", "'_", ",_", "'--", "pretty", "=", "%", "s", " ", "(%", "h", ")\\\\", "a", "%", "an", " ", "<", "%", "a", "E", ">\\\\", "a", "%", "ad", " ", "(%", "ar", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "date", "=", "local", "'_", ",_", "'--", "max", "-", "count", "=", "9000", "'_", ",_", "'--'_", ",_", "self_", "._", "get", "\\u", "file", "\\u", "name_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "show", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Show_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "done_", "(_", "self_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Git", "Log", " ", "Copy", "-", "Past", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "results_", "=_", "[_", "r_", "._", "split_", "(_", "'\\\\", "a", "'_", ",_", "2_", ")_", "for_", "r_", "in_", "result_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quick", "\\u", "panel_", "(_", "self_", "._", "results_", ",_", "self_", "._", "panel", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Show_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "panel", "\\u", "done_", "(_", "self_", ",_", "picked", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "0_", ">_", "picked", "_", "<_", "len_", "(_", "self_", "._", "results_", ")_", ":_", "\\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_", "item_", "=_", "self_", "._", "results_", "[_", "picked", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "commit", " ", "hash", " ", "is", " ", "the", " ", "last", " ", "thing", " ", "on", " ", "the", " ", "first", " ", "line", ",", " ", "in", " ", "brackets", "_", "\\u\\u\\uNL\\u\\u\\u_", "ref_", "=_", "item_", "[_", "0_", "]_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "-_", "1_", "]_", "._", "strip_", "(_", "'()'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "git", "'_", ",_", "'", "show", "'_", ",_", "'%", "s", ":", "%", "s", "'_", "%_", "(_", "ref_", ",_", "self_", "._", "get", "\\u", "relative", "\\u", "file", "\\u", "name_", "(_", ")_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "deta", "il", "s", "\\u", "done_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ref_", "=_", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Show_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deta", "il", "s", "\\u", "done_", "(_", "self_", ",_", "result_", ",_", "ref_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "syntax_", "=_", "self_", "._", "view_", "._", "settings_", "(_", ")_", "._", "get_", "(_", "'", "synta", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "scratch", "_", "(_", "result_", ",_", "title_", "=_", "\"%", "s", ":", "%", "s", "\"_", "%_", "(_", "ref_", ",_", "self_", "._", "get", "\\u", "file", "\\u", "name_", "(_", ")_", ")_", ",_", "syntax_", "=_", "syntax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Git", "Show", "Command_", "(_", "Git", "Show_", ",_", "Git", "Text", "Command_", ")_", ":_", "\\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_", "Git", "Show", "All", "Command_", "(_", "Git", "Show_", ",_", "Git", "Window", "Command_", ")_", ":_", "\\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_", "Git", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Git", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ",_", "edit_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "self_", "._", "get", "\\u", "file", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "git", "'_", ",_", "'", "log", "'_", ",_", "'--", "graph", "'_", ",_", "'--", "pretty", "=", "%", "h", " ", "-%", "d", " ", "(%", "cr", ")", " ", "(%", "ci", ")", " ", "<", "%", "an", ">", " ", "%", "s", "'_", ",_", "'--", "abbrev", "-", "commit", "'_", ",_", "'--", "no", "-", "color", "'_", ",_", "'--", "decorate", "'_", ",_", "'--", "date", "=", "relative", "'_", ",_", "'--", "follow", "'_", "if_", "filename_", "else_", "None_", ",_", "'--'_", ",_", "filename_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "log", "\\u", "done_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log", "\\u", "done_", "(_", "self_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "scratch", "_", "(_", "result_", ",_", "title_", "=_", "\"", "Git", " ", "Log", " ", "Graph", "\"_", ",_", "syntax_", "=_", "plugin", "\\u", "file_", "(_", "\"", "synta", "x", "/", "Git", " ", "Graph", ".", "tm", "Lang", "ua", "ge", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Git", "Graph", "Command_", "(_", "Git", "Graph_", ",_", "Git", "Text", "Command_", ")_", ":_", "\\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_", "Git", "Graph", "All", "Command_", "(_", "Git", "Graph_", ",_", "Git", "Window", "Command_", ")_", ":_", "\\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_", "Git", "Open", "File", "Command_", "(_", "Git", "Log_", ",_", "Git", "Window", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Git", "Open", "File", "Command_", "(_", "Git", "Log_", ",_", "Git", "Window", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "command_", "(_", "[_", "'", "git", "'_", ",_", "'", "branch", "'_", ",_", "'-", "a", "'_", ",_", "'--", "no", "-", "color", "'_", "]_", ",_", "self_", "._", "branch", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Open", "File", "Command_", "(_", "Git", "Log_", ",_", "Git", "Window", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "branch", "\\u", "done_", "(_", "self_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "results_", "=_", "result_", "._", "rstrip_", "(_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quick", "\\u", "panel_", "(_", "self_", "._", "results_", ",_", "self_", "._", "branch", "\\u", "panel", "\\u", "done_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sublime_", "._", "MON", "OSP", "ACE", "\\u", "FONT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Open", "File", "Command_", "(_", "Git", "Log_", ",_", "Git", "Window", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "branch", "\\u", "panel", "\\u", "done_", "(_", "self_", ",_", "picked", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "0_", ">_", "picked", "_", "<_", "len_", "(_", "self_", "._", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "branch_", "=_", "self_", "._", "results_", "[_", "picked", "_", "]_", "._", "split_", "(_", "'", " ", "'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "log_", "(_", "False_", ",_", "self_", "._", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Open", "File", "Command_", "(_", "Git", "Log_", ",_", "Git", "Window", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "log", "\\u", "result_", "(_", "self_", ",_", "result", "\\u", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ref_", "=_", "result", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "git", "'_", ",_", "'", "ls", "-", "tree", "'_", ",_", "'-", "r", "'_", ",_", "'--", "full", "-", "tree", "'_", ",_", "self_", "._", "ref_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ls", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Open", "File", "Command_", "(_", "Git", "Log_", ",_", "Git", "Window", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ls", "\\u", "done_", "(_", "self_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Las", "t", " ", "two", " ", "items", " ", "are", " ", "the", " ", "ref", " ", "and", " ", "the", " ", "file", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "p", ".", "s", ".", " ", "has", " ", "to", " ", "be", " ", "a", " ", "list", " ", "of", " ", "lists", ";", " ", "tuple", "s", " ", "caus", "e", " ", "error", "s", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "results_", "=_", "[_", "[_", "match_", "._", "group_", "(_", "2_", ")_", ",_", "match_", "._", "group_", "(_", "1_", ")_", "]_", "for_", "match_", "in_", "re_", "._", "finditer_", "(_", "r", "\"\\\\", "S", "+\\\\", "s", "(\\\\", "S", "+)\\\\", "t", "(.+", ")\"_", ",_", "result_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "quick", "\\u", "panel_", "(_", "self_", "._", "results_", ",_", "self_", "._", "ls", "\\u", "panel", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Open", "File", "Command_", "(_", "Git", "Log_", ",_", "Git", "Window", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ls", "\\u", "panel", "\\u", "done_", "(_", "self_", ",_", "picked", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "0_", ">_", "picked", "_", "<_", "len_", "(_", "self_", "._", "results_", ")_", ":_", "\\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_", "item_", "=_", "self_", "._", "results_", "[_", "picked", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filename_", "=_", "item_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file", "Ref_", "=_", "item_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "run", "\\u", "command_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "git", "'_", ",_", "'", "show", "'_", ",_", "self_", "._", "file", "Ref_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "show", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Open", "File", "Command_", "(_", "Git", "Log_", ",_", "Git", "Window", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "done_", "(_", "self_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "scratch", "_", "(_", "result_", ",_", "title_", "=_", "\"%", "s", ":", "%", "s", "\"_", "%_", "(_", "self_", "._", "file", "Ref_", ",_", "self_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Git", "Document", "Command_", "(_", "Git", "Bla", "me", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Git", "Document", "Command_", "(_", "Git", "Bla", "me", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "lines_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selection_", "=_", "self_", "._", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", "#", " ", "todo", ":", " ", "multi", "-", "select", " ", "support", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "just", " ", "the", " ", "lines", " ", "we", " ", "have", " ", "a", " ", "selection", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "begin", "\\u", "line_", ",_", "begin", "\\u", "column_", "=_", "self_", "._", "view_", "._", "rowco", "l_", "(_", "selection_", "._", "begin_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "line_", ",_", "end", "\\u", "column_", "=_", "self_", "._", "view_", "._", "rowco", "l_", "(_", "selection_", "._", "end_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "bla", "me", " ", "will", " ", "fail", " ", "if", " ", "last", " ", "line", " ", "is", " ", "empty", " ", "and", " ", "is", " ", "include", "d", " ", "in", " ", "the", " ", "selection_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "end", "\\u", "line_", ">_", "begin", "\\u", "line_", "and_", "end", "\\u", "column_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "line_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "add", " ", "one", " ", "to", " ", "each", ",", " ", "to", " ", "line", " ", "up", " ", "sublim", "e", "'", "s", " ", "index", " ", "with", " ", "git", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "begin", "\\u", "line_", "+_", "1_", ",_", "end", "\\u", "line_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Document", "Command_", "(_", "Git", "Bla", "me", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bla", "me", "\\u", "done_", "(_", "self_", ",_", "result_", ",_", "focused", "\\u", "line_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sha", "s_", "=_", "set_", "(_", "(_", "sha_", "for_", "sha_", "in_", "re_", "._", "findall_", "(_", "r", "'", "^", "[", "0", "-", "9", "a", "-", "f", "]+'_", ",_", "result_", ",_", "re_", "._", "MULTILINE_", ")_", "if_", "not_", "re_", "._", "match_", "(_", "r", "'", "^", "0", "+$", "'_", ",_", "sha_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "=_", "[_", "'", "git", "'_", ",_", "'", "show", "'_", ",_", "'-", "s", "'_", ",_", "'-", "z", "'_", ",_", "'--", "no", "-", "color", "'_", ",_", "'--", "date", "=", "iso", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "command_", "._", "extend_", "(_", "sha", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "run", "\\u", "command_", "(_", "command_", ",_", "self_", "._", "show", "\\u", "done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Document", "Command_", "(_", "Git", "Bla", "me", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "done_", "(_", "self_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "commits_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "commit_", "in_", "result_", "._", "split_", "(_", "'\\\\", "0", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "search_", "(_", "r", "'", "^", "Date", ":\\\\", "s", "+(", ".+)", "$'_", ",_", "commit_", ",_", "re_", "._", "MULTILINE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "commits_", "._", "append_", "(_", "(_", "match_", "._", "group_", "(_", "1_", ")_", ",_", "commit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "commits_", "._", "sort_", "(_", "reverse_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "commits_", "=_", "[_", "commit_", "for_", "d_", ",_", "commit_", "in_", "commits_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "scratch", "_", "(_", "'\\\\", "n", "\\\\", "n", "'_", "._", "join_", "(_", "commits_", ")_", ",_", "title_", "=_", "\"", "Git", " ", "Commi", "t", " ", "Document", "ation", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "syntax_", "=_", "plugin", "\\u", "file_", "(_", "\"", "synta", "x", "/", "Git", " ", "Commi", "t", " ", "View", ".", "tm", "Lang", "ua", "ge", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Git", "Got", "o", "Commit_", "(_", "Git", "Text", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Git", "Got", "o", "Commit_", "(_", "Git", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ",_", "edit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", "=_", "self_", "._", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "view_", "._", "substr_", "(_", "view_", "._", "line_", "(_", "view_", "._", "sel_", "(_", ")_", "[_", "0_", "]_", "._", "a_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "commit_", "=_", "line_", "._", "split_", "(_", "\"", " ", "\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "commit_", "or_", "commit_", "==_", "\"", "00000000", "\"_", ":_", "\\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_", "working", "\\u", "dir_", "=_", "view_", "._", "settings_", "(_", ")_", "._", "get_", "(_", "\"", "git", "\\u", "root", "\\u", "dir", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "command_", "(_", "[_", "'", "git", "'_", ",_", "'", "show", "'_", ",_", "commit_", "]_", ",_", "self_", "._", "show", "\\u", "done_", ",_", "working", "\\u", "dir_", "=_", "working", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Got", "o", "Commit_", "(_", "Git", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "done_", "(_", "self_", ",_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "scratch", "_", "(_", "result_", ",_", "title_", "=_", "\"", "Git", " ", "Commi", "t", " ", "View", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "syntax_", "=_", "plugin", "\\u", "file_", "(_", "\"", "synta", "x", "/", "Git", " ", "Commi", "t", " ", "View", ".", "tm", "Lang", "ua", "ge", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Got", "o", "Commit_", "(_", "Git", "Text", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "enabled_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
idlesign/django-oauthost/oauthost/tests.py
[ { "content": " def test_grant_authorization_code(self):\n\n # Secure connection check\n settings.DEBUG = False\n resp = self.client.get(URL_TOKEN, {})\n self.assertEqual(resp.status_code, 403)\n settings.DEBUG = True\n\n resp = self.client.post(URL_TOKEN, {'grant_type': 'a'})\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'unsupported_grant_type')\n\n user_1 = User(username='Fred')\n user_1.set_password('12345')\n user_1.save()\n\n client_1 = Client(user=user_1, title='OClient')\n client_1.save()\n\n redirect_1 = RedirectionEndpoint(client=client_1, uri='http://redirect-test.com')\n redirect_1.save()\n\n code_1 = AuthorizationCode(user=user_1, client=client_1, uri=redirect_1.uri)\n code_1.save()\n\n Scope(identifier='scope1').save()\n\n # Missing client authentication data.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'authorization_code', 'scope': 'scope1'})\n self.assertEqual(resp.status_code, 401)\n self.assertEqual(resp.content_json['error'], 'invalid_client')\n\n # Missing all required params.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'authorization_code', 'scope': 'scope1',\n 'client_id': client_1.identifier, 'client_secret': client_1.password})\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_request')\n\n # Missing redirect URI.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'authorization_code', 'scope': 'scope1', 'code': 'wrong_code',\n 'client_id': client_1.identifier, 'client_secret': client_1.password})\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_request')\n\n # Missing code.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'authorization_code', 'scope': 'scope1',\n 'redirect_uri': 'http://wrong-url.com', 'client_id': client_1.identifier,\n 'client_secret': client_1.password})\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_request')\n\n # Wrong code.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'authorization_code', 'scope': 'scope1', 'code': 'invalid',\n 'redirect_uri': 'http://localhost:8000/abc/',\n 'client_id': client_1.identifier, 'client_secret': client_1.password})\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_grant')\n\n # Wrong URI.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'authorization_code', 'scope': 'scope1', 'code': code_1.code,\n 'redirect_uri': 'http://wrong-url.com/', 'client_id': client_1.identifier,\n 'client_secret': client_1.password})\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_grant')\n\n # Valid call for a token.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'authorization_code', 'scope': 'scope1', 'code': code_1.code,\n 'redirect_uri': redirect_1.uri, 'client_id': client_1.identifier,\n 'client_secret': client_1.password})\n self.assertEqual(resp.status_code, 200)\n self.assertTrue('access_token' in resp.content_json)\n self.assertTrue('refresh_token' in resp.content_json)\n self.assertTrue('token_type' in resp.content_json)\n\n # An additional call for code issues token and code invalidation.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'authorization_code', 'scope': 'scope1', 'code': '1234567',\n 'redirect_uri': 'http://localhost:8000/abc/',\n 'client_id': client_1.identifier, 'client_secret': client_1.password})\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_grant')", "metadata": "root.EndpointTokenCheck.test_grant_authorization_code", "header": "['class', 'EndpointTokenCheck', '(', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_authorization_code_unsafe(self):\n\n user_1 = User(username='Fred')\n user_1.set_password('12345')\n user_1.save()\n\n client_1 = Client(user=user_1, title='OClient')\n client_1.save()\n\n redirect_1 = RedirectionEndpoint(client=client_1, uri='http://redirect-test.com')\n redirect_1.save()\n\n Scope(identifier='scope1').save()\n\n # Logging the user in.\n self.client.login(username='Fred', password='12345')\n\n # Valid code request.\n resp = self.client.get(URL_AUTHORIZE, {'response_type': 'code', 'scope': 'scope1',\n 'client_id': client_1.identifier})\n self.assertEqual(resp.status_code, 200)\n\n # User confirms auth.\n resp = self.client.post(URL_AUTHORIZE, {'auth_decision': 'is_made', 'confirmed': 'yes'})\n self.assertEqual(resp.status_code, 302)\n params = parse_location_header(resp)\n self.assertIn('code', params)\n\n # Auth code given.\n code = params['code']\n\n # Valid token by code request.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'authorization_code', 'scope': 'scope1', 'code': code,\n 'redirect_uri': redirect_1.uri,\n 'client_id': client_1.identifier,\n 'client_secret': client_1.password})\n\n self.assertEqual(resp.status_code, 200)\n self.assertTrue('access_token' in resp.content_json)\n self.assertTrue('refresh_token' in resp.content_json)\n self.assertTrue('token_type' in resp.content_json)", "metadata": "root.GrantsCheck.test_authorization_code_unsafe", "header": "['class', 'GrantsCheck', '(', 'TestCase', ')', ':', '___EOS___']", "index": 283 }, { "content": " def test_authorization_code_http_basic(self):\n\n user_1 = User(username='Fred')\n user_1.set_password('12345')\n user_1.save()\n\n client_1 = Client(user=user_1, title='OClient', identifier='OClient', password='cl012345')\n client_1.save()\n\n redirect_1 = RedirectionEndpoint(client=client_1, uri='http://redirect-test.com')\n redirect_1.save()\n\n settings.DEBUG = True\n\n # Logging the user in.\n self.client.login(username='Fred', password='12345')\n\n Scope(identifier='scope1').save()\n\n # Valid code request.\n resp = self.client.get(URL_AUTHORIZE, {'response_type': 'code', 'scope': 'scope1',\n 'client_id': client_1.identifier})\n self.assertEqual(resp.status_code, 200)\n\n # User confirms auth.\n resp = self.client.post(URL_AUTHORIZE, {'auth_decision': 'is_made', 'confirmed': 'yes'})\n self.assertEqual(resp.status_code, 302)\n params = parse_location_header(resp)\n self.assertIn('code', params)\n\n # Auth code given.\n code = params['code']\n\n # Invalid token by code request.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'authorization_code', 'code': code,\n 'redirect_uri': redirect_1.uri},\n Authorization='Basic Tqrqwer==')\n self.assertEqual(resp.status_code, 401)\n self.assertIn('www-authenticate', resp._headers)\n self.assertEqual(resp._headers['www-authenticate'][1], 'Basic')\n\n # Valid token by code request.\n # HTTP Basic data - OClient:cl012345 --> T0NsaWVudDpjbDAxMjM0NQ==\n resp = self.client.post(\n URL_TOKEN, {'grant_type': 'authorization_code', 'scope': 'scope1', 'code': code,\n 'redirect_uri': redirect_1.uri},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n self.assertEqual(resp.status_code, 200)\n self.assertTrue('access_token' in resp.content_json)\n self.assertTrue('refresh_token' in resp.content_json)\n self.assertTrue('token_type' in resp.content_json)", "metadata": "root.GrantsCheck.test_authorization_code_http_basic", "header": "['class', 'GrantsCheck', '(', 'TestCase', ')', ':', '___EOS___']", "index": 325 }, { "content": " def test_scope(self):\n\n settings.DEBUG = True\n\n user_1 = User(username='Fred')\n user_1.set_password('12345')\n user_1.save()\n\n client_1 = Client(user=user_1, title='OClient1', identifier='OClient', password='cl012345')\n client_1.save()\n\n # Scope is missing.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'password', 'username': 'Fred', 'password': '12345'},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_scope')\n\n # No scope supported by server.\n resp = self.client.post(\n URL_TOKEN, {'grant_type': 'password', 'username': 'Fred', 'password': '12345', 'scope': 'my scope'},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_scope')\n\n scope1 = Scope(identifier='scope1')\n scope1.save()\n scope2 = Scope(identifier='scope2')\n scope2.save()\n scope3 = Scope(identifier='scope3', status=Scope.STATUS_DISABLED)\n scope3.save()\n\n client_2 = Client(user=user_1, title='OClien2', identifier='OClient2', password='cl012345')\n client_2.save()\n client_2.scopes.add(scope2)\n\n # Unsupported (or disabled) client scope request.\n resp = self.client.post(\n URL_TOKEN, {'grant_type': 'password', 'username': 'Fred', 'password': '12345', 'scope': 'scope1 scope2'},\n Authorization='Basic T0NsaWVudDI6Y2wwMTIzNDU=')\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_scope')\n\n # Unsupported (or disabled) server scope request.\n resp = self.client.post(\n URL_TOKEN, {'grant_type': 'password', 'username': 'Fred', 'password': '12345', 'scope': 'scope1 scope3'},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_scope')\n\n # Unsupported scope request.\n resp = self.client.post(\n URL_TOKEN, {'grant_type': 'password', 'username': 'Fred', 'password': '12345', 'scope': 'scope1'},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n # print('****' * 20)\n # print(resp.content_json['error_description'])\n # print('****' * 20)\n self.assertEqual(resp.status_code, 200)\n self.assertTrue('access_token' in resp.content_json)\n self.assertTrue('refresh_token' in resp.content_json)\n self.assertTrue('token_type' in resp.content_json)\n self.assertEqual(resp.content_json['scope'], 'scope1')", "metadata": "root.GrantsCheck.test_scope", "header": "['class', 'GrantsCheck', '(', 'TestCase', ')', ':', '___EOS___']", "index": 377 }, { "content": " def test_token_by_user_credentials(self):\n\n user_1 = User(username='Fred')\n user_1.set_password('12345')\n user_1.save()\n\n client_1 = Client(user=user_1, title='OClient', identifier='OClient', password='cl012345')\n client_1.save()\n\n redirect_1 = RedirectionEndpoint(client=client_1, uri='http://redirect-test.com')\n redirect_1.save()\n\n Scope(identifier='scope1').save()\n\n # Missing params.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'password', 'scope': 'scope1'},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_request')\n\n # Invalid params.\n resp = self.client.post(\n URL_TOKEN, {\n 'grant_type': 'password', 'scope': 'scope1', 'username': 'FalseUser', 'password': 'FalsePassword'\n },\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_grant')\n\n # Valid token by password request.\n resp = self.client.post(\n URL_TOKEN, {'grant_type': 'password', 'scope': 'scope1', 'username': 'Fred', 'password': '12345'},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n\n self.assertEqual(resp.status_code, 200)\n self.assertTrue('access_token' in resp.content_json)\n self.assertTrue('refresh_token' in resp.content_json)\n self.assertTrue('token_type' in resp.content_json)\n self.assertFalse('expires_in' in resp.content_json)", "metadata": "root.GrantsCheck.test_token_by_user_credentials", "header": "['class', 'GrantsCheck', '(', 'TestCase', ')', ':', '___EOS___']", "index": 439 }, { "content": " def test_token_by_client_credentials(self):\n\n user_1 = User(username='Fred')\n user_1.set_password('12345')\n user_1.save()\n\n client_1 = Client(user=user_1, title='OClient', identifier='OClient', password='cl012345')\n client_1.save()\n\n redirect_1 = RedirectionEndpoint(client=client_1, uri='http://redirect-test.com')\n redirect_1.save()\n\n Scope(identifier='scope1').save()\n\n # Valid token by client credentials request.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'client_credentials', 'scope': 'scope1'},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n\n self.assertEqual(resp.status_code, 200)\n self.assertTrue('access_token' in resp.content_json)\n self.assertTrue('refresh_token' not in resp.content_json)\n self.assertTrue('token_type' in resp.content_json)\n\n access_token = resp.content_json['access_token']\n token = Token.objects.get(access_token=access_token)\n self.assertEqual(user_1, token.user)", "metadata": "root.GrantsCheck.test_token_by_client_credentials", "header": "['class', 'GrantsCheck', '(', 'TestCase', ')', ':', '___EOS___']", "index": 479 }, { "content": " def test_refresh_token_http_basic(self):\n\n user_1 = User(username='Fred')\n user_1.set_password('12345')\n user_1.save()\n\n client_1 = Client(user=user_1, title='OClient', identifier='OClient', password='cl012345')\n client_1.save()\n\n client_2 = Client(user=user_1, title='OGOClient', identifier='OGOClient', password='cl543210')\n client_2.save()\n\n redirect_1 = RedirectionEndpoint(client=client_1, uri='http://redirect-test.com')\n redirect_1.save()\n\n token_1 = Token(client=client_1, user=user_1)\n token_1.save()\n\n token_2 = Token(client=client_2, user=user_1)\n token_2.save()\n\n date_issued = token_1.date_issued\n access_token = token_1.access_token\n refresh_token = token_1.refresh_token\n\n refresh_token_wrong_client = token_2.refresh_token\n\n # Missing required params.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'refresh_token'},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_request')\n\n # Invalid refresh token supplied.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'refresh_token', 'refresh_token': 'invalid'},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_grant')\n\n # Refresh token from another client is supplied.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'refresh_token', 'refresh_token': refresh_token_wrong_client},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n self.assertEqual(resp.status_code, 400)\n self.assertEqual(resp.content_json['error'], 'invalid_grant')\n\n # Valid request.\n resp = self.client.post(URL_TOKEN, {'grant_type': 'refresh_token', 'refresh_token': refresh_token},\n Authorization='Basic T0NsaWVudDpjbDAxMjM0NQ==')\n\n self.assertEqual(resp.status_code, 200)\n self.assertTrue('access_token' in resp.content_json)\n self.assertTrue('refresh_token' in resp.content_json)\n self.assertTrue('token_type' in resp.content_json)\n self.assertTrue('expires_in' not in resp.content_json)\n\n self.assertNotEqual(access_token, resp.content_json['access_token'])\n self.assertNotEqual(refresh_token, resp.content_json['refresh_token'])\n\n token_updated = Token.objects.get(access_token=resp.content_json['access_token'])\n self.assertNotEqual(date_issued, token_updated.date_issued)", "metadata": "root.GrantsCheck.test_refresh_token_http_basic", "header": "['class', 'GrantsCheck', '(', 'TestCase', ')', ':', '___EOS___']", "index": 506 } ]
[ { "span": "self.assertTrue('access_token' in resp.content_json)", "start_line": 149, "start_column": 8, "end_line": 149, "end_column": 60 }, { "span": "self.assertTrue('refresh_token' in resp.content_json)", "start_line": 150, "start_column": 8, "end_line": 150, "end_column": 61 }, { "span": "self.assertTrue('token_type' in resp.content_json)", "start_line": 151, "start_column": 8, "end_line": 151, "end_column": 58 }, { "span": "self.assertTrue('access_token' in resp.content_json)", "start_line": 321, "start_column": 8, "end_line": 321, "end_column": 60 }, { "span": "self.assertTrue('refresh_token' in resp.content_json)", "start_line": 322, "start_column": 8, "end_line": 322, "end_column": 61 }, { "span": "self.assertTrue('token_type' in resp.content_json)", "start_line": 323, "start_column": 8, "end_line": 323, "end_column": 58 }, { "span": "self.assertTrue('access_token' in resp.content_json)", "start_line": 373, "start_column": 8, "end_line": 373, "end_column": 60 }, { "span": "self.assertTrue('refresh_token' in resp.content_json)", "start_line": 374, "start_column": 8, "end_line": 374, "end_column": 61 }, { "span": "self.assertTrue('token_type' in resp.content_json)", "start_line": 375, "start_column": 8, "end_line": 375, "end_column": 58 }, { "span": "self.assertTrue('access_token' in resp.content_json)", "start_line": 434, "start_column": 8, "end_line": 434, "end_column": 60 }, { "span": "self.assertTrue('refresh_token' in resp.content_json)", "start_line": 435, "start_column": 8, "end_line": 435, "end_column": 61 }, { "span": "self.assertTrue('token_type' in resp.content_json)", "start_line": 436, "start_column": 8, "end_line": 436, "end_column": 58 }, { "span": "self.assertTrue('access_token' in resp.content_json)", "start_line": 474, "start_column": 8, "end_line": 474, "end_column": 60 }, { "span": "self.assertTrue('refresh_token' in resp.content_json)", "start_line": 475, "start_column": 8, "end_line": 475, "end_column": 61 }, { "span": "self.assertTrue('token_type' in resp.content_json)", "start_line": 476, "start_column": 8, "end_line": 476, "end_column": 58 }, { "span": "self.assertFalse('expires_in' in resp.content_json)", "start_line": 477, "start_column": 8, "end_line": 477, "end_column": 59 }, { "span": "self.assertTrue('access_token' in resp.content_json)", "start_line": 498, "start_column": 8, "end_line": 498, "end_column": 60 }, { "span": "self.assertTrue('refresh_token' not in resp.content_json)", "start_line": 499, "start_column": 8, "end_line": 499, "end_column": 65 }, { "span": "self.assertTrue('token_type' in resp.content_json)", "start_line": 500, "start_column": 8, "end_line": 500, "end_column": 58 }, { "span": "self.assertTrue('access_token' in resp.content_json)", "start_line": 556, "start_column": 8, "end_line": 556, "end_column": 60 }, { "span": "self.assertTrue('refresh_token' in resp.content_json)", "start_line": 557, "start_column": 8, "end_line": 557, "end_column": 61 }, { "span": "self.assertTrue('token_type' in resp.content_json)", "start_line": 558, "start_column": 8, "end_line": 558, "end_column": 58 }, { "span": "self.assertTrue('expires_in' not in resp.content_json)", "start_line": 559, "start_column": 8, "end_line": 559, "end_column": 62 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "End", "point", "Token", "Check_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "grant", "\\u", "authoriz", "ation", "\\u", "code_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Secur", "e", " ", "connecti", "on", " ", "check_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "._", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "._", "DEBUG_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "a", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "unsup", "porte", "d\\u", "grant", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "1_", "=_", "User_", "(_", "username_", "=_", "'", "Fre", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "set\\u", "password_", "(_", "'", "12345", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "1_", "=_", "Client_", "(_", "user_", "=_", "user", "\\u", "1_", ",_", "title_", "=_", "'", "OC", "lien", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "\\u", "1_", "=_", "Redirect", "ion", "Endpoint_", "(_", "client_", "=_", "client", "\\u", "1_", ",_", "uri_", "=_", "'", "http", "://", "redirec", "t", "-", "test", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "code", "\\u", "1_", "=_", "Authoriz", "ation", "Code_", "(_", "user_", "=_", "user", "\\u", "1_", ",_", "client_", "=_", "client", "\\u", "1_", ",_", "uri_", "=_", "redirec", "t", "\\u", "1_", "._", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Scope_", "(_", "identifier_", "=_", "'", "scope", "1", "'_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Missing", " ", "client", " ", "authenticat", "ion", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "authoriz", "ation", "\\u", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "401_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "client", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Missing", " ", "all", " ", "require", "d", " ", "params", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "authoriz", "ation", "\\u", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "id", "'_", ":_", "client", "\\u", "1_", "._", "identifier_", ",_", "'", "client", "\\u", "secret", "'_", ":_", "client", "\\u", "1_", "._", "password_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Missing", " ", "redirec", "t", " ", "URI", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "authoriz", "ation", "\\u", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "'", "code", "'_", ":_", "'", "wrong", "\\u", "code", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "id", "'_", ":_", "client", "\\u", "1_", "._", "identifier_", ",_", "'", "client", "\\u", "secret", "'_", ":_", "client", "\\u", "1_", "._", "password_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Missing", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "authoriz", "ation", "\\u", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "t", "\\u", "uri", "'_", ":_", "'", "http", "://", "wrong", "-", "url", ".", "com", "'_", ",_", "'", "client", "\\u", "id", "'_", ":_", "client", "\\u", "1_", "._", "identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "secret", "'_", ":_", "client", "\\u", "1_", "._", "password_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wro", "ng", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "authoriz", "ation", "\\u", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "'", "code", "'_", ":_", "'", "invalid", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "t", "\\u", "uri", "'_", ":_", "'", "http", "://", "local", "host", ":", "800", "0", "/", "abc", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "id", "'_", ":_", "client", "\\u", "1_", "._", "identifier_", ",_", "'", "client", "\\u", "secret", "'_", ":_", "client", "\\u", "1_", "._", "password_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wro", "ng", " ", "URI", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "authoriz", "ation", "\\u", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "'", "code", "'_", ":_", "code", "\\u", "1_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "t", "\\u", "uri", "'_", ":_", "'", "http", "://", "wrong", "-", "url", ".", "com", "/'_", ",_", "'", "client", "\\u", "id", "'_", ":_", "client", "\\u", "1_", "._", "identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "secret", "'_", ":_", "client", "\\u", "1_", "._", "password_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Valid", " ", "call", " ", "for", " ", "a", " ", "token", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "authoriz", "ation", "\\u", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "'", "code", "'_", ":_", "code", "\\u", "1_", "._", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "t", "\\u", "uri", "'_", ":_", "redirec", "t", "\\u", "1_", "._", "uri_", ",_", "'", "client", "\\u", "id", "'_", ":_", "client", "\\u", "1_", "._", "identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "secret", "'_", ":_", "client", "\\u", "1_", "._", "password_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "access", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "refre", "sh", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "token", "\\u", "type", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "An", " ", "addition", "al", " ", "call", " ", "for", " ", "code", " ", "issue", "s", " ", "token", " ", "and", " ", "code", " ", "invalid", "ation", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "authoriz", "ation", "\\u", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "'", "code", "'_", ":_", "'", "1234567", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "t", "\\u", "uri", "'_", ":_", "'", "http", "://", "local", "host", ":", "800", "0", "/", "abc", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "id", "'_", ":_", "client", "\\u", "1_", "._", "identifier_", ",_", "'", "client", "\\u", "secret", "'_", ":_", "client", "\\u", "1_", "._", "password_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Grant", "s", "Check_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "authoriz", "ation", "\\u", "code", "\\u", "unsafe", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "1_", "=_", "User_", "(_", "username_", "=_", "'", "Fre", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "set\\u", "password_", "(_", "'", "12345", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "1_", "=_", "Client_", "(_", "user_", "=_", "user", "\\u", "1_", ",_", "title_", "=_", "'", "OC", "lien", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "\\u", "1_", "=_", "Redirect", "ion", "Endpoint_", "(_", "client_", "=_", "client", "\\u", "1_", ",_", "uri_", "=_", "'", "http", "://", "redirec", "t", "-", "test", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Scope_", "(_", "identifier_", "=_", "'", "scope", "1", "'_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Log", "ging", " ", "the", " ", "user", " ", "in", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "username_", "=_", "'", "Fre", "d", "'_", ",_", "password_", "=_", "'", "12345", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Valid", " ", "code", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "URL", "\\u", "AUTHORI", "ZE", "_", ",_", "{_", "'", "response", "\\u", "type", "'_", ":_", "'", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "id", "'_", ":_", "client", "\\u", "1_", "._", "identifier_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "User", " ", "confirm", "s", " ", "auth", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "AUTHORI", "ZE", "_", ",_", "{_", "'", "auth", "\\u", "decision", "'_", ":_", "'", "is", "\\u", "made", "'_", ",_", "'", "confirm", "ed", "'_", ":_", "'", "ye", "s", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "parse", "\\u", "location", "\\u", "header_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "code", "'_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Auth", " ", "code", " ", "give", "n", "._", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "params_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Valid", " ", "token", " ", "by", " ", "code", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "authoriz", "ation", "\\u", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "'", "code", "'_", ":_", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "t", "\\u", "uri", "'_", ":_", "redirec", "t", "\\u", "1_", "._", "uri_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "id", "'_", ":_", "client", "\\u", "1_", "._", "identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "secret", "'_", ":_", "client", "\\u", "1_", "._", "password_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "access", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "refre", "sh", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "token", "\\u", "type", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Grant", "s", "Check_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "authoriz", "ation", "\\u", "code", "\\u", "http", "\\u", "basic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "1_", "=_", "User_", "(_", "username_", "=_", "'", "Fre", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "set\\u", "password_", "(_", "'", "12345", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "1_", "=_", "Client_", "(_", "user_", "=_", "user", "\\u", "1_", ",_", "title_", "=_", "'", "OC", "lien", "t", "'_", ",_", "identifier_", "=_", "'", "OC", "lien", "t", "'_", ",_", "password_", "=_", "'", "cl", "0123", "4", "5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "\\u", "1_", "=_", "Redirect", "ion", "Endpoint_", "(_", "client_", "=_", "client", "\\u", "1_", ",_", "uri_", "=_", "'", "http", "://", "redirec", "t", "-", "test", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "DEBUG_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Log", "ging", " ", "the", " ", "user", " ", "in", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "client_", "._", "login_", "(_", "username_", "=_", "'", "Fre", "d", "'_", ",_", "password_", "=_", "'", "12345", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Scope_", "(_", "identifier_", "=_", "'", "scope", "1", "'_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Valid", " ", "code", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "URL", "\\u", "AUTHORI", "ZE", "_", ",_", "{_", "'", "response", "\\u", "type", "'_", ":_", "'", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "client", "\\u", "id", "'_", ":_", "client", "\\u", "1_", "._", "identifier_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "User", " ", "confirm", "s", " ", "auth", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "AUTHORI", "ZE", "_", ",_", "{_", "'", "auth", "\\u", "decision", "'_", ":_", "'", "is", "\\u", "made", "'_", ",_", "'", "confirm", "ed", "'_", ":_", "'", "ye", "s", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "302_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "parse", "\\u", "location", "\\u", "header_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "code", "'_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Auth", " ", "code", " ", "give", "n", "._", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "params_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inva", "lid", " ", "token", " ", "by", " ", "code", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "authoriz", "ation", "\\u", "code", "'_", ",_", "'", "code", "'_", ":_", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "t", "\\u", "uri", "'_", ":_", "redirec", "t", "\\u", "1_", "._", "uri_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "Tq", "rq", "wer", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "401_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "www", "-", "authenticat", "e", "'_", ",_", "resp_", "._", "\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "\\u", "headers_", "[_", "'", "www", "-", "authenticat", "e", "'_", "]_", "[_", "1_", "]_", ",_", "'", "Basic", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Valid", " ", "token", " ", "by", " ", "code", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "HTTP", " ", "Basic", " ", "data", " ", "-", " ", "OC", "lien", "t", ":", "cl", "0123", "4", "5", " ", "-->", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "==_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "authoriz", "ation", "\\u", "code", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "'", "code", "'_", ":_", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "t", "\\u", "uri", "'_", ":_", "redirec", "t", "\\u", "1_", "._", "uri_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "access", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "refre", "sh", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "token", "\\u", "type", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Grant", "s", "Check_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "scope_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "._", "DEBUG_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "1_", "=_", "User_", "(_", "username_", "=_", "'", "Fre", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "set\\u", "password_", "(_", "'", "12345", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "1_", "=_", "Client_", "(_", "user_", "=_", "user", "\\u", "1_", ",_", "title_", "=_", "'", "OC", "lien", "t1", "'_", ",_", "identifier_", "=_", "'", "OC", "lien", "t", "'_", ",_", "password_", "=_", "'", "cl", "0123", "4", "5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sco", "pe", " ", "is", " ", "missi", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "password", "'_", ",_", "'", "user", "name", "'_", ":_", "'", "Fre", "d", "'_", ",_", "'", "password", "'_", ":_", "'", "12345", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "scope", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", " ", "scope", " ", "support", "ed", " ", "by", " ", "server", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "password", "'_", ",_", "'", "user", "name", "'_", ":_", "'", "Fre", "d", "'_", ",_", "'", "password", "'_", ":_", "'", "12345", "'_", ",_", "'", "scope", "'_", ":_", "'", "my", " ", "scope", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "scope", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scope", "1_", "=_", "Scope_", "(_", "identifier_", "=_", "'", "scope", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scope", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scope", "2_", "=_", "Scope_", "(_", "identifier_", "=_", "'", "scope", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scope", "2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scope", "3_", "=_", "Scope_", "(_", "identifier_", "=_", "'", "scope", "3", "'_", ",_", "status_", "=_", "Scope_", "._", "STATUS", "\\u", "DISABLED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scope", "3_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "2_", "=_", "Client_", "(_", "user_", "=_", "user", "\\u", "1_", ",_", "title_", "=_", "'", "OC", "lien", "2", "'_", ",_", "identifier_", "=_", "'", "OC", "lien", "t2", "'_", ",_", "password_", "=_", "'", "cl", "0123", "4", "5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "2_", "._", "scopes_", "._", "add_", "(_", "scope", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unsu", "ppo", "rted", " ", "(", "or", " ", "disable", "d", ")", " ", "client", " ", "scope", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "password", "'_", ",_", "'", "user", "name", "'_", ":_", "'", "Fre", "d", "'_", ",_", "'", "password", "'_", ":_", "'", "12345", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", " ", "scope", "2", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "DI", "6", "Y", "2w", "w", "MT", "Iz", "ND", "U", "='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "scope", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unsu", "ppo", "rted", " ", "(", "or", " ", "disable", "d", ")", " ", "server", " ", "scope", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "password", "'_", ",_", "'", "user", "name", "'_", ":_", "'", "Fre", "d", "'_", ",_", "'", "password", "'_", ":_", "'", "12345", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", " ", "scope", "3", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "scope", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unsu", "ppo", "rted", " ", "scope", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "password", "'_", ",_", "'", "user", "name", "'_", ":_", "'", "Fre", "d", "'_", ",_", "'", "password", "'_", ":_", "'", "12345", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", "('", "****", "'", " ", "*", " ", "20", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "(", "resp", ".", "content", "\\u", "json", "['", "error", "\\u", "description", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", "('", "****", "'", " ", "*", " ", "20", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "access", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "refre", "sh", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "token", "\\u", "type", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "scope", "'_", "]_", ",_", "'", "scope", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Grant", "s", "Check_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "token", "\\u", "by", "\\u", "user", "\\u", "credentials_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "1_", "=_", "User_", "(_", "username_", "=_", "'", "Fre", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "set\\u", "password_", "(_", "'", "12345", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "1_", "=_", "Client_", "(_", "user_", "=_", "user", "\\u", "1_", ",_", "title_", "=_", "'", "OC", "lien", "t", "'_", ",_", "identifier_", "=_", "'", "OC", "lien", "t", "'_", ",_", "password_", "=_", "'", "cl", "0123", "4", "5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "\\u", "1_", "=_", "Redirect", "ion", "Endpoint_", "(_", "client_", "=_", "client", "\\u", "1_", ",_", "uri_", "=_", "'", "http", "://", "redirec", "t", "-", "test", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Scope_", "(_", "identifier_", "=_", "'", "scope", "1", "'_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Missing", " ", "params", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "password", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inva", "lid", " ", "params", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "URL", "\\u", "TOKEN_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "grant", "\\u", "type", "'_", ":_", "'", "password", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "'", "user", "name", "'_", ":_", "'", "Fal", "se", "User", "'_", ",_", "'", "password", "'_", ":_", "'", "Fal", "se", "Passw", "ord", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Valid", " ", "token", " ", "by", " ", "password", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "password", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", ",_", "'", "user", "name", "'_", ":_", "'", "Fre", "d", "'_", ",_", "'", "password", "'_", ":_", "'", "12345", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "access", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "refre", "sh", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "token", "\\u", "type", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "expir", "es", "\\u", "in", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Grant", "s", "Check_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "token", "\\u", "by", "\\u", "client", "\\u", "credentials_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "1_", "=_", "User_", "(_", "username_", "=_", "'", "Fre", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "set\\u", "password_", "(_", "'", "12345", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "1_", "=_", "Client_", "(_", "user_", "=_", "user", "\\u", "1_", ",_", "title_", "=_", "'", "OC", "lien", "t", "'_", ",_", "identifier_", "=_", "'", "OC", "lien", "t", "'_", ",_", "password_", "=_", "'", "cl", "0123", "4", "5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "\\u", "1_", "=_", "Redirect", "ion", "Endpoint_", "(_", "client_", "=_", "client", "\\u", "1_", ",_", "uri_", "=_", "'", "http", "://", "redirec", "t", "-", "test", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Scope_", "(_", "identifier_", "=_", "'", "scope", "1", "'_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Valid", " ", "token", " ", "by", " ", "client", " ", "cred", "ential", "s", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "client", "\\u", "cred", "ential", "s", "'_", ",_", "'", "scope", "'_", ":_", "'", "scope", "1", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "access", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "refre", "sh", "\\u", "token", "'_", "not_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "token", "\\u", "type", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "access", "\\u", "token_", "=_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "access", "\\u", "token", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token_", "=_", "Token_", "._", "objects_", "._", "get_", "(_", "access", "\\u", "token_", "=_", "access", "\\u", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "user", "\\u", "1_", ",_", "token_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Grant", "s", "Check_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "refre", "sh", "\\u", "token", "\\u", "http", "\\u", "basic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "1_", "=_", "User_", "(_", "username_", "=_", "'", "Fre", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "set\\u", "password_", "(_", "'", "12345", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "1_", "=_", "Client_", "(_", "user_", "=_", "user", "\\u", "1_", ",_", "title_", "=_", "'", "OC", "lien", "t", "'_", ",_", "identifier_", "=_", "'", "OC", "lien", "t", "'_", ",_", "password_", "=_", "'", "cl", "0123", "4", "5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client", "\\u", "2_", "=_", "Client_", "(_", "user_", "=_", "user", "\\u", "1_", ",_", "title_", "=_", "'", "OG", "OC", "lien", "t", "'_", ",_", "identifier_", "=_", "'", "OG", "OC", "lien", "t", "'_", ",_", "password_", "=_", "'", "cl", "5432", "10", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "redirec", "t", "\\u", "1_", "=_", "Redirect", "ion", "Endpoint_", "(_", "client_", "=_", "client", "\\u", "1_", ",_", "uri_", "=_", "'", "http", "://", "redirec", "t", "-", "test", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "t", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "1_", "=_", "Token_", "(_", "client_", "=_", "client", "\\u", "1_", ",_", "user_", "=_", "user", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token", "\\u", "1_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "2_", "=_", "Token_", "(_", "client_", "=_", "client", "\\u", "2_", ",_", "user_", "=_", "user", "\\u", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token", "\\u", "2_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "date", "\\u", "issue", "d_", "=_", "token", "\\u", "1_", "._", "date", "\\u", "issue", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "access", "\\u", "token_", "=_", "token", "\\u", "1_", "._", "access", "\\u", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "refre", "sh", "\\u", "token_", "=_", "token", "\\u", "1_", "._", "refre", "sh", "\\u", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "refre", "sh", "\\u", "token", "\\u", "wrong", "\\u", "client_", "=_", "token", "\\u", "2_", "._", "refre", "sh", "\\u", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Missing", " ", "require", "d", " ", "params", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "refre", "sh", "\\u", "token", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "request", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inva", "lid", " ", "refre", "sh", " ", "token", " ", "supplie", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "refre", "sh", "\\u", "token", "'_", ",_", "'", "refre", "sh", "\\u", "token", "'_", ":_", "'", "invalid", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Refr", "esh", " ", "token", " ", "from", " ", "anot", "her", " ", "client", " ", "is", " ", "supplie", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "refre", "sh", "\\u", "token", "'_", ",_", "'", "refre", "sh", "\\u", "token", "'_", ":_", "refre", "sh", "\\u", "token", "\\u", "wrong", "\\u", "client_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "error", "'_", "]_", ",_", "'", "invalid", "\\u", "grant", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Valid", " ", "request", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "post_", "(_", "URL", "\\u", "TOKEN_", ",_", "{_", "'", "grant", "\\u", "type", "'_", ":_", "'", "refre", "sh", "\\u", "token", "'_", ",_", "'", "refre", "sh", "\\u", "token", "'_", ":_", "refre", "sh", "\\u", "token_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Authorization_", "=_", "'", "Basic", " ", "T", "0", "Ns", "a", "WV", "ud", "Dp", "jb", "DA", "x", "Mj", "M", "0", "NQ", "=='", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "access", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "refre", "sh", "\\u", "token", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "token", "\\u", "type", "'_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "expir", "es", "\\u", "in", "'_", "not_", "in_", "resp_", "._", "content", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "access", "\\u", "token_", ",_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "access", "\\u", "token", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "refre", "sh", "\\u", "token_", ",_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "refre", "sh", "\\u", "token", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "token", "\\u", "updated_", "=_", "Token_", "._", "objects_", "._", "get_", "(_", "access", "\\u", "token_", "=_", "resp_", "._", "content", "\\u", "json_", "[_", "'", "access", "\\u", "token", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Equal_", "(_", "date", "\\u", "issue", "d_", ",_", "token", "\\u", "updated_", "._", "date", "\\u", "issue", "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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/apps/beeswax/src/beeswax/migrations/0009_auto__chg_field_queryhistory_server_port.py
[ { "content": "# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n models = {\n 'auth.group': {\n 'Meta': {'object_name': 'Group'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),\n 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n 'auth.permission': {\n 'Meta': {'ordering': \"('content_type__app_label', 'content_type__model', 'codename')\", 'unique_together': \"(('content_type', 'codename'),)\", 'object_name': 'Permission'},\n 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n },\n 'auth.user': {\n 'Meta': {'object_name': 'User'},\n 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),\n 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Group']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n 'beeswax.metainstall': {\n 'Meta': {'object_name': 'MetaInstall'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'installed_example': ('django.db.models.fields.BooleanField', [], {'default': 'False'})\n },\n 'beeswax.queryhistory': {\n 'Meta': {'ordering': \"['-submission_date']\", 'object_name': 'QueryHistory'},\n 'design': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['beeswax.SavedQuery']\", 'null': 'True'}),\n 'has_results': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_state': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),\n 'log_context': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}),\n 'modified_row_count': ('django.db.models.fields.FloatField', [], {'null': 'True'}),\n 'notify': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'operation_type': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}),\n 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['auth.User']\"}),\n 'query': ('django.db.models.fields.TextField', [], {}),\n 'query_type': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),\n 'server_guid': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '1024', 'null': 'True'}),\n 'server_host': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '128'}),\n 'server_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True'}),\n 'server_name': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '128'}),\n 'server_port': ('django.db.models.fields.PositiveIntegerField', [], {'default': '10000'}),\n 'server_type': ('django.db.models.fields.CharField', [], {'default': \"'beeswax'\", 'max_length': '128'}),\n 'statement_number': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),\n 'submission_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'})\n },\n 'beeswax.savedquery': {\n 'Meta': {'ordering': \"['-mtime']\", 'object_name': 'SavedQuery'},\n 'data': ('django.db.models.fields.TextField', [], {'max_length': '65536'}),\n 'desc': ('django.db.models.fields.TextField', [], {'max_length': '1024'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_auto': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'is_trashed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),\n 'mtime': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),\n 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['auth.User']\"}),\n 'type': ('django.db.models.fields.IntegerField', [], {})\n },\n 'beeswax.session': {\n 'Meta': {'object_name': 'Session'},\n 'application': ('django.db.models.fields.CharField', [], {'default': \"'beeswax'\", 'max_length': '128'}),\n 'guid': ('django.db.models.fields.TextField', [], {'max_length': \"'100'\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_used': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),\n 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['auth.User']\"}),\n 'secret': ('django.db.models.fields.TextField', [], {'max_length': \"'100'\"}),\n 'server_protocol_version': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}),\n 'status_code': ('django.db.models.fields.PositiveSmallIntegerField', [], {})\n },\n 'contenttypes.contenttype': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n 'desktop.document': {\n 'Meta': {'object_name': 'Document'},\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['contenttypes.ContentType']\"}),\n 'description': ('django.db.models.fields.TextField', [], {'default': \"''\"}),\n 'extra': ('django.db.models.fields.TextField', [], {'default': \"''\"}),\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '255'}),\n 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),\n 'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'doc_owner'\", 'to': \"orm['auth.User']\"}),\n 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': \"orm['desktop.DocumentTag']\", 'db_index': 'True', 'symmetrical': 'False'}),\n 'version': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'})\n },\n 'desktop.documenttag': {\n 'Meta': {'object_name': 'DocumentTag'},\n 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': \"orm['auth.User']\"}),\n 'tag': ('django.db.models.fields.SlugField', [], {'max_length': '50'})\n }\n }\n\n complete_apps = ['beeswax']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n\n # Changing field 'QueryHistory.server_port'\n db.alter_column('beeswax_queryhistory', 'server_port', self.gf('django.db.models.fields.PositiveIntegerField')())", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n\n # Changing field 'QueryHistory.server_port'\n db.alter_column('beeswax_queryhistory', 'server_port', self.gf('django.db.models.fields.SmallIntegerField')())", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 14 } ]
[ { "span": "import datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 15 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "80", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "permissi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "content", "\\u", "type\\u\\u", "app", "\\u", "label", "',", " ", "'", "content", "\\u", "type\\u\\u", "model", "',", " ", "'", "code", "name", "')\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "content", "\\u", "type", "',", " ", "'", "code", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Permi", "ssion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", ".", "user", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Group", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "sta", "ff", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "super", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "login", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bee", "swa", "x", ".", "meta", "install", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Meta", "Install", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "install", "ed", "\\u", "example", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bee", "swa", "x", ".", "query", "histo", "ry", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'-", "subm", "ission", "\\u", "date", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Query", "Hist", "ory", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "design", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "bee", "swa", "x", ".", "Save", "d", "Query", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "has", "\\u", "results", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "state", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "\\u", "context", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1024", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "modifi", "ed", "\\u", "row", "\\u", "count", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Float", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "notif", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "operati", "on", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "guid", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Non", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "1024", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "host", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1024", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "port", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "10000", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "bee", "swa", "x", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "statem", "ent", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "subm", "ission", "\\u", "date", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "\\u", "add", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bee", "swa", "x", ".", "saved", "query", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'-", "mti", "me", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Save", "d", "Query", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "6553", "6", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "desc", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "1024", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "auto", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "trash", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mti", "me", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "64", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bee", "swa", "x", ".", "session", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Sess", "ion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "applica", "tion", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "bee", "swa", "x", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "guid", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "\"'", "100", "'\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "used", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "secret", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "\"'", "100", "'\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "\\u", "protoc", "ol", "\\u", "version", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "desk", "top", ".", "document", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Document", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "modifi", "ed", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "auto", "\\u", "now", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "255", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "doc", "\\u", "owner", "'\"_", ",_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tags", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "desk", "top", ".", "Document", "Ta", "g", "']\"_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Small", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "1", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "desk", "top", ".", "document", "tag", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Document", "Ta", "g", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tag", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Sl", "ug", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "bee", "swa", "x", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Chang", "ing", " ", "field", " ", "'", "Query", "Hist", "ory", ".", "server", "\\u", "port", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "alter", "\\u", "column_", "(_", "'", "bee", "swa", "x", "\\u", "query", "histo", "ry", "'_", ",_", "'", "server", "\\u", "port", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ")_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Chang", "ing", " ", "field", " ", "'", "Query", "Hist", "ory", ".", "server", "\\u", "port", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "alter", "\\u", "column_", "(_", "'", "bee", "swa", "x", "\\u", "query", "histo", "ry", "'_", ",_", "'", "server", "\\u", "port", "'_", ",_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Small", "Integer", "Field", "'_", ")_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
hltbra/pyhistorian/pyhistorian/scenario.py
[ { "content": "from language import (StoryLanguage,\n TEMPLATE_PATTERN,\n convert_from_cammel_case_to_spaces,\n format_traceback)\nfrom output import OutputWriter, colored\nfrom steps import pending\nimport re\nimport sys\nimport traceback\n\n__all__ = ['Scenario', 'Cenario',]\n\n \n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Scenario(object):\n _givens = []\n _whens = []\n _thens = []\n \n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Scenario", "header": "['module', '___EOS___']", "index": 12 }, { "content": " @staticmethod\n @pending\n def undefined_step(*args, **kw):\n \"\"\"it doesn't do anything, is just marked as pending\"\"\"", "metadata": "root.Scenario.undefined_step", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 17 }, { "content": " def __init__(self, story):\n self._title = self._get_title_from_class_name_or_docstring()\n self._story = story\n self._language = story._language\n self._output = story._output\n self._should_be_colored = story.colored\n self._failures = []\n self._errors = []\n self._pendings = []\n self._failure_color = story.failure_color\n self._error_color = story.error_color\n self._pending_color = story.pending_color\n self._output_writer = OutputWriter(self._output,\n self._language,\n self._should_be_colored)", "metadata": "root.Scenario.__init__", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 22 }, { "content": " def _get_title_from_class_name_or_docstring(self):\n \"\"\"returns the docstring if defined or\n the class name converted from cammel case to spaces\"\"\"\n return self.__doc__ or\\\n convert_from_cammel_case_to_spaces(self.__class__.__name__)", "metadata": "root.Scenario._get_title_from_class_name_or_docstring", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": " def _colored(self, message, color):\n \"\"\"returns message colored with color\n if the scenario is allowed to use colors\"\"\"\n if self._should_be_colored:\n return colored(message, color)\n return message", "metadata": "root.Scenario._colored", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 44 }, { "content": " def _get_message_with_values_based_on_template(self, message, args):\n \"\"\"returns a message based on a template and values:\n message_template -> Hello (.+)!\n values -> [World]\n message returned -> Hello World!\"\"\"\n for arg in args:\n message = re.sub(TEMPLATE_PATTERN, str(arg), message, 1)\n return message", "metadata": "root.Scenario._get_message_with_values_based_on_template", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 51 }, { "content": " def _get_traceback_info(self):\n \"\"\"this method is like traceback.format_exc,\n but it internationalizates the phrase and\n it doesn't need parameters\"\"\"\n exc, value, tb = sys.exc_info()\n return format_traceback(exc, value, tb, self._language)", "metadata": "root.Scenario._get_traceback_info", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 60 }, { "content": " def _run_step(self, step, step_name):\n method, message_template, args = step\n message = self._get_message_with_values_based_on_template(message_template, args)\n if hasattr(method, 'pending'):\n self._pendings.append(method)\n self._output_writer.output_pending_step_line(step_name,\n message,\n self._pending_color)\n return\n try:\n method(self, *args)\n self._output_writer.output_ok_step_line(step_name,\n message,\n 'green')\n except AssertionError, e:\n self._failures.append(self._get_traceback_info())\n self._output_writer.output_fail_step_line(step_name,\n message,\n self._failure_color)\n except Exception, e:\n self._errors.append(self._get_traceback_info())\n self._output_writer.output_error_step_line(step_name,\n message,\n self._error_color)", "metadata": "root.Scenario._run_step", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": " def __getattr__(self, attr):\n \"\"\" first look at the scenario instance,\n and if it does not find the attr, it looks to story's namespace.\n it is useful to ``before_all`` and ``before_each`` story's methods\n \"\"\"\n if attr not in self.__dict__:\n try:\n return getattr(self.__getattribute__('_story').namespace, attr)\n except AttributeError:\n pass\n return self.__getattribute__(attr)", "metadata": "root.Scenario.__getattr__", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 92 }, { "content": " def __setattr__(self, attr, value):\n \"\"\" first look at the scenario instance,\n and if it does not find the attr, it looks to story's namespace.\n it is useful to ``before_all`` and ``before_each`` story's methods\n \"\"\"\n if attr not in self.__dict__:\n if getattr(self, '_story', None) and getattr(self._story, 'namespace', None):\n setattr(self._story.namespace, attr, value)\n return\n object.__setattr__(self, attr, value)", "metadata": "root.Scenario.__setattr__", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 104 }, { "content": " @property\n def title(self):\n return self._title", "metadata": "root.Scenario.title", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 115 }, { "content": " def run_steps(self, steps, step_name):\n if len(steps) == 0:\n return\n self._run_step(steps[0], step_name)\n for step in steps[1:]:\n self._run_step(step, 'and')", "metadata": "root.Scenario.run_steps", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 119 }, { "content": " def run(self):\n self.run_steps(self._givens, 'given')\n self.run_steps(self._whens, 'when')\n self.run_steps(self._thens, 'then')\n self._output_writer.output_failures_info(self._failures,\n self._failure_color)\n self._output_writer.output_errors_info(self._errors,\n self._error_color)\n return (self._failures, self._errors, self._pendings)", "metadata": "root.Scenario.run", "header": "['class', 'Scenario', '(', 'object', ')', ':', '___EOS___']", "index": 126 }, { "content": "class Cenario(Scenario):\n \"\"\"Portuguese translation\"\"\"", "metadata": "root.Cenario", "header": "['module', '___EOS___']", "index": 137 } ]
[ { "span": "from language import (StoryLanguage,\n TEMPLATE_PATTERN,\n convert_from_cammel_case_to_spaces,\n format_traceback)", "start_line": 0, "start_column": 0, "end_line": 3, "end_column": 39 }, { "span": "import traceback", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "language_", "import_", "(_", "Stor", "y", "Language_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "PATTERN_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "convert", "\\u", "from", "\\u", "cam", "mel", "\\u", "case", "\\u", "to", "\\u", "spaces_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "format\\u", "traceback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "output_", "import_", "Output", "Writer_", ",_", "colored_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "steps_", "import_", "pending_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Scen", "ario", "'_", ",_", "'", "Cen", "ario", "'_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Scenario_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "give", "ns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "whe", "ns_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "then", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "pending_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "undefined", "\\u", "step_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "it", " ", "doe", "sn", "'", "t", " ", "do", " ", "anyt", "hing", ",", " ", "is", " ", "just", " ", "marked", " ", "as", " ", "pend", "ing", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "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_", ",_", "story_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "title_", "=_", "self_", "._", "\\u", "get", "\\u", "title", "\\u", "from", "\\u", "class", "\\u", "name", "\\u", "or", "\\u", "docstring_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "story_", "=_", "story_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "language_", "=_", "story_", "._", "\\u", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "output_", "=_", "story_", "._", "\\u", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "shou", "ld", "\\u", "be", "\\u", "colored_", "=_", "story_", "._", "colored_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "failures_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pend", "ings_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "fail", "ure", "\\u", "color_", "=_", "story_", "._", "fail", "ure", "\\u", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "error", "\\u", "color_", "=_", "story_", "._", "error", "\\u", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pend", "ing", "\\u", "color_", "=_", "story_", "._", "pend", "ing", "\\u", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "output", "\\u", "writer_", "=_", "Output", "Writer_", "(_", "self_", "._", "\\u", "output_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "language_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "shou", "ld", "\\u", "be", "\\u", "colored_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "title", "\\u", "from", "\\u", "class", "\\u", "name", "\\u", "or", "\\u", "docstring_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "return", "s", " ", "the", " ", "docstr", "ing", " ", "if", " ", "defin", "ed", " ", "or", "\\", "10", ";", " ", " ", " ", "the", " ", "class", " ", "name", " ", "convert", "ed", " ", "from", " ", "cam", "mel", " ", "case", " ", "to", " ", "space", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "doc\\u\\u_", "or_", "convert", "\\u", "from", "\\u", "cam", "mel", "\\u", "case", "\\u", "to", "\\u", "spaces_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "colored_", "(_", "self_", ",_", "message_", ",_", "color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "return", "s", " ", "message", " ", "colore", "d", " ", "with", " ", "color", "\\", "10", ";", " ", " ", " ", "if", " ", "the", " ", "scen", "ario", " ", "is", " ", "allow", "ed", " ", "to", " ", "use", " ", "colors", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "shou", "ld", "\\u", "be", "\\u", "colored_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "colored_", "(_", "message_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "message", "\\u", "with", "\\u", "values", "\\u", "based", "\\u", "on", "\\u", "template_", "(_", "self_", ",_", "message_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "return", "s", " ", "a", " ", "message", " ", "based", " ", "on", " ", "a", " ", "template", " ", "and", " ", "values", ":", "\\", "10", ";", " ", " ", " ", "message", "\\u", "template", " ", "->", " ", "Hell", "o", " ", "(.+", ")!", "\\", "10", ";", " ", " ", " ", "values", " ", "->", " ", "[", "Wor", "ld", "]", "\\", "10", ";", " ", " ", " ", "message", " ", "return", "ed", " ", "->", " ", "Hell", "o", " ", "Wor", "ld", "!\"", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "re_", "._", "sub_", "(_", "TEMPL", "ATE", "\\u", "PATTERN_", ",_", "str_", "(_", "arg_", ")_", ",_", "message_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "traceback", "\\u", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "this", " ", "method", " ", "is", " ", "like", " ", "traceback", ".", "format\\u", "exc", ",", "\\", "10", ";", " ", " ", " ", " ", "but", " ", "it", " ", "international", "iza", "tes", " ", "the", " ", "phrase", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "doe", "sn", "'", "t", " ", "need", " ", "parameter", "s", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc_", ",_", "value_", ",_", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "format\\u", "traceback_", "(_", "exc_", ",_", "value_", ",_", "tb_", ",_", "self_", "._", "\\u", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "step_", "(_", "self_", ",_", "step_", ",_", "step", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", ",_", "message", "\\u", "template_", ",_", "args_", "=_", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "self_", "._", "\\u", "get", "\\u", "message", "\\u", "with", "\\u", "values", "\\u", "based", "\\u", "on", "\\u", "template_", "(_", "message", "\\u", "template_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "method_", ",_", "'", "pend", "ing", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "pend", "ings_", "._", "append_", "(_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "output", "\\u", "writer_", "._", "output", "\\u", "pend", "ing", "\\u", "step", "\\u", "line_", "(_", "step", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "pend", "ing", "\\u", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\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 ", " _", "method_", "(_", "self_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "output", "\\u", "writer_", "._", "output", "\\u", "ok", "\\u", "step", "\\u", "line_", "(_", "step", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "green", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assert", "ion", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "failures_", "._", "append_", "(_", "self_", "._", "\\u", "get", "\\u", "traceback", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "output", "\\u", "writer_", "._", "output", "\\u", "fail", "\\u", "step", "\\u", "line_", "(_", "step", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "fail", "ure", "\\u", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "errors_", "._", "append_", "(_", "self_", "._", "\\u", "get", "\\u", "traceback", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "output", "\\u", "writer_", "._", "output", "\\u", "error", "\\u", "step", "\\u", "line_", "(_", "step", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "error", "\\u", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "first", " ", "look", " ", "at", " ", "the", " ", "scen", "ario", " ", "instance", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "if", " ", "it", " ", "doe", "s", " ", "not", " ", "find", " ", "the", " ", "attr", ",", " ", "it", " ", "look", "s", " ", "to", " ", "stor", "y", "'", "s", " ", "namespace", ".", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "is", " ", "usef", "ul", " ", "to", " ", "``", "bef", "ore", "\\u", "all", "``", " ", "and", " ", "``", "bef", "ore", "\\u", "each", "``", " ", "stor", "y", "'", "s", " ", "method", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "attr_", "not_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", ":_", "\\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_", "getattr_", "(_", "self_", "._", "\\u\\u", "getattribute\\u\\u_", "(_", "'\\u", "stor", "y", "'_", ")_", "._", "namespace_", ",_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "getattribute\\u\\u_", "(_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setattr\\u\\u_", "(_", "self_", ",_", "attr_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "first", " ", "look", " ", "at", " ", "the", " ", "scen", "ario", " ", "instance", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "if", " ", "it", " ", "doe", "s", " ", "not", " ", "find", " ", "the", " ", "attr", ",", " ", "it", " ", "look", "s", " ", "to", " ", "stor", "y", "'", "s", " ", "namespace", ".", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "is", " ", "usef", "ul", " ", "to", " ", "``", "bef", "ore", "\\u", "all", "``", " ", "and", " ", "``", "bef", "ore", "\\u", "each", "``", " ", "stor", "y", "'", "s", " ", "method", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "attr_", "not_", "in_", "self_", "._", "\\u\\u", "dict\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "getattr_", "(_", "self_", ",_", "'\\u", "stor", "y", "'_", ",_", "None_", ")_", "and_", "getattr_", "(_", "self_", "._", "\\u", "story_", ",_", "'", "namespace", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "setattr_", "(_", "self_", "._", "\\u", "story_", "._", "namespace_", ",_", "attr_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object_", "._", "\\u\\u", "setattr\\u\\u_", "(_", "self_", ",_", "attr_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "title_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "title_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "steps_", "(_", "self_", ",_", "steps_", ",_", "step", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "steps_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "step_", "(_", "steps_", "[_", "0_", "]_", ",_", "step", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "step_", "in_", "steps_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run", "\\u", "step_", "(_", "step_", ",_", "'", "and", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scenario_", "(_", "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_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "run", "\\u", "steps_", "(_", "self_", "._", "\\u", "give", "ns_", ",_", "'", "give", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "steps_", "(_", "self_", "._", "\\u", "whe", "ns_", ",_", "'", "whe", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "run", "\\u", "steps_", "(_", "self_", "._", "\\u", "then", "s_", ",_", "'", "then", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "output", "\\u", "writer_", "._", "output", "\\u", "fail", "ure", "s", "\\u", "info_", "(_", "self_", "._", "\\u", "failures_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "fail", "ure", "\\u", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "output", "\\u", "writer_", "._", "output", "\\u", "error", "s", "\\u", "info_", "(_", "self_", "._", "\\u", "errors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "error", "\\u", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "self_", "._", "\\u", "failures_", ",_", "self_", "._", "\\u", "errors_", ",_", "self_", "._", "\\u", "pend", "ings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Cen", "ario", "_", "(_", "Scenario_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Portug", "ues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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, 4, 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
kayhayen/Nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Environment.py
[ { "content": " def __init__(self, **kw):\n \"\"\"Initialization of an underlying SubstitutionEnvironment class.\n \"\"\"\n if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.SubstitutionEnvironment')\n self.fs = SCons.Node.FS.get_default_fs()\n self.ans = SCons.Node.Alias.default_ans\n self.lookup_list = SCons.Node.arg2nodes_lookups\n self._dict = kw.copy()\n self._init_special()\n self.added_methods = []\n #self._memo = {}", "metadata": "root.SubstitutionEnvironment.__init__", "header": "['class', 'SubstitutionEnvironment', '(', 'object', ')', ':', '___EOS___']", "index": 370 }, { "content": "class Base(SubstitutionEnvironment):\n \"\"\"Base class for \"real\" construction Environments. These are the\n primary objects used to communicate dependency and construction\n information to the build engine.\n\n Keyword arguments supplied when the construction Environment\n is created are construction variables used to initialize the\n Environment.\n \"\"\"\n\n memoizer_counters = []\n\n #######################################################################\n # This is THE class for interacting with the SCons build engine,\n # and it contains a lot of stuff, so we're going to try to keep this\n # a little organized by grouping the methods.\n #######################################################################\n\n #######################################################################\n # Methods that make an Environment act like a dictionary. These have\n # the expected standard names for Python mapping objects. Note that\n # we don't actually make an Environment a subclass of UserDict for\n # performance reasons. Note also that we only supply methods for\n # dictionary functionality that we actually need and use.\n #######################################################################\n\n\n #######################################################################\n # Utility methods that are primarily for internal use by SCons.\n # These begin with lower-case letters.\n #######################################################################\n\n\n\n\n memoizer_counters.append(SCons.Memoize.CountValue('_gsm'))\n\n\n\n\n\n\n\n #######################################################################\n # Public methods for manipulating an Environment. These begin with\n # upper-case letters. The essential characteristic of methods in\n # this section is that they do *not* have corresponding same-named\n # global functions. For example, a stand-alone Append() function\n # makes no sense, because Append() is all about appending values to\n # an Environment's construction variables.\n #######################################################################\n\n\n # allow Dirs and strings beginning with # for top-relative\n # Note this uses the current env's fs (in self).\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n #######################################################################\n # Public methods for doing real \"SCons stuff\" (manipulating\n # dependencies, setting attributes on targets, etc.). These begin\n # with upper-case letters. The essential characteristic of methods\n # in this section is that they all *should* have corresponding\n # same-named global functions.\n #######################################################################\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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.Base", "header": "['module', '___EOS___']", "index": 891 }, { "content": " def __init__(self,\n platform=None,\n tools=None,\n toolpath=None,\n variables=None,\n parse_flags = None,\n **kw):\n \"\"\"\n Initialization of a basic SCons construction environment,\n including setting up special construction variables like BUILDER,\n PLATFORM, etc., and searching for and applying available Tools.\n\n Note that we do *not* call the underlying base class\n (SubsitutionEnvironment) initialization, because we need to\n initialize things in a very specific order that doesn't work\n with the much simpler base class initialization.\n \"\"\"\n if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.Base')\n self._memo = {}\n self.fs = SCons.Node.FS.get_default_fs()\n self.ans = SCons.Node.Alias.default_ans\n self.lookup_list = SCons.Node.arg2nodes_lookups\n self._dict = semi_deepcopy(SCons.Defaults.ConstructionEnvironment)\n self._init_special()\n self.added_methods = []\n\n # We don't use AddMethod, or define these as methods in this\n # class, because we *don't* want these functions to be bound\n # methods. They need to operate independently so that the\n # settings will work properly regardless of whether a given\n # target ends up being built with a Base environment or an\n # OverrideEnvironment or what have you.\n self.decide_target = default_decide_target\n self.decide_source = default_decide_source\n\n self.copy_from_cache = default_copy_from_cache\n\n self._dict['BUILDERS'] = BuilderDict(self._dict['BUILDERS'], self)\n\n if platform is None:\n platform = self._dict.get('PLATFORM', None)\n if platform is None:\n platform = SCons.Platform.Platform()\n if SCons.Util.is_String(platform):\n platform = SCons.Platform.Platform(platform)\n self._dict['PLATFORM'] = str(platform)\n platform(self)\n\n self._dict['HOST_OS'] = self._dict.get('HOST_OS',None)\n self._dict['HOST_ARCH'] = self._dict.get('HOST_ARCH',None)\n\n # Now set defaults for TARGET_{OS|ARCH}\n self._dict['TARGET_OS'] = self._dict.get('TARGET_OS',None)\n self._dict['TARGET_ARCH'] = self._dict.get('TARGET_ARCH',None)\n\n\n # Apply the passed-in and customizable variables to the\n # environment before calling the tools, because they may use\n # some of them during initialization.\n if 'options' in kw:\n # Backwards compatibility: they may stll be using the\n # old \"options\" keyword.\n variables = kw['options']\n del kw['options']\n self.Replace(**kw)\n keys = list(kw.keys())\n if variables:\n keys = keys + list(variables.keys())\n variables.Update(self)\n\n save = {}\n for k in keys:\n try:\n save[k] = self._dict[k]\n except KeyError:\n # No value may have been set if they tried to pass in a\n # reserved variable name like TARGETS.\n pass\n\n SCons.Tool.Initializers(self)\n\n if tools is None:\n tools = self._dict.get('TOOLS', None)\n if tools is None:\n tools = ['default']\n apply_tools(self, tools, toolpath)\n\n # Now restore the passed-in and customized variables\n # to the environment, since the values the user set explicitly\n # should override any values set by the tools.\n for key, val in save.items():\n self._dict[key] = val\n\n # Finally, apply any flags to be merged in\n if parse_flags: self.MergeFlags(parse_flags)", "metadata": "root.Base.__init__", "header": "['class', 'Base', '(', 'SubstitutionEnvironment', ')', ':', '___EOS___']", "index": 917 }, { "content": "class OverrideEnvironment(Base):\n \"\"\"A proxy that overrides variables in a wrapped construction\n environment by returning values from an overrides dictionary in\n preference to values from the underlying subject environment.\n\n This is a lightweight (I hope) proxy that passes through most use of\n attributes to the underlying Environment.Base class, but has just\n enough additional methods defined to act like a real construction\n environment with overridden values. It can wrap either a Base\n construction environment, or another OverrideEnvironment, which\n can in turn nest arbitrary OverrideEnvironments...\n\n Note that we do *not* call the underlying base class\n (SubsitutionEnvironment) initialization, because we get most of those\n from proxying the attributes of the subject construction environment.\n But because we subclass SubstitutionEnvironment, this class also\n has inherited arg2nodes() and subst*() methods; those methods can't\n be proxied because they need *this* object's methods to fetch the\n values from the overrides dictionary.\n \"\"\"\n\n\n # Methods that make this class act like a proxy.\n\n # Methods that make this class act like a dictionary.\n\n # Overridden private construction environment methods.\n\n\n\n # Overridden public construction environment methods.", "metadata": "root.OverrideEnvironment", "header": "['module', '___EOS___']", "index": 2259 }, { "content": " def __init__(self, subject, overrides={}):\n if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.OverrideEnvironment')\n self.__dict__['__subject'] = subject\n self.__dict__['overrides'] = overrides", "metadata": "root.OverrideEnvironment.__init__", "header": "['class', 'OverrideEnvironment', '(', 'Base', ')', ':', '___EOS___']", "index": 2280 } ]
[ { "span": "class Base(SubstitutionEnvironment):", "start_line": 891, "start_column": 0, "end_line": 891, "end_column": 36 }, { "span": "class OverrideEnvironment(Base):", "start_line": 2259, "start_column": 0, "end_line": 2259, "end_column": 32 } ]
[ { "span": "def __init__(self, **kw):", "start_line": 370, "start_column": 4, "end_line": 370, "end_column": 29 }, { "span": "def __init__(self,\n platform=None,\n tools=None,\n toolpath=None,\n variables=None,\n parse_flags = None,\n **kw):", "start_line": 917, "start_column": 4, "end_line": 923, "end_column": 23 }, { "span": "def __init__(self, subject, overrides={}):", "start_line": 2280, "start_column": 4, "end_line": 2280, "end_column": 46 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Substituti", "on", "Environment_", "(_", "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_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "ation", " ", "of", " ", "an", " ", "underl", "ying", " ", "Substituti", "on", "Environ", "ment", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "SC", "ons_", "._", "Debug_", "._", "track", "\\u", "instances_", ":_", "log", "Insta", "nce", "Creat", "ion_", "(_", "self_", ",_", "'", "Environ", "ment", ".", "Substituti", "on", "Environ", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fs_", "=_", "SC", "ons_", "._", "Node_", "._", "FS_", "._", "get", "\\u", "default", "\\u", "fs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ans_", "=_", "SC", "ons_", "._", "Node_", "._", "Alias_", "._", "default", "\\u", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "look", "up", "\\u", "list_", "=_", "SC", "ons_", "._", "Node_", "._", "arg", "2n", "odes", "\\u", "lookups", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dict_", "=_", "kw_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "init", "\\u", "special_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "adde", "d\\u", "methods_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".\\u", "memo", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base_", "(_", "Substituti", "on", "Environment_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "\"", "real", "\"", " ", "constructi", "on", " ", "Environ", "ment", "s", ".", " ", " ", "The", "se", " ", "are", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "primary", " ", "object", "s", " ", "used", " ", "to", " ", "communi", "cate", " ", "dependen", "cy", " ", "and", " ", "constructi", "on", "\\", "10", ";", " ", " ", " ", " ", "informati", "on", " ", "to", " ", "the", " ", "build", " ", "eng", "ine", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Key", "word", " ", "argu", "ment", "s", " ", "supplie", "d", " ", "whe", "n", " ", "the", " ", "constructi", "on", " ", "Environ", "ment", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "created", " ", "are", " ", "constructi", "on", " ", "variab", "les", " ", "used", " ", "to", " ", "initialize", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Environ", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "memo", "ize", "r", "\\u", "counters_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "THE", " ", "class", " ", "for", " ", "interacti", "ng", " ", "with", " ", "the", " ", "SC", "ons", " ", "build", " ", "eng", "ine", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "it", " ", "contain", "s", " ", "a", " ", "lot", " ", "of", " ", "stu", "ff", ",", " ", "so", " ", "we", "'", "re", " ", "goi", "ng", " ", "to", " ", "try", " ", "to", " ", "keep", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "litt", "le", " ", "organize", "d", " ", "by", " ", "grouping", " ", "the", " ", "method", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Meth", "ods", " ", "tha", "t", " ", "make", " ", "an", " ", "Environ", "ment", " ", "act", " ", "like", " ", "a", " ", "dictionar", "y", ".", " ", " ", "The", "se", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "expected", " ", "standard", " ", "names", " ", "for", " ", "Pyth", "on", " ", "mapping", " ", "object", "s", ".", " ", " ", "Not", "e", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "actual", "ly", " ", "make", " ", "an", " ", "Environ", "ment", " ", "a", " ", "subclass", " ", "of", " ", "User", "Dict", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "perform", "anc", "e", " ", "reasons", ".", " ", " ", "Not", "e", " ", "als", "o", " ", "tha", "t", " ", "we", " ", "only", " ", "supply", " ", "method", "s", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dictionar", "y", " ", "functional", "it", "y", " ", "tha", "t", " ", "we", " ", "actual", "ly", " ", "need", " ", "and", " ", "use", "._", "\\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_", "#", " ", "Utili", "ty", " ", "method", "s", " ", "tha", "t", " ", "are", " ", "prima", "ri", "ly", " ", "for", " ", "internal", " ", "use", " ", "by", " ", "SC", "ons", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "se", " ", "begin", " ", "with", " ", "lower", "-", "case", " ", "letter", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "memo", "ize", "r", "\\u", "counters_", "._", "append_", "(_", "SC", "ons_", "._", "Memo", "ize_", "._", "Count", "Value_", "(_", "'\\u", "gsm", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Public", " ", "method", "s", " ", "for", " ", "manipulati", "ng", " ", "an", " ", "Environ", "ment", ".", " ", " ", "The", "se", " ", "begin", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "upper", "-", "case", " ", "letter", "s", ".", " ", " ", "The", " ", "essential", " ", "characteristic", " ", "of", " ", "method", "s", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "section", " ", "is", " ", "tha", "t", " ", "the", "y", " ", "do", " ", "*", "not", "*", " ", "have", " ", "correspond", "ing", " ", "same", "-", "named_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "global", " ", "function", "s", ".", " ", " ", "For", " ", "example", ",", " ", "a", " ", "stand", "-", "alo", "ne", " ", "Append", "()", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", "s", " ", "no", " ", "sense", ",", " ", "bec", "aus", "e", " ", "Append", "()", " ", "is", " ", "all", " ", "abo", "ut", " ", "appendi", "ng", " ", "values", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "an", " ", "Environ", "ment", "'", "s", " ", "constructi", "on", " ", "variab", "les", "._", "\\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_", "#", " ", "allow", " ", "Dir", "s", " ", "and", " ", "string", "s", " ", "beginn", "ing", " ", "with", " ", "#", " ", "for", " ", "top", "-", "relative_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "this", " ", "use", "s", " ", "the", " ", "current", " ", "env", "'", "s", " ", "fs", " ", "(", "in", " ", "self", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\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\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Public", " ", "method", "s", " ", "for", " ", "doi", "ng", " ", "real", " ", "\"", "SC", "ons", " ", "stu", "ff", "\"", " ", "(", "manipulati", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dependen", "cies", ",", " ", "setti", "ng", " ", "attribute", "s", " ", "on", " ", "target", "s", ",", " ", "etc", ".)", ".", " ", " ", "The", "se", " ", "begin_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "upper", "-", "case", " ", "letter", "s", ".", " ", " ", "The", " ", "essential", " ", "characteristic", " ", "of", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "this", " ", "section", " ", "is", " ", "tha", "t", " ", "the", "y", " ", "all", " ", "*", "shou", "ld", "*", " ", "have", " ", "correspond", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "same", "-", "named", " ", "global", " ", "function", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "(_", "Substituti", "on", "Environment_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "platform_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tools_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tool", "path_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "variables_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parse", "\\u", "flags_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "ation", " ", "of", " ", "a", " ", "basic", " ", "SC", "ons", " ", "constructi", "on", " ", "environ", "ment", ",", "\\", "10", ";", " ", " ", " ", " ", "inclu", "ding", " ", "setti", "ng", " ", "up", " ", "special", " ", "constructi", "on", " ", "variab", "les", " ", "like", " ", "BUILD", "ER", ",", "\\", "10", ";", " ", " ", " ", " ", "PLATFORM", ",", " ", "etc", ".,", " ", "and", " ", "search", "ing", " ", "for", " ", "and", " ", "appl", "ying", " ", "avail", "able", " ", "Tool", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "we", " ", "do", " ", "*", "not", "*", " ", "call", " ", "the", " ", "underl", "ying", " ", "base", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "(", "Subs", "itut", "ion", "Environ", "ment", ")", " ", "initialization", ",", " ", "bec", "aus", "e", " ", "we", " ", "need", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "initialize", " ", "thing", "s", " ", "in", " ", "a", " ", "very", " ", "specific", " ", "order", " ", "tha", "t", " ", "doe", "sn", "'", "t", " ", "work", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "the", " ", "muc", "h", " ", "simple", "r", " ", "base", " ", "class", " ", "initialization", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "SC", "ons_", "._", "Debug_", "._", "track", "\\u", "instances_", ":_", "log", "Insta", "nce", "Creat", "ion_", "(_", "self_", ",_", "'", "Environ", "ment", ".", "Base", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "memo_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fs_", "=_", "SC", "ons_", "._", "Node_", "._", "FS_", "._", "get", "\\u", "default", "\\u", "fs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ans_", "=_", "SC", "ons_", "._", "Node_", "._", "Alias_", "._", "default", "\\u", "ans_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "look", "up", "\\u", "list_", "=_", "SC", "ons_", "._", "Node_", "._", "arg", "2n", "odes", "\\u", "lookups", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dict_", "=_", "semi", "\\u", "deepcopy_", "(_", "SC", "ons_", "._", "Defaults_", "._", "Construct", "ion", "Environment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "init", "\\u", "special_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "adde", "d\\u", "methods_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "don", "'", "t", " ", "use", " ", "Add", "Meth", "od", ",", " ", "or", " ", "defin", "e", " ", "these", " ", "as", " ", "method", "s", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "class", ",", " ", "bec", "aus", "e", " ", "we", " ", "*", "don", "'", "t", "*", " ", "want", " ", "these", " ", "function", "s", " ", "to", " ", "be", " ", "bound_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "method", "s", ".", " ", " ", "The", "y", " ", "need", " ", "to", " ", "operate", " ", "independent", "ly", " ", "so", " ", "tha", "t", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "settings", " ", "will", " ", "work", " ", "proper", "ly", " ", "rega", "rd", "less", " ", "of", " ", "whe", "ther", " ", "a", " ", "given_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "target", " ", "ends", " ", "up", " ", "bei", "ng", " ", "bui", "lt", " ", "with", " ", "a", " ", "Base", " ", "environ", "ment", " ", "or", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", "Environ", "ment", " ", "or", " ", "what", " ", "have", " ", "you", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "decide", "\\u", "target_", "=_", "default", "\\u", "decide", "\\u", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "decide", "\\u", "source_", "=_", "default", "\\u", "decide", "\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "copy", "\\u", "from", "\\u", "cache_", "=_", "default", "\\u", "copy", "\\u", "from", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "dict_", "[_", "'", "BUILD", "ERS", "'_", "]_", "=_", "Build", "er", "Dict_", "(_", "self_", "._", "\\u", "dict_", "[_", "'", "BUILD", "ERS", "'_", "]_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "platform_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "platform_", "=_", "self_", "._", "\\u", "dict_", "._", "get_", "(_", "'", "PLATFORM", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "platform_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "platform_", "=_", "SC", "ons_", "._", "Platform_", "._", "Platform_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "SC", "ons_", "._", "Util_", "._", "is", "\\u", "String_", "(_", "platform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "platform_", "=_", "SC", "ons_", "._", "Platform_", "._", "Platform_", "(_", "platform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "dict_", "[_", "'", "PLATFORM", "'_", "]_", "=_", "str_", "(_", "platform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "platform_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "dict_", "[_", "'", "HOST", "\\u", "OS", "'_", "]_", "=_", "self_", "._", "\\u", "dict_", "._", "get_", "(_", "'", "HOST", "\\u", "OS", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dict_", "[_", "'", "HOST", "\\u", "ARCH", "'_", "]_", "=_", "self_", "._", "\\u", "dict_", "._", "get_", "(_", "'", "HOST", "\\u", "ARCH", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "set", " ", "default", "s", " ", "for", " ", "TARGET", "\\u{", "OS", "|", "ARCH", "}_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "dict_", "[_", "'", "TARGET", "\\u", "OS", "'_", "]_", "=_", "self_", "._", "\\u", "dict_", "._", "get_", "(_", "'", "TARGET", "\\u", "OS", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "dict_", "[_", "'", "TARGET", "\\u", "ARCH", "'_", "]_", "=_", "self_", "._", "\\u", "dict_", "._", "get_", "(_", "'", "TARGET", "\\u", "ARCH", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "the", " ", "pass", "ed", "-", "in", " ", "and", " ", "customi", "zab", "le", " ", "variab", "les", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "environ", "ment", " ", "bef", "ore", " ", "calling", " ", "the", " ", "tool", "s", ",", " ", "bec", "aus", "e", " ", "the", "y", " ", "may", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "of", " ", "them", " ", "dur", "ing", " ", "initialization", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "options", "'_", "in_", "kw_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Backward", "s", " ", "compatibility", ":", " ", " ", "the", "y", " ", "may", " ", "stl", "l", " ", "be", " ", "usi", "ng", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "old", " ", "\"", "options", "\"", " ", "keyw", "ord", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "variables_", "=_", "kw_", "[_", "'", "options", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "kw_", "[_", "'", "options", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Replace", "_", "(_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "list_", "(_", "kw_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "variables_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "=_", "keys_", "+_", "list_", "(_", "variables_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variables_", "._", "Update_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "save_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "keys_", ":_", "\\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 ", " _", "save_", "[_", "k_", "]_", "=_", "self_", "._", "\\u", "dict_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "value", " ", "may", " ", "have", " ", "bee", "n", " ", "set", " ", "if", " ", "the", "y", " ", "trie", "d", " ", "to", " ", "pass", " ", "in", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reserve", "d", " ", "variab", "le", " ", "name", " ", "like", " ", "TARGET", "S", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SC", "ons_", "._", "Tool_", "._", "Initializer", "s_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tools_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tools_", "=_", "self_", "._", "\\u", "dict_", "._", "get_", "(_", "'", "TOOLS", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tools_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tools_", "=_", "[_", "'", "default", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "appl", "y", "\\u", "tools_", "(_", "self_", ",_", "tools_", ",_", "tool", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "restore", " ", "the", " ", "pass", "ed", "-", "in", " ", "and", " ", "customize", "d", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "environ", "ment", ",", " ", "sinc", "e", " ", "the", " ", "values", " ", "the", " ", "user", " ", "set", " ", "explicit", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "override", " ", "any", " ", "values", " ", "set", " ", "by", " ", "the", " ", "tool", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "val_", "in_", "save_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "dict_", "[_", "key_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", "ly", ",", " ", "appl", "y", " ", "any", " ", "flags", " ", "to", " ", "be", " ", "merge", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parse", "\\u", "flags_", ":_", "self_", "._", "Merge", "Flags_", "(_", "parse", "\\u", "flags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Override", "Environment_", "(_", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "proxy", " ", "tha", "t", " ", "override", "s", " ", "variab", "les", " ", "in", " ", "a", " ", "wrapp", "ed", " ", "constructi", "on", "\\", "10", ";", " ", " ", " ", " ", "environ", "ment", " ", "by", " ", "return", "ing", " ", "values", " ", "from", " ", "an", " ", "override", "s", " ", "dictionar", "y", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "preference", " ", "to", " ", "values", " ", "from", " ", "the", " ", "underl", "ying", " ", "subject", " ", "environ", "ment", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "light", "weight", " ", "(", "I", " ", "hop", "e", ")", " ", "proxy", " ", "tha", "t", " ", "pass", "es", " ", "through", " ", "most", " ", "use", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "attribute", "s", " ", "to", " ", "the", " ", "underl", "ying", " ", "Environ", "ment", ".", "Base", " ", "class", ",", " ", "but", " ", "has", " ", "just", "\\", "10", ";", " ", " ", " ", " ", "eno", "ugh", " ", "addition", "al", " ", "method", "s", " ", "defin", "ed", " ", "to", " ", "act", " ", "like", " ", "a", " ", "real", " ", "constructi", "on", "\\", "10", ";", " ", " ", " ", " ", "environ", "ment", " ", "with", " ", "overrid", "den", " ", "values", ".", " ", " ", "It", " ", "can", " ", "wrap", " ", "eit", "her", " ", "a", " ", "Base", "\\", "10", ";", " ", " ", " ", " ", "constructi", "on", " ", "environ", "ment", ",", " ", "or", " ", "anot", "her", " ", "Override", "Environ", "ment", ",", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "in", " ", "turn", " ", "nest", " ", "arbitra", "ry", " ", "Override", "Environ", "ment", "s", "...", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "we", " ", "do", " ", "*", "not", "*", " ", "call", " ", "the", " ", "underl", "ying", " ", "base", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "(", "Subs", "itut", "ion", "Environ", "ment", ")", " ", "initialization", ",", " ", "bec", "aus", "e", " ", "we", " ", "get", " ", "most", " ", "of", " ", "tho", "se", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "proxy", "ing", " ", "the", " ", "attribute", "s", " ", "of", " ", "the", " ", "subject", " ", "constructi", "on", " ", "environ", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "Bu", "t", " ", "bec", "aus", "e", " ", "we", " ", "subclass", " ", "Substituti", "on", "Environ", "ment", ",", " ", "this", " ", "class", " ", "als", "o", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "inherited", " ", "arg", "2n", "odes", "()", " ", "and", " ", "subst", "*(", ")", " ", "method", "s", ";", " ", "tho", "se", " ", "method", "s", " ", "can", "'", "t", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "prox", "ied", " ", "bec", "aus", "e", " ", "the", "y", " ", "need", " ", "*", "this", "*", " ", "object", "'", "s", " ", "method", "s", " ", "to", " ", "fetch", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "values", " ", "from", " ", "the", " ", "override", "s", " ", "dictionar", "y", ".", "\\", "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_", "#", " ", "Meth", "ods", " ", "tha", "t", " ", "make", " ", "this", " ", "class", " ", "act", " ", "like", " ", "a", " ", "proxy", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Meth", "ods", " ", "tha", "t", " ", "make", " ", "this", " ", "class", " ", "act", " ", "like", " ", "a", " ", "dictionar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Over", "rid", "den", " ", "private", " ", "constructi", "on", " ", "environ", "ment", " ", "method", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Over", "rid", "den", " ", "public", " ", "constructi", "on", " ", "environ", "ment", " ", "method", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Override", "Environment_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "subject_", ",_", "overrides_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "SC", "ons_", "._", "Debug_", "._", "track", "\\u", "instances_", ":_", "log", "Insta", "nce", "Creat", "ion_", "(_", "self_", ",_", "'", "Environ", "ment", ".", "Override", "Environ", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "\\u", "subject", "'_", "]_", "=_", "subject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "dict\\u\\u_", "[_", "'", "override", "s", "'_", "]_", "=_", "overrides_", "\\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, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
`__eq__` not overridden when adding attributes
aparo/pyes/pyes/models.py
[ { "content": "class SortedDict(dict):\n \"\"\"\n A dictionary that keeps its keys in the order in which they're inserted.\n\n Taken from django\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.SortedDict", "header": "['module', '___EOS___']", "index": 241 }, { "content": " def __new__(cls, *args, **kwargs):\n instance = super(SortedDict, cls).__new__(cls, *args, **kwargs)\n instance.keyOrder = []\n return instance", "metadata": "root.SortedDict.__new__", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 247 }, { "content": " def __init__(self, data=None):\n if data is None:\n data = {}\n elif isinstance(data, GeneratorType):\n # Unfortunately we need to be able to read a generator twice. Once\n # to get the data into self with our super().__init__ call and a\n # second time to setup keyOrder correctly\n data = list(data)\n super(SortedDict, self).__init__(data)\n if isinstance(data, dict):\n self.keyOrder = data.keys()\n else:\n self.keyOrder = []\n seen = set()\n for key, value in data:\n if key not in seen:\n self.keyOrder.append(key)\n seen.add(key)", "metadata": "root.SortedDict.__init__", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 252 }, { "content": " def __deepcopy__(self, memo):\n return self.__class__([(key, copy.deepcopy(value, memo))\n for key, value in self.items()])", "metadata": "root.SortedDict.__deepcopy__", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 271 }, { "content": " def __setitem__(self, key, value):\n if key not in self:\n self.keyOrder.append(key)\n super(SortedDict, self).__setitem__(key, value)", "metadata": "root.SortedDict.__setitem__", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 275 }, { "content": " def __delitem__(self, key):\n super(SortedDict, self).__delitem__(key)\n self.keyOrder.remove(key)", "metadata": "root.SortedDict.__delitem__", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 280 }, { "content": " def __iter__(self):\n return iter(self.keyOrder)", "metadata": "root.SortedDict.__iter__", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 284 }, { "content": " def pop(self, k, *args):\n result = super(SortedDict, self).pop(k, *args)\n try:\n self.keyOrder.remove(k)\n except ValueError:\n # Key wasn't in the dictionary in the first place. No problem.\n pass\n return result", "metadata": "root.SortedDict.pop", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 287 }, { "content": " def popitem(self):\n result = super(SortedDict, self).popitem()\n self.keyOrder.remove(result[0])\n return result", "metadata": "root.SortedDict.popitem", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 296 }, { "content": " def items(self):\n return zip(self.keyOrder, self.values())", "metadata": "root.SortedDict.items", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 301 }, { "content": " def items(self):\n for key in self.keyOrder:\n yield key, self[key]", "metadata": "root.SortedDict.items", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 304 }, { "content": " def keys(self):\n return self.keyOrder[:]", "metadata": "root.SortedDict.keys", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 308 }, { "content": " def iterkeys(self):\n return iter(self.keyOrder)", "metadata": "root.SortedDict.iterkeys", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 311 }, { "content": " def values(self):\n return map(self.__getitem__, self.keyOrder)", "metadata": "root.SortedDict.values", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 314 }, { "content": " def itervalues(self):\n for key in self.keyOrder:\n yield self[key]", "metadata": "root.SortedDict.itervalues", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 317 }, { "content": " def update(self, dict_):\n for k, v in dict_.items():\n self[k] = v", "metadata": "root.SortedDict.update", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 321 }, { "content": " def setdefault(self, key, default):\n if key not in self:\n self.keyOrder.append(key)\n return super(SortedDict, self).setdefault(key, default)", "metadata": "root.SortedDict.setdefault", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 325 }, { "content": " def value_for_index(self, index):\n \"\"\"Returns the value of the item at the given zero-based index.\"\"\"\n return self[self.keyOrder[index]]", "metadata": "root.SortedDict.value_for_index", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 330 }, { "content": " def insert(self, index, key, value):\n \"\"\"Inserts the key, value pair before the item with the given index.\"\"\"\n if key in self.keyOrder:\n n = self.keyOrder.index(key)\n del self.keyOrder[n]\n if n < index:\n index -= 1\n self.keyOrder.insert(index, key)\n super(SortedDict, self).__setitem__(key, value)", "metadata": "root.SortedDict.insert", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 334 }, { "content": " def copy(self):\n \"\"\"Returns a copy of this object.\"\"\"\n # This way of initializing the copy means it works for subclasses, too.\n obj = self.__class__(self)\n obj.keyOrder = self.keyOrder[:]\n return obj", "metadata": "root.SortedDict.copy", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 344 }, { "content": " def __repr__(self):\n \"\"\"\n Replaces the normal dict.__repr__ with a version that returns the keys\n in their sorted order.\n \"\"\"\n return '{%s}' % ', '.join(['%r: %r' % (k, v) for k, v in self.items()])", "metadata": "root.SortedDict.__repr__", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 351 }, { "content": " def clear(self):\n super(SortedDict, self).clear()\n self.keyOrder = []", "metadata": "root.SortedDict.clear", "header": "['class', 'SortedDict', '(', 'dict', ')', ':', '___EOS___']", "index": 358 } ]
[ { "span": "class SortedDict(dict):", "start_line": 241, "start_column": 0, "end_line": 241, "end_column": 23 } ]
[ { "span": "self.keyOrder ", "start_line": 262, "start_column": 12, "end_line": 262, "end_column": 25 }, { "span": "self.keyOrder ", "start_line": 264, "start_column": 12, "end_line": 264, "end_column": 25 }, { "span": "self.keyOrder ", "start_line": 360, "start_column": 8, "end_line": 360, "end_column": 21 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "eq\\u\\u_", "`_", "not_", "overrid", "den_", "when_", "addin", "g_", "attributes_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "dictionar", "y", " ", "tha", "t", " ", "keep", "s", " ", "its", " ", "keys", " ", "in", " ", "the", " ", "order", " ", "in", " ", "whi", "ch", " ", "the", "y", "'", "re", " ", "inserted", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Taken", " ", "from", " ", "django", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance_", "=_", "super_", "(_", "Sorte", "d", "Dict_", ",_", "cls_", ")_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "._", "key", "Order_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\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_", ",_", "data_", "=_", "None_", ")_", ":_", "\\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 ", " _", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "data_", ",_", "Generat", "or", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Unf", "ort", "unat", "el", "y", " ", "we", " ", "need", " ", "to", " ", "be", " ", "able", " ", "to", " ", "read", " ", "a", " ", "generat", "or", " ", "twi", "ce", ".", " ", " ", "On", "ce_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "get", " ", "the", " ", "data", " ", "int", "o", " ", "self", " ", "with", " ", "our", " ", "super", "()", ".\\u", "\\u", "init", "\\u\\u", " ", "call", " ", "and", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "second", " ", "time", " ", "to", " ", "setup", " ", "key", "Order", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "list_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Sorte", "d", "Dict_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "data_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "key", "Order_", "=_", "data_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "key", "Order_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seen_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "not_", "in_", "seen_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "key", "Order_", "._", "append_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seen_", "._", "add_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "deepc", "opy", "\\u\\u_", "(_", "self_", ",_", "memo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "[_", "(_", "key_", ",_", "copy_", "._", "deepcopy_", "(_", "value_", ",_", "memo_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "self_", "._", "items_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setitem\\u\\u_", "(_", "self_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "not_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "key", "Order_", "._", "append_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Sorte", "d", "Dict_", ",_", "self_", ")_", "._", "\\u\\u", "setitem\\u\\u_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "delitem\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Sorte", "d", "Dict_", ",_", "self_", ")_", "._", "\\u\\u", "delitem\\u\\u_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "key", "Order_", "._", "remove_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "self_", "._", "key", "Order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pop_", "(_", "self_", ",_", "k_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Sorte", "d", "Dict_", ",_", "self_", ")_", "._", "pop_", "(_", "k_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "key", "Order_", "._", "remove_", "(_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Key", " ", "was", "n", "'", "t", " ", "in", " ", "the", " ", "dictionar", "y", " ", "in", " ", "the", " ", "first", " ", "place", ".", " ", "No", " ", "problem", "._", "\\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_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "popi", "tem_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Sorte", "d", "Dict_", ",_", "self_", ")_", "._", "popi", "tem_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "key", "Order_", "._", "remove_", "(_", "result_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "items_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "zip_", "(_", "self_", "._", "key", "Order_", ",_", "self_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "items_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "self_", "._", "key", "Order_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "key_", ",_", "self_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "keys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "key", "Order_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "iterkeys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "self_", "._", "key", "Order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "map_", "(_", "self_", "._", "\\u\\u", "getitem\\u\\u_", ",_", "self_", "._", "key", "Order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "itervalues_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", "in_", "self_", "._", "key", "Order_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ",_", "dict\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", ",_", "v_", "in_", "dict\\u_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setdefault_", "(_", "self_", ",_", "key_", ",_", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "not_", "in_", "self_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "key", "Order_", "._", "append_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Sorte", "d", "Dict_", ",_", "self_", ")_", "._", "setdefault_", "(_", "key_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "value", "\\u", "for", "\\u", "index_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "value", " ", "of", " ", "the", " ", "item", " ", "at", " ", "the", " ", "give", "n", " ", "zero", "-", "based", " ", "index", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "[_", "self_", "._", "key", "Order_", "[_", "index_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insert_", "(_", "self_", ",_", "index_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Insert", "s", " ", "the", " ", "key", ",", " ", "value", " ", "pair", " ", "bef", "ore", " ", "the", " ", "item", " ", "with", " ", "the", " ", "give", "n", " ", "index", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "in_", "self_", "._", "key", "Order_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "self_", "._", "key", "Order_", "._", "index_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "key", "Order_", "[_", "n_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "<_", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "key", "Order_", "._", "insert_", "(_", "index_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Sorte", "d", "Dict_", ",_", "self_", ")_", "._", "\\u\\u", "setitem\\u\\u_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "a", " ", "copy", " ", "of", " ", "this", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "way", " ", "of", " ", "initiali", "zin", "g", " ", "the", " ", "copy", " ", "means", " ", "it", " ", "works", " ", "for", " ", "subclasses", ",", " ", "too", "._", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "key", "Order_", "=_", "self_", "._", "key", "Order_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\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 ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Replace", "s", " ", "the", " ", "normal", " ", "dict", ".\\u", "\\u", "repr", "\\u\\u", " ", "with", " ", "a", " ", "version", " ", "tha", "t", " ", "return", "s", " ", "the", " ", "keys", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "thei", "r", " ", "sorte", "d", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{", "%", "s", "}'_", "%_", "',", " ", "'_", "._", "join_", "(_", "[_", "'%", "r", ":", " ", "%", "r", "'_", "%_", "(_", "k_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "items_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sorte", "d", "Dict_", "(_", "dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clear_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Sorte", "d", "Dict_", ",_", "self_", ")_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "key", "Order_", "=_", "[_", "]_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 2, 2, 2 ]
Unused local variable
enthought/pyface/pyface/ui/null/action/menu_manager.py
[ { "content": " def create_menu(self, parent, controller=None):\n \"\"\" Creates a menu representation of the manager. \"\"\"\n\n # If a controller is required it can either be set as a trait on the\n # menu manager (the trait is part of the 'ActionManager' API), or\n # passed in here (if one is passed in here it takes precedence over the\n # trait).\n if controller is None:\n controller = self.controller\n\n return None", "metadata": "root.MenuManager.create_menu", "header": "['class', 'MenuManager', '(', 'ActionManager', ',', 'ActionManagerItem', ')', ':', '___EOS___']", "index": 42 } ]
[ { "span": "controller ", "start_line": 50, "start_column": 12, "end_line": 50, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Menu", "Manager_", "(_", "Action", "Manager_", ",_", "Action", "Manager", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create", "\\u", "menu_", "(_", "self_", ",_", "parent_", ",_", "controller_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "es", " ", "a", " ", "menu", " ", "represent", "ation", " ", "of", " ", "the", " ", "manage", "r", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "controlle", "r", " ", "is", " ", "require", "d", " ", "it", " ", "can", " ", "eit", "her", " ", "be", " ", "set", " ", "as", " ", "a", " ", "tra", "it", " ", "on", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "menu", " ", "manage", "r", " ", "(", "the", " ", "tra", "it", " ", "is", " ", "part", " ", "of", " ", "the", " ", "'", "Action", "Manager", "'", " ", "API", "),", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pass", "ed", " ", "in", " ", "here", " ", "(", "if", " ", "one", " ", "is", " ", "pass", "ed", " ", "in", " ", "here", " ", "it", " ", "take", "s", " ", "preceden", "ce", " ", "over", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tra", "it", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "controller_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "controller_", "=_", "self_", "._", "controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
sassoftware/conary/conary/conaryclient/update.py
[ { "content": " def _createAllCs(self, q, allJobs, uJob, cfg, stopSelf):\n # Reopen the local database so we don't share a sqlite object\n # with the main thread. This gets the user map from the already\n # existing repository object to ensure we still have access to\n # any passwords we need.\n # _createCs accesses the database through the uJob.troveSource,\n # so make sure that references this fresh db as well.\n import Queue\n\n # We do not want the download thread to die with DatabaseLocked\n # errors, so make the timeout some really large value (5 minutes)\n db = database.Database(cfg.root, cfg.dbPath, timeout = 300000)\n uJob.troveSource.db = db\n repos = self.createRepos(db, cfg)\n self.updateCallback.setAbortEvent(stopSelf)\n\n for i, job in enumerate(allJobs):\n if stopSelf.isSet():\n return\n\n self.updateCallback.setChangesetHunk(i + 1, len(allJobs))\n try:\n newCs = self._createCs(repos, db, job, uJob)\n except:\n q.put((True, sys.exc_info()))\n return\n\n while True:\n # block for no more than 5 seconds so we can\n # check to see if we should abort\n try:\n q.put((False, newCs), True, 5)\n break\n except Queue.Full:\n # if the queue is full, check to see if the\n # other thread wants to quit\n if stopSelf.isSet():\n return\n\n self.updateCallback.setAbortEvent(None)\n q.put(None)\n\n # returning terminates the thread", "metadata": "root.ClientUpdate._createAllCs", "header": "['class', 'ClientUpdate', '(', 'object', ')', ':', '___EOS___']", "index": 3541 } ]
[ { "span": "except:", "start_line": 3564, "start_column": 12, "end_line": 3564, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Client", "Update_", "(_", "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", "create", "All", "Cs_", "(_", "self_", ",_", "q_", ",_", "all", "Jobs_", ",_", "u", "Job_", ",_", "cfg_", ",_", "stop", "Self", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Re", "open", " ", "the", " ", "local", " ", "databa", "se", " ", "so", " ", "we", " ", "don", "'", "t", " ", "share", " ", "a", " ", "sql", "ite", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "the", " ", "main", " ", "thread", ".", " ", "Thi", "s", " ", "gets", " ", "the", " ", "user", " ", "map", " ", "from", " ", "the", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist", "ing", " ", "repos", "itor", "y", " ", "object", " ", "to", " ", "ensure", " ", "we", " ", "still", " ", "have", " ", "access", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "any", " ", "passwords", " ", "we", " ", "need", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "create", "Cs", " ", "accesse", "s", " ", "the", " ", "databa", "se", " ", "through", " ", "the", " ", "u", "Jo", "b", ".", "trove", "Sou", "rce", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "make", " ", "sure", " ", "tha", "t", " ", "reference", "s", " ", "this", " ", "fresh", " ", "db", " ", "as", " ", "well", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "do", " ", "not", " ", "want", " ", "the", " ", "download", " ", "thread", " ", "to", " ", "die", " ", "with", " ", "Databa", "se", "Locke", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", "s", ",", " ", "so", " ", "make", " ", "the", " ", "timeo", "ut", " ", "some", " ", "reall", "y", " ", "large", " ", "value", " ", "(", "5", " ", "minute", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "database_", "._", "Database_", "(_", "cfg_", "._", "root_", ",_", "cfg_", "._", "db", "Path_", ",_", "timeout_", "=_", "300000", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "u", "Job_", "._", "trove", "Source_", "._", "db_", "=_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repos_", "=_", "self_", "._", "create", "Repos", "_", "(_", "db_", ",_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "Callback_", "._", "set", "Abo", "rt", "Event_", "(_", "stop", "Self", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "job_", "in_", "enumerate_", "(_", "all", "Jobs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "stop", "Self", "_", "._", "is", "Set_", "(_", ")_", ":_", "\\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_", "._", "update", "Callback_", "._", "set", "Change", "set", "Hun", "k_", "(_", "i_", "+_", "1_", ",_", "len_", "(_", "all", "Jobs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "Cs_", "=_", "self_", "._", "\\u", "create", "Cs_", "(_", "repos_", ",_", "db_", ",_", "job_", ",_", "u", "Job_", ")_", "\\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 ", " _", "q_", "._", "put_", "(_", "(_", "True_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", ")_", "\\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_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "block", " ", "for", " ", "no", " ", "more", " ", "than", " ", "5", " ", "second", "s", " ", "so", " ", "we", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "to", " ", "see", " ", "if", " ", "we", " ", "shou", "ld", " ", "abort_", "\\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 ", " ", "_", "q_", "._", "put_", "(_", "(_", "False_", ",_", "new", "Cs_", ")_", ",_", "True_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Queue_", "._", "Full_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "queue", " ", "is", " ", "full", ",", " ", "check", " ", "to", " ", "see", " ", "if", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "thread", " ", "want", "s", " ", "to", " ", "quit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "stop", "Self", "_", "._", "is", "Set_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "update", "Callback_", "._", "set", "Abo", "rt", "Event_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "._", "put_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", "ing", " ", "terminate", "s", " ", "the", " ", "thread_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
aigamedev/scikit-neuralnetwork/sknn/tests/test_sklearn.py
[ { "content": "import unittest\nfrom nose.tools import (assert_equal, assert_raises, assert_in, assert_not_in)\n\nimport numpy\nfrom scipy.stats import randint, uniform\n\nfrom sklearn.grid_search import GridSearchCV, RandomizedSearchCV\nfrom sklearn.cross_validation import cross_val_score\nfrom sklearn.ensemble import VotingClassifier\n \nfrom sknn.mlp import Regressor as MLPR, Classifier as MLPC\nfrom sknn.mlp import Layer as L\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestGridSearchRegressor(unittest.TestCase):\n \n __estimator__ = MLPR\n __output__ = \"Linear\"\n \n\n\n\n\n", "metadata": "root.TestGridSearchRegressor", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def setUp(self):\n self.a_in = numpy.random.uniform(0.0, 1.0, (64,16))\n self.a_out = numpy.zeros((64,1))", "metadata": "root.TestGridSearchRegressor.setUp", "header": "['class', 'TestGridSearchRegressor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " def test_GridGlobalParams(self):\n clf = GridSearchCV(\n self.__estimator__(layers=[L(self.__output__)], n_iter=1),\n param_grid={'learning_rate': [0.01, 0.001]})\n clf.fit(self.a_in, self.a_out)", "metadata": "root.TestGridSearchRegressor.test_GridGlobalParams", "header": "['class', 'TestGridSearchRegressor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def test_GridLayerParams(self):\n clf = GridSearchCV(\n self.__estimator__(layers=[L(\"Rectifier\", units=12), L(self.__output__)], n_iter=1),\n param_grid={'hidden0__units': [4, 8, 12]})\n clf.fit(self.a_in, self.a_out)", "metadata": "root.TestGridSearchRegressor.test_GridLayerParams", "header": "['class', 'TestGridSearchRegressor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_RandomGlobalParams(self):\n clf = RandomizedSearchCV(\n self.__estimator__(layers=[L(\"Sigmoid\")], n_iter=1),\n param_distributions={'learning_rate': uniform(0.001, 0.01)},\n n_iter=2)\n clf.fit(self.a_in, self.a_out)", "metadata": "root.TestGridSearchRegressor.test_RandomGlobalParams", "header": "['class', 'TestGridSearchRegressor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 35 }, { "content": " def test_RandomLayerParams(self):\n clf = RandomizedSearchCV(\n self.__estimator__(layers=[L(\"Rectifier\", units=12), L(self.__output__)], n_iter=1),\n param_distributions={'hidden0__units': randint(4, 12)},\n n_iter=2)\n clf.fit(self.a_in, self.a_out)", "metadata": "root.TestGridSearchRegressor.test_RandomLayerParams", "header": "['class', 'TestGridSearchRegressor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 42 }, { "content": " def test_RandomMultipleJobs(self):\n clf = RandomizedSearchCV(\n self.__estimator__(layers=[L(\"Sigmoid\", units=12), L(self.__output__)], n_iter=1),\n param_distributions={'hidden0__units': randint(4, 12)},\n n_iter=4, n_jobs=4)\n clf.fit(self.a_in, self.a_out)", "metadata": "root.TestGridSearchRegressor.test_RandomMultipleJobs", "header": "['class', 'TestGridSearchRegressor', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": "class TestGridSearchClassifier(TestGridSearchRegressor):\n # NOTE: \"multiclass-multioutput is not supported\" by sklearn.\n\n __estimator__ = MLPC\n __output__ = \"Softmax\"\n", "metadata": "root.TestGridSearchClassifier", "header": "['module', '___EOS___']", "index": 57 }, { "content": " def setUp(self):\n self.a_in = numpy.random.uniform(0.0, 1.0, (64,16))\n self.a_out = numpy.random.randint(0, 4, (64,))", "metadata": "root.TestGridSearchClassifier.setUp", "header": "['class', 'TestGridSearchClassifier', '(', 'TestGridSearchRegressor', ')', ':', '___NEWLINE___', '# NOTE: \"multiclass-multioutput is not supported\" by sklearn.', '___NL___', '___EOS___']", "index": 63 }, { "content": "class TestCrossValidation(unittest.TestCase):\n\n", "metadata": "root.TestCrossValidation", "header": "['module', '___EOS___']", "index": 68 }, { "content": " def test_Regressor(self):\n a_in = numpy.random.uniform(0.0, 1.0, (64,16))\n a_out = numpy.zeros((64,1))\n\n cross_val_score(MLPR(layers=[L(\"Linear\")], n_iter=1), a_in, a_out, cv=5)", "metadata": "root.TestCrossValidation.test_Regressor", "header": "['class', 'TestCrossValidation', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def test_Classifier(self):\n a_in = numpy.random.uniform(0.0, 1.0, (64,16))\n a_out = numpy.random.randint(0, 4, (64,))\n\n cross_val_score(MLPC(layers=[L(\"Softmax\")], n_iter=1), a_in, a_out, cv=5)", "metadata": "root.TestCrossValidation.test_Classifier", "header": "['class', 'TestCrossValidation', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 76 }, { "content": "class TestVotingEnsemble(unittest.TestCase):\n ", "metadata": "root.TestVotingEnsemble", "header": "['module', '___EOS___']", "index": 83 }, { "content": " def test_SingleVote(self):\n a_in, a_out = numpy.random.uniform(0.0, 1.0, (64,16)), numpy.zeros((64,))\n vc = VotingClassifier([('nn1', MLPC(layers=[L(\"Softmax\")], n_iter=1))])\n vc.fit(a_in, a_out)\n vc.predict(a_in)", "metadata": "root.TestVotingEnsemble.test_SingleVote", "header": "['class', 'TestVotingEnsemble', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 85 } ]
[ { "span": "from nose.tools import (assert_equal, assert_raises, assert_in, assert_not_in)", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 78 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "(_", "assert", "\\u", "equal_", ",_", "assert", "\\u", "raises_", ",_", "assert", "\\u", "in_", ",_", "assert", "\\u", "not", "\\u", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "stats_", "import_", "randint_", ",_", "uniform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sklearn_", "._", "grid", "\\u", "search_", "import_", "Grid", "Sear", "ch", "CV_", ",_", "Random", "ize", "d", "Sear", "ch", "CV_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "cross", "\\u", "validation_", "import_", "cross", "\\u", "val", "\\u", "score_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "ensemble_", "import_", "Vo", "ting", "Classifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sk", "nn_", "._", "mlp", "_", "import_", "Regressor_", "as_", "MLP", "R_", ",_", "Classifier_", "as_", "MLP", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sk", "nn_", "._", "mlp", "_", "import_", "Layer_", "as_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Grid", "Sear", "ch", "Regressor_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "esti", "mat", "or\\u\\u", "_", "=_", "MLP", "R_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "output", "\\u\\u_", "=_", "\"", "Linea", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Grid", "Sear", "ch", "Regressor_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "in_", "=_", "numpy_", "._", "random_", "._", "uniform_", "(_", "0.0_", ",_", "1.0_", ",_", "(_", "64_", ",_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "out_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "64_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Grid", "Sear", "ch", "Regressor_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Grid", "Global", "Params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clf_", "=_", "Grid", "Sear", "ch", "CV_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "esti", "mat", "or\\u\\u", "_", "(_", "layers_", "=_", "[_", "L_", "(_", "self_", "._", "\\u\\u", "output", "\\u\\u_", ")_", "]_", ",_", "n", "\\u", "iter_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "grid_", "=_", "{_", "'", "learn", "ing", "\\u", "rate", "'_", ":_", "[_", "0.01_", ",_", "0.001_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clf_", "._", "fit_", "(_", "self_", "._", "a", "\\u", "in_", ",_", "self_", "._", "a", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Grid", "Sear", "ch", "Regressor_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Grid", "Layer", "Params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clf_", "=_", "Grid", "Sear", "ch", "CV_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "esti", "mat", "or\\u\\u", "_", "(_", "layers_", "=_", "[_", "L_", "(_", "\"", "Rect", "ifie", "r", "\"_", ",_", "units_", "=_", "12_", ")_", ",_", "L_", "(_", "self_", "._", "\\u\\u", "output", "\\u\\u_", ")_", "]_", ",_", "n", "\\u", "iter_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "grid_", "=_", "{_", "'", "hidden", "0", "\\u\\u", "unit", "s", "'_", ":_", "[_", "4_", ",_", "8_", ",_", "12_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clf_", "._", "fit_", "(_", "self_", "._", "a", "\\u", "in_", ",_", "self_", "._", "a", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Grid", "Sear", "ch", "Regressor_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Random", "Global", "Params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clf_", "=_", "Random", "ize", "d", "Sear", "ch", "CV_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "esti", "mat", "or\\u\\u", "_", "(_", "layers_", "=_", "[_", "L_", "(_", "\"", "Sigm", "oid", "\"_", ")_", "]_", ",_", "n", "\\u", "iter_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "distributions_", "=_", "{_", "'", "learn", "ing", "\\u", "rate", "'_", ":_", "uniform_", "(_", "0.001_", ",_", "0.01_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "iter_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clf_", "._", "fit_", "(_", "self_", "._", "a", "\\u", "in_", ",_", "self_", "._", "a", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Grid", "Sear", "ch", "Regressor_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Random", "Layer", "Params_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clf_", "=_", "Random", "ize", "d", "Sear", "ch", "CV_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "esti", "mat", "or\\u\\u", "_", "(_", "layers_", "=_", "[_", "L_", "(_", "\"", "Rect", "ifie", "r", "\"_", ",_", "units_", "=_", "12_", ")_", ",_", "L_", "(_", "self_", "._", "\\u\\u", "output", "\\u\\u_", ")_", "]_", ",_", "n", "\\u", "iter_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "distributions_", "=_", "{_", "'", "hidden", "0", "\\u\\u", "unit", "s", "'_", ":_", "randint_", "(_", "4_", ",_", "12_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "iter_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clf_", "._", "fit_", "(_", "self_", "._", "a", "\\u", "in_", ",_", "self_", "._", "a", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Grid", "Sear", "ch", "Regressor_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Random", "Multipl", "e", "Jobs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clf_", "=_", "Random", "ize", "d", "Sear", "ch", "CV_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "esti", "mat", "or\\u\\u", "_", "(_", "layers_", "=_", "[_", "L_", "(_", "\"", "Sigm", "oid", "\"_", ",_", "units_", "=_", "12_", ")_", ",_", "L_", "(_", "self_", "._", "\\u\\u", "output", "\\u\\u_", ")_", "]_", ",_", "n", "\\u", "iter_", "=_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "param", "\\u", "distributions_", "=_", "{_", "'", "hidden", "0", "\\u\\u", "unit", "s", "'_", ":_", "randint_", "(_", "4_", ",_", "12_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "iter_", "=_", "4_", ",_", "n", "\\u", "jobs_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clf_", "._", "fit_", "(_", "self_", "._", "a", "\\u", "in_", ",_", "self_", "._", "a", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Grid", "Sear", "ch", "Classifier_", "(_", "Test", "Grid", "Sear", "ch", "Regressor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "\"", "multic", "lass", "-", "multi", "output", " ", "is", " ", "not", " ", "support", "ed", "\"", " ", "by", " ", "skl", "earn", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "esti", "mat", "or\\u\\u", "_", "=_", "MLP", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "output", "\\u\\u_", "=_", "\"", "Softmax", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Grid", "Sear", "ch", "Classifier_", "(_", "Test", "Grid", "Sear", "ch", "Regressor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "\"", "multic", "lass", "-", "multi", "output", " ", "is", " ", "not", " ", "support", "ed", "\"", " ", "by", " ", "skl", "earn", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a", "\\u", "in_", "=_", "numpy_", "._", "random_", "._", "uniform_", "(_", "0.0_", ",_", "1.0_", ",_", "(_", "64_", ",_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a", "\\u", "out_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "0_", ",_", "4_", ",_", "(_", "64_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Cross", "Validation_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cross", "Validation_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "Regressor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "\\u", "in_", "=_", "numpy_", "._", "random_", "._", "uniform_", "(_", "0.0_", ",_", "1.0_", ",_", "(_", "64_", ",_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "out_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "64_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cross", "\\u", "val", "\\u", "score_", "(_", "MLP", "R_", "(_", "layers_", "=_", "[_", "L_", "(_", "\"", "Linea", "r", "\"_", ")_", "]_", ",_", "n", "\\u", "iter_", "=_", "1_", ")_", ",_", "a", "\\u", "in_", ",_", "a", "\\u", "out_", ",_", "cv_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Cross", "Validation_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Classifier_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "\\u", "in_", "=_", "numpy_", "._", "random_", "._", "uniform_", "(_", "0.0_", ",_", "1.0_", ",_", "(_", "64_", ",_", "16_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a", "\\u", "out_", "=_", "numpy_", "._", "random_", "._", "randint_", "(_", "0_", ",_", "4_", ",_", "(_", "64_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cross", "\\u", "val", "\\u", "score_", "(_", "MLP", "C_", "(_", "layers_", "=_", "[_", "L_", "(_", "\"", "Softmax", "\"_", ")_", "]_", ",_", "n", "\\u", "iter_", "=_", "1_", ")_", ",_", "a", "\\u", "in_", ",_", "a", "\\u", "out_", ",_", "cv_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Vo", "ting", "Ensemble", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Vo", "ting", "Ensemble", "_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "Sing", "le", "Vote", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a", "\\u", "in_", ",_", "a", "\\u", "out_", "=_", "numpy_", "._", "random_", "._", "uniform_", "(_", "0.0_", ",_", "1.0_", ",_", "(_", "64_", ",_", "16_", ")_", ")_", ",_", "numpy_", "._", "zeros_", "(_", "(_", "64_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vc_", "=_", "Vo", "ting", "Classifier_", "(_", "[_", "(_", "'", "nn", "1", "'_", ",_", "MLP", "C_", "(_", "layers_", "=_", "[_", "L_", "(_", "\"", "Softmax", "\"_", ")_", "]_", ",_", "n", "\\u", "iter_", "=_", "1_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vc_", "._", "fit_", "(_", "a", "\\u", "in_", ",_", "a", "\\u", "out_",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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 ]
Unused import
box/rotunicode/test/base_test_case.py
[ { "content": "# coding: utf-8\n\nfrom __future__ import unicode_literals\n\nimport six\nTestCase = None # pylint:disable=invalid-name\ntry:\n from unittest import skipIf, TestCase # pylint:disable=unused-import\nexcept ImportError:\n if not hasattr(TestCase, 'assertItemsEqual') and not hasattr(TestCase, 'assertCountEqual'):\n # Python 2.6 support\n # pylint:disable=import-error\n from unittest2 import skipIf, TestCase\n # pylint:enable=import-error\n\nif six.PY3:\n # pylint:disable=no-member,maybe-no-member\n TestCase.assertItemsEqual = TestCase.assertCountEqual\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from unittest import skipIf, TestCase ", "start_line": 7, "start_column": 4, "end_line": 7, "end_column": 41 }, { "span": "from unittest2 import skipIf, TestCase", "start_line": 12, "start_column": 8, "end_line": 12, "end_column": 46 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Test", "Case_", "=_", "None_", "#", " ", "pylint", ":", "disable", "=", "invalid", "-", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "unittest_", "import_", "skip", "If_", ",_", "Test", "Case_", "#", " ", "pylint", ":", "disable", "=", "unu", "sed", "-", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "Test", "Case_", ",_", "'", "assert", "Item", "s", "Equal", "'_", ")_", "and_", "not_", "hasattr_", "(_", "Test", "Case_", ",_", "'", "assert", "Count", "Equal", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.6", " ", "support_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pylint", ":", "disable", "=", "import", "-", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "unittest2_", "import_", "skip", "If_", ",_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", "enable", "=", "import", "-", "error_", "\\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_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", "disable", "=", "no", "-", "member", ",", "may", "be", "-", "no", "-", "member_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Test", "Case_", "._", "assert", "Item", "s", "Equal_", "=_", "Test", "Case_", "._", "assert", "Count", "Equal_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
sibson/vncdotool/docs/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# VNCDoTool documentation build configuration file, created by\n# sphinx-quickstart on Thu Jul 25 20:10:53 2013.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys, os\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.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 extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']\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'VNCDoTool'\ncopyright = u'2013, Marc Sibson'\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 = '0.9'\n# The full version, including alpha/beta/rc tags.\nrelease = '0.9.0.dev0'\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 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 = 'nature'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (relative to this directory) to place at the top\n# of the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\n#html_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\n#html_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.\nhtml_show_sourcelink = False\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 = 'VNCDoTooldoc'\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, author, documentclass [howto/manual]).\nlatex_documents = [\n ('index', 'VNCDoTool.tex', u'VNCDoTool Documentation',\n u'Marc Sibson', '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', 'vncdotool', u'VNCDoTool Documentation',\n [u'Marc Sibson'], 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', 'VNCDoTool', u'VNCDoTool Documentation',\n u'Marc Sibson', 'VNCDoTool', 'One line description of project.',\n '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 } ]
[ { "span": "import sys, os", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "VN", "CD", "o", "Tool", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Thu", " ", "Ju", "l", " ", "25", " ", "20", ":", "10", ":", "5", "3", " ", "2013", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "-----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "'", "sphinx", ".", "ext", ".", "autod", "oc", "'_", ",_", "'", "sphinx", ".", "ext", ".", "view", "code", "'_", "]_", "\\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", "'", "VN", "CD", "o", "Tool", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "2013", ",", " ", "Marc", " ", "Si", "bso", "n", "'_", "\\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_", "=_", "'", "0.", "9", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "'", "0.", "9.0", ".", "dev", "0", "'_", "\\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", " ", "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_", "=_", "'", "natur", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt", " ", "=", " ", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "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_", "=_", "False_", "\\u\\u\\uNEWLINE\\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_", "=_", "'", "VN", "CD", "o", "Tool", "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", ",", " ", "author", ",", " ", "document", "class", " ", "[", "how", "to", "/", "manu", "al", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "VN", "CD", "o", "Tool", ".", "tex", "'_", ",_", "u", "'", "VN", "CD", "o", "Tool", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Marc", " ", "Si", "bso", "n", "'_", ",_", "'", "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", "'_", ",_", "'", "vnc", "dot", "ool", "'_", ",_", "u", "'", "VN", "CD", "o", "Tool", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "u", "'", "Marc", " ", "Si", "bso", "n", "'_", "]_", ",_", "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", "'_", ",_", "'", "VN", "CD", "o", "Tool", "'_", ",_", "u", "'", "VN", "CD", "o", "Tool", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "Marc", " ", "Si", "bso", "n", "'_", ",_", "'", "VN", "CD", "o", "Tool", "'_", ",_", "'", "One", " ", "line", " ", "description", " ", "of", " ", "project", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "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", "\\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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 ]
Unused import
hickford/MechanicalSoup/docs/conf.py
[ { "content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# MechanicalSoup documentation build configuration file, created by\n# sphinx-quickstart on Sun Sep 14 18:44:39 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\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.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\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 = 'MechanicalSoup'\ncopyright = '2014'\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 = '0.4.0'\n# The full version, including alpha/beta/rc tags.\nrelease = version\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\n#today_fmt = '%B %d, %Y'\n\n# List of 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 = 'MechanicalSoupdoc'\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', 'MechanicalSoup.tex', 'MechanicalSoup Documentation',\n '', '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', 'mechanicalsoup', 'MechanicalSoup Documentation',\n [''], 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', 'MechanicalSoup', 'MechanicalSoup Documentation',\n '', 'MechanicalSoup', 'One line description of project.',\n '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 } ]
[ { "span": "import sys", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 10 }, { "span": "import os", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "3_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mechani", "cal", "Sou", "p", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Sun", " ", "Se", "p", " ", "14", " ", "1", "8", ":", "4", "4", ":", "3", "9", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "insert", "(", "0", ",", " ", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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\\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_", "=_", "'", "Mechani", "cal", "Sou", "p", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "'", "2014", "'_", "\\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_", "=_", "'", "0.", "4.0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", "\\u", "fmt", " ", "=", " ", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "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_", "=_", "'", "Mechani", "cal", "Sou", "pd", "oc", "'_", "\\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", "'_", ",_", "'", "Mechani", "cal", "Sou", "p", ".", "tex", "'_", ",_", "'", "Mechani", "cal", "Sou", "p", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "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", "'_", ",_", "'", "mechani", "cals", "oup", "'_", ",_", "'", "Mechani", "cal", "Sou", "p", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "''_", "]_", ",_", "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", "'_", ",_", "'", "Mechani", "cal", "Sou", "p", "'_", ",_", "'", "Mechani", "cal", "Sou", "p", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "'", "Mechani", "cal", "Sou", "p", "'_", ",_", "'", "One", " ", "line", " ", "description", " ", "of", " ", "project", ".'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
catkin/catkin_tools/tests/system/verbs/catkin_profile/test_profile.py
[ { "content": "import os\n\nfrom ....utils import in_temporary_directory\nfrom ....utils import assert_cmd_success\n\nfrom ....workspace_assertions import assert_workspace_initialized\nfrom ....workspace_assertions import assert_warning_message\nfrom ....workspace_assertions import assert_no_warnings\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@in_temporary_directory\ndef test_profile_list():\n assert_cmd_success(['mkdir', 'src'])\n assert_cmd_success(['catkin', 'init'])\n assert_cmd_success(['catkin', 'build'])\n assert_cmd_success(['catkin', 'profile', 'list'])", "metadata": "root.test_profile_list", "header": "['module', '___EOS___']", "index": 10 }, { "content": "@in_temporary_directory\ndef test_profile_set():\n assert_cmd_success(['mkdir', 'src'])\n assert_cmd_success(['catkin', 'init'])\n assert_cmd_success(['catkin', 'build'])\n assert_cmd_success(['catkin', 'profile', 'set', 'default'])", "metadata": "root.test_profile_set", "header": "['module', '___EOS___']", "index": 17 } ]
[ { "span": "import os", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "..._", "._", "utils_", "import_", "in", "\\u", "temporar", "y", "\\u", "directory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "._", "utils_", "import_", "assert", "\\u", "cmd", "\\u", "success_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "..._", "._", "works", "pace\\u", "assertions_", "import_", "assert", "\\u", "works", "pace\\u", "initialized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "._", "works", "pace\\u", "assertions_", "import_", "assert", "\\u", "warn", "ing", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "..._", "._", "works", "pace\\u", "assertions_", "import_", "assert", "\\u", "no", "\\u", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "in", "\\u", "temporar", "y", "\\u", "directory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "profile", "\\u", "list_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "cmd", "\\u", "success_", "(_", "[_", "'", "mkd", "ir", "'_", ",_", "'", "src", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "cmd", "\\u", "success_", "(_", "[_", "'", "cat", "kin", "'_", ",_", "'", "init", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "cmd", "\\u", "success_", "(_", "[_", "'", "cat", "kin", "'_", ",_", "'", "build", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "cmd", "\\u", "success_", "(_", "[_", "'", "cat", "kin", "'_", ",_", "'", "profile", "'_", ",_", "'", "list", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "in", "\\u", "temporar", "y", "\\u", "directory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "profile", "\\u", "set_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "cmd", "\\u", "success_", "(_", "[_", "'", "mkd", "ir", "'_", ",_", "'", "src", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "cmd", "\\u", "success_", "(_", "[_", "'", "cat", "kin", "'_", ",_", "'", "init", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "cmd", "\\u", "success_", "(_", "[_", "'", "cat", "kin", "'_", ",_", "'", "build", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "cmd", "\\u", "success_", "(_", "[_", "'", "cat", "kin", "'_", ",_", "'", "profile", "'_", ",_", "'", "set", "'_", ",_", "'", "default", "'_", "]_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
niwinz/django-sse/django_sse/redisqueue.py
[ { "content": "# -*- coding: utf-8 -*-\n\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\n\nfrom redis import ConnectionPool as RedisConnectionPool\nfrom redis import Redis\n\nfrom redis.connection import UnixDomainSocketConnection, Connection\nfrom redis.connection import DefaultParser\n\nfrom .views import BaseSseView\n\nimport json\n\n\nCONNECTION_KWARGS = getattr(settings, 'REDIS_SSEQUEUE_CONNECTION_SETTINGS', {})\nDEFAULT_CHANNEL = getattr(settings, 'REDIS_SSEQUEUE_CHANEL_NAME', 'sse')\n\n\n\n\n\n\n\n\n\n\n__all__ = ['send_event', 'RedisQueueView']\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ConnectionPoolManager(object):\n pools = {}\n\n", "metadata": "root.ConnectionPoolManager", "header": "['module', '___EOS___']", "index": 20 }, { "content": " @classmethod\n def key_for_kwargs(cls, kwargs):\n return \":\".join([str(v) for v in kwargs.values()])", "metadata": "root.ConnectionPoolManager.key_for_kwargs", "header": "['class', 'ConnectionPoolManager', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": " @classmethod\n def connection_pool(cls, **kwargs):\n pool_key = cls.key_for_kwargs(kwargs)\n if pool_key in cls.pools:\n return cls.pools[pool_key]\n\n location = kwargs.get('location', None)\n if not location:\n raise ImproperlyConfigured(\"no `location` key on connection kwargs\")\n\n params = {\n 'connection_class': Connection,\n 'db': kwargs.get('db', 0),\n 'password': kwargs.get('password', None),\n }\n\n if location.startswith(\"unix:\"):\n params['connection_class'] = UnixDomainSocketConnection\n params['path'] = location[5:]\n else:\n try:\n params['host'], params['port'] = location.split(\":\")\n params['port'] = int(params['port'])\n\n except ValueError:\n raise ImproperlyConfigured(\"Invalid `location` key syntax on connection kwargs\")\n\n cls.pools[pool_key] = RedisConnectionPool(**params)\n return cls.pools[pool_key]", "metadata": "root.ConnectionPoolManager.connection_pool", "header": "['class', 'ConnectionPoolManager', '(', 'object', ')', ':', '___EOS___']", "index": 27 }, { "content": "class RedisQueueView(BaseSseView):\n redis_channel = DEFAULT_CHANNEL\n\n", "metadata": "root.RedisQueueView", "header": "['module', '___EOS___']", "index": 58 }, { "content": " def iterator(self):\n connection = _connect()\n pubsub = connection.pubsub()\n pubsub.subscribe(self.get_redis_channel())\n\n for message in pubsub.listen():\n if message['type'] == 'message':\n event, data = json.loads(message['data'].decode('utf-8'))\n self.sse.add_message(event, data)\n yield", "metadata": "root.RedisQueueView.iterator", "header": "['class', 'RedisQueueView', '(', 'BaseSseView', ')', ':', '___EOS___']", "index": 61 }, { "content": " def get_redis_channel(self):\n return self.redis_channel", "metadata": "root.RedisQueueView.get_redis_channel", "header": "['class', 'RedisQueueView', '(', 'BaseSseView', ')', ':', '___EOS___']", "index": 72 }, { "content": "def _connect():\n pool = ConnectionPoolManager.connection_pool(**CONNECTION_KWARGS)\n return Redis(connection_pool=pool)", "metadata": "root._connect", "header": "['module', '___EOS___']", "index": 76 }, { "content": "def send_event(event_name, data, channel=DEFAULT_CHANNEL):\n connection = _connect()\n connection.publish(channel, json.dumps([event_name, data]))", "metadata": "root.send_event", "header": "['module', '___EOS___']", "index": 81 } ]
[ { "span": "from redis.connection import DefaultParser", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 42 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\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_", "from_", "redis_", "import_", "Connect", "ion", "Pool_", "as_", "Red", "is", "Connect", "ion", "Pool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "redis_", "import_", "Redis_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "redis_", "._", "connection_", "import_", "Uni", "x", "Doma", "in", "Sock", "et", "Connection_", ",_", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "redis_", "._", "connection_", "import_", "Default", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "views_", "import_", "Base", "Ss", "e", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONNECTION", "\\u", "KW", "ARGS_", "=_", "getattr_", "(_", "settings_", ",_", "'", "REDIS", "\\u", "SSE", "QUEUE", "\\u", "CONNECTION", "\\u", "SETTING", "S", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "CHANNEL_", "=_", "getattr_", "(_", "settings_", ",_", "'", "REDIS", "\\u", "SSE", "QUEUE", "\\u", "CHAN", "EL", "\\u", "NAME", "'_", ",_", "'", "sse", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "all\\u\\u_", "=_", "[_", "'", "send", "\\u", "event", "'_", ",_", "'", "Red", "is", "Queue", "View", "'_", "]_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Connect", "ion", "Poo", "l", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pools_", "=_", "{_", "}_", "\\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", "Poo", "l", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "key", "\\u", "for", "\\u", "kwargs_", "(_", "cls_", ",_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\":\"_", "._", "join_", "(_", "[_", "str_", "(_", "v_", ")_", "for_", "v_", "in_", "kwargs_", "._", "values_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ion", "Poo", "l", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "connecti", "on", "\\u", "pool_", "(_", "cls_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pool", "\\u", "key_", "=_", "cls_", "._", "key", "\\u", "for", "\\u", "kwargs_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pool", "\\u", "key_", "in_", "cls_", "._", "pools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "._", "pools_", "[_", "pool", "\\u", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "location_", "=_", "kwargs_", "._", "get_", "(_", "'", "location", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Impro", "perl", "y", "Configured_", "(_", "\"", "no", " ", "`", "location", "`", " ", "key", " ", "on", " ", "connecti", "on", " ", "kwarg", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "connecti", "on", "\\u", "class", "'_", ":_", "Connection_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "db", "'_", ":_", "kwargs_", "._", "get_", "(_", "'", "db", "'_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "kwargs_", "._", "get_", "(_", "'", "password", "'_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "location_", "._", "startswith_", "(_", "\"", "unix", ":\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "[_", "'", "connecti", "on", "\\u", "class", "'_", "]_", "=_", "Uni", "x", "Doma", "in", "Sock", "et", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "path", "'_", "]_", "=_", "location_", "[_", "5_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "[_", "'", "host", "'_", "]_", ",_", "params_", "[_", "'", "port", "'_", "]_", "=_", "location_", "._", "split_", "(_", "\":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "port", "'_", "]_", "=_", "int_", "(_", "params_", "[_", "'", "port", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "(_", "\"", "Inva", "lid", " ", "`", "location", "`", " ", "key", " ", "synta", "x", " ", "on", " ", "connecti", "on", " ", "kwarg", "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_", "cls_", "._", "pools_", "[_", "pool", "\\u", "key_", "]_", "=_", "Red", "is", "Connect", "ion", "Pool_", "(_", "**_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "._", "pools_", "[_", "pool", "\\u", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Red", "is", "Queue", "View_", "(_", "Base", "Ss", "e", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "redis", "\\u", "channel_", "=_", "DEF", "AUL", "T", "\\u", "CHANNEL_", "\\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_", "Red", "is", "Queue", "View_", "(_", "Base", "Ss", "e", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "iterator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "\\u", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pubsub_", "=_", "connection_", "._", "pubsub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pubsub_", "._", "subscribe_", "(_", "self_", "._", "get", "\\u", "redis", "\\u", "channel_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "message_", "in_", "pubsub_", "._", "listen_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "message_", "[_", "'", "type", "'_", "]_", "==_", "'", "message", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event_", ",_", "data_", "=_", "json_", "._", "loads_", "(_", "message_", "[_", "'", "data", "'_", "]_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sse", "_", "._", "add", "\\u", "message_", "(_", "event_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Red", "is", "Queue", "View_", "(_", "Base", "Ss", "e", "View_", ")_", ":_", "\\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", "redis", "\\u", "channel_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "redis", "\\u", "channel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\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", "connect_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pool_", "=_", "Connect", "ion", "Poo", "l", "Manager_", "._", "connecti", "on", "\\u", "pool_", "(_", "**_", "CONNECTION", "\\u", "KW", "ARGS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Redis_", "(_", "connecti", "on", "\\u", "pool_", "=_", "pool_", ")_", "\\u\\u\\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_", "send", "\\u", "event_", "(_", "event", "\\u", "name_", ",_", "data_", ",_", "channel_", "=_", "DEF", "AUL", "T", "\\u", "CHANNEL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "=_", "\\u", "connect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "._", "publish_", "(_", "channel_", ",_", "json_", "._", "dumps_", "(_", "[_", "event", "\\u", "name_", ",_", "data_", "]_", ")_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 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 ]
Except block handles 'BaseException'
CollabQ/CollabQ/vendor/twitterapi/twitter.py
[ { "content": " def GetCachedTime(self, key):\n entry = _DbCacheEntry.get_by_key_name(key)\n if entry:\n try:\n # All cached data must be valid JSON, and if we mistakenly cache\n # error response, we should ignore them\n data = simplejson.loads(entry.value)\n if isinstance(data, dict) and data.has_key('error'):\n return None\n except:\n return None\n\n return time.mktime(entry.timestamp.timetuple())\n else:\n return None\n\n return None", "metadata": "root._DbCache.GetCachedTime", "header": "['class', '_DbCache', '(', 'object', ')', ':', '___EOS___']", "index": 2224 } ]
[ { "span": "except:", "start_line": 2233, "start_column": 6, "end_line": 2233, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "\\u", "Db", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Cache", "d", "Time_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entry_", "=_", "\\u", "Db", "Cache", "Entry_", "._", "get", "\\u", "by", "\\u", "key", "\\u", "name_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entry_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", " ", "cache", "d", " ", "data", " ", "must", " ", "be", " ", "valid", " ", "JSO", "N", ",", " ", "and", " ", "if", " ", "we", " ", "mist", "ake", "nl", "y", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "error", " ", "response", ",", " ", "we", " ", "shou", "ld", " ", "ignore", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "simplejson_", "._", "loads_", "(_", "entry_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "data_", ",_", "dict_", ")_", "and_", "data_", "._", "has", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "time_", "._", "mktime_", "(_", "entry_", "._", "timestamp_", "._", "timetuple_", "(_", ")_", ")_", "\\u\\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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_" ]
[ 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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
sokolovstas/SublimeWebInspector/websocket.py
[ { "content": " def close(self, status = STATUS_NORMAL, reason = \"\"):\n \"\"\"\n Close Websocket object\n\n status: status code to send. see STATUS_XXX.\n\n reason: the reason to close. This must be string.\n \"\"\"\n if self.connected:\n if status < 0 or status >= ABNF.LENGTH_16:\n raise ValueError(\"code is invalid range\")\n\n try:\n self.send(struct.pack('!H', status) + reason, ABNF.OPCODE_CLOSE)\n timeout = self.sock.gettimeout()\n self.sock.settimeout(3)\n try:\n frame = self.recv_frame()\n if logger.isEnabledFor(logging.DEBUG):\n logger.error(\"close status: \" + repr(frame.data))\n except:\n pass\n self.sock.settimeout(timeout)\n self.sock.shutdown(socket.SHUT_RDWR)\n except:\n pass\n self._closeInternal()", "metadata": "root.WebSocket.close", "header": "['class', 'WebSocket', '(', 'object', ')', ':', '___EOS___']", "index": 643 } ]
[ { "span": "except:", "start_line": 663, "start_column": 16, "end_line": 663, "end_column": 23 }, { "span": "except:", "start_line": 667, "start_column": 12, "end_line": 667, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Web", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ",_", "status_", "=_", "STATUS", "\\u", "NORMAL_", ",_", "reason_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Clos", "e", " ", "Webs", "ocket", " ", "object", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "status", ":", " ", "status", " ", "code", " ", "to", " ", "send", ".", " ", "see", " ", "STATUS", "\\u", "XX", "X", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "reason", ":", " ", "the", " ", "reason", " ", "to", " ", "close", ".", " ", "Thi", "s", " ", "must", " ", "be", " ", "string", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "connected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "status_", "<_", "0_", "or_", "status_", ">=_", "AB", "NF", "_", "._", "LENGTH", "\\u", "16_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "code", " ", "is", " ", "invalid", " ", "range", "\"_", ")_", "\\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_", "(_", "struct_", "._", "pack_", "(_", "'!", "H", "'_", ",_", "status_", ")_", "+_", "reason_", ",_", "AB", "NF", "_", "._", "OPCODE", "\\u", "CLOSE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timeout_", "=_", "self_", "._", "sock_", "._", "getti", "meo", "ut_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sock_", "._", "settimeout_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "frame_", "=_", "self_", "._", "recv", "\\u", "frame_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "logger_", "._", "is", "Enable", "d", "For_", "(_", "logging_", "._", "DEBUG_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "logger_", "._", "error_", "(_", "\"", "close", " ", "status", ":", " ", "\"_", "+_", "repr_", "(_", "frame_", "._", "data_", ")_", ")_", "\\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_", "self_", "._", "sock_", "._", "settimeout_", "(_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\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_", ":_", "\\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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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
kuri65536/python-for-android/python-modules/twisted/twisted/conch/scripts/cftp.py
[ { "content": "def _ebExit(f):\n #global exitStatus\n if hasattr(f.value, 'value'):\n s = f.value.value\n else:\n s = str(f)\n print s\n #exitStatus = \"conch: exiting with error %s\" % f\n try:\n reactor.stop()\n except: pass", "metadata": "root._ebExit", "header": "['module', '___EOS___']", "index": 101 }, { "content": " def _cbPutMultipleNext(self, res, files, path):\n if isinstance(res, failure.Failure):\n self._printFailure(res)\n elif res:\n self.transport.write(res)\n if not res.endswith('\\n'):\n self.transport.write('\\n')\n f = None\n while files and not f:\n try:\n f = files.pop(0)\n lf = file(f, 'r')\n except:\n self._printFailure(failure.Failure())\n f = None\n if not f:\n return\n name = os.path.split(f)[1]\n remote = os.path.join(self.currentDirectory, path, name)\n log.msg((name, remote, path))\n flags = filetransfer.FXF_WRITE|filetransfer.FXF_CREAT|filetransfer.FXF_TRUNC\n d = self.client.openFile(remote, flags, {})\n d.addCallback(self._cbPutOpenFile, lf)\n d.addErrback(self._ebCloseLf, lf)\n d.addBoth(self._cbPutMultipleNext, files, path)\n return d", "metadata": "root.StdioClient._cbPutMultipleNext", "header": "['class', 'StdioClient', '(', 'basic', '.', 'LineReceiver', ')', ':', '___EOS___']", "index": 432 }, { "content": " def closed(self):\n try:\n reactor.stop()\n except:\n pass", "metadata": "root.SSHSession.closed", "header": "['class', 'SSHSession', '(', 'channel', '.', 'SSHChannel', ')', ':', '___EOS___']", "index": 817 } ]
[ { "span": "except: ", "start_line": 111, "start_column": 4, "end_line": 111, "end_column": 11 }, { "span": "except:", "start_line": 444, "start_column": 12, "end_line": 444, "end_column": 19 }, { "span": "except:", "start_line": 820, "start_column": 8, "end_line": 820, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "eb", "Exit_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "global", " ", "exit", "Status_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "f_", "._", "value_", ",_", "'", "value", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "f_", "._", "value_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "str_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "exit", "Status", " ", "=", " ", "\"", "conc", "h", ":", " ", "exit", "ing", " ", "with", " ", "error", " ", "%", "s", "\"", " ", "%", " ", "f_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reactor_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Std", "io", "Client_", "(_", "basic_", "._", "Line", "Receiver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "cb", "Put", "Multipl", "e", "Next_", "(_", "self_", ",_", "res_", ",_", "files_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "res_", ",_", "failure_", "._", "Failure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "print", "Failure_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transport_", "._", "write_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "res_", "._", "endswith_", "(_", "'\\\\", "n", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transport_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "files_", "and_", "not_", "f_", ":_", "\\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 ", " _", "f_", "=_", "files_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lf_", "=_", "file_", "(_", "f_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "print", "Failure_", "(_", "failure_", "._", "Failure_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "f_", ":_", "\\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_", "name_", "=_", "os_", "._", "path_", "._", "split_", "(_", "f_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "current", "Directory_", ",_", "path_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "msg_", "(_", "(_", "name_", ",_", "remote_", ",_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "=_", "filet", "ransf", "er_", "._", "FX", "F", "\\u", "WRITE_", "|_", "filet", "ransf", "er_", "._", "FX", "F", "\\u", "CRE", "AT_", "|_", "filet", "ransf", "er_", "._", "FX", "F", "\\u", "TRUN", "C_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "client_", "._", "open", "File_", "(_", "remote_", ",_", "flags_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "self_", "._", "\\u", "cb", "Put", "Open", "File_", ",_", "lf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Errback_", "(_", "self_", "._", "\\u", "eb", "Clos", "e", "Lf", "_", ",_", "lf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Bot", "h_", "(_", "self_", "._", "\\u", "cb", "Put", "Multipl", "e", "Next_", ",_", "files_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SSH", "Session_", "(_", "channel_", "._", "SSH", "Channel_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "closed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reactor_", "._", "stop_", "(_", ")_", "\\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_" ]
[ 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, 0, 1, 1, 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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 2, 2, 2, 2, 2 ]
Import of deprecated module
cloudera/hue/desktop/core/ext-py/South-1.0.2/south/management/commands/datamigration.py
[ { "content": "\"\"\"\nData migration creation command\n\"\"\"\n\nfrom __future__ import print_function\n\nimport sys\nimport os\nimport re\nfrom optparse import make_option\n\ntry:\n set\nexcept NameError:\n from sets import Set as set\n\nfrom django.core.management.base import BaseCommand\nfrom django.core.management.color import no_style\nfrom django.db import models\nfrom django.conf import settings\n\nfrom south.migration import Migrations\nfrom south.exceptions import NoMigrations\nfrom south.creator import freezer\n\n\n\nMIGRATION_TEMPLATE = \"\"\"# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import DataMigration\nfrom django.db import models\n\nclass Migration(DataMigration):\n\n def forwards(self, orm):\n \"Write your forwards methods here.\"\n # Note: Don't use \"from appname.models import ModelName\". \n # Use orm.ModelName to refer to models in this application,\n # and orm['appname.ModelName'] for models in other applications.\n\n def backwards(self, orm):\n \"Write your backwards methods here.\"\n\n models = %(frozen_models)s\n\n %(complete_apps)s\n symmetrical = True\n\"\"\"\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "sets ", "start_line": 14, "start_column": 9, "end_line": 14, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Data", " ", "migrati", "on", " ", "creati", "on", " ", "command", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "optparse_", "import_", "make", "\\u", "option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sets_", "import_", "Set_", "as_", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Base", "Command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "color_", "import_", "no", "\\u", "style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "south_", "._", "migration_", "import_", "Migrat", "ions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "exceptions_", "import_", "No", "Migrat", "ions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "creator_", "import_", "freez", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "MIGRAT", "ION", "\\u", "TEMPLATE_", "=_", "\"\"\"#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "\\", "10", ";", "from", " ", "south", ".", "util", "s", " ", "import", " ", "datetime", "\\u", "util", "s", " ", "as", " ", "datetime", "\\", "10", ";", "from", " ", "south", ".", "db", " ", "import", " ", "db", "\\", "10", ";", "from", " ", "south", ".", "v2", " ", "import", " ", "Data", "Migrat", "ion", "\\", "10", ";", "from", " ", "django", ".", "db", " ", "import", " ", "model", "s", "\\", "10", ";", "\\", "10", ";", "class", " ", "Migrat", "ion", "(", "Data", "Migrat", "ion", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "forward", "s", "(", "self", ",", " ", "orm", "):", "\\", "10", ";", " ", " ", " ", " ", "\"", "Write", " ", "your", " ", "forward", "s", " ", "method", "s", " ", "here", ".\"", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Not", "e", ":", " ", "Don", "'", "t", " ", "use", " ", "\"", "from", " ", "app", "name", ".", "model", "s", " ", "import", " ", "Model", "Name", "\".", " ", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "Us", "e", " ", "orm", ".", "Model", "Name", " ", "to", " ", "refer", " ", "to", " ", "model", "s", " ", "in", " ", "this", " ", "applica", "tion", ",", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "and", " ", "orm", "['", "app", "name", ".", "Model", "Name", "']", " ", "for", " ", "model", "s", " ", "in", " ", "other", " ", "applica", "tion", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "back", "ward", "s", "(", "self", ",", " ", "orm", "):", "\\", "10", ";", " ", " ", " ", " ", "\"", "Write", " ", "your", " ", "back", "ward", "s", " ", "method", "s", " ", "here", ".\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "model", "s", " ", "=", " ", "%", "(", "frozen", "\\u", "model", "s", ")", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "complete", "\\u", "apps", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "symmetric", "al", " ", "=", " ", "Tru", "e", "\\", "10", ";\"\"\"_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 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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